зеркало из https://github.com/mozilla/pjs.git
Bug 665406 Support XF86Copy, XF86Paste, XF86Cut, XF86Undo, XF86Redo keysym r=masayuki, Olli.Pettay
This commit is contained in:
Родитель
a01d857267
Коммит
d744caf50e
|
@ -69,10 +69,6 @@
|
|||
command="cmd_redo"/>
|
||||
<handler event="keypress" key="a" modifiers="alt"
|
||||
command="cmd_selectAll"/>
|
||||
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
|
||||
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
|
||||
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
|
||||
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
@ -157,10 +153,6 @@
|
|||
command="cmd_redo"/>
|
||||
<handler event="keypress" key="a" modifiers="alt"
|
||||
command="cmd_selectAll"/>
|
||||
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
|
||||
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
|
||||
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
|
||||
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
@ -182,10 +174,6 @@
|
|||
<handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" />
|
||||
<handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" />
|
||||
|
||||
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
|
||||
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
|
||||
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
|
||||
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
|
||||
<handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious" />
|
||||
<handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext" />
|
||||
<handler event="keypress" keycode="VK_LEFT" modifiers="control,shift" command="cmd_selectWordPrevious" />
|
||||
|
@ -240,10 +228,6 @@
|
|||
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
|
||||
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
|
||||
<handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
|
||||
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
|
||||
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
|
||||
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
|
||||
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
|
||||
</handlers>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
command="cmd_redo"/>
|
||||
<handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
|
||||
<handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
|
||||
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
@ -26,10 +25,6 @@
|
|||
command="cmd_redo"/>
|
||||
<handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
|
||||
<handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
|
||||
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
|
||||
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
|
||||
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
|
||||
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
@ -51,10 +46,6 @@
|
|||
<handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop" />
|
||||
<handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom" />
|
||||
|
||||
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
|
||||
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
|
||||
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
|
||||
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
|
||||
<handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious" />
|
||||
<handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext" />
|
||||
<handler event="keypress" keycode="VK_LEFT" modifiers="control,shift" command="cmd_selectWordPrevious" />
|
||||
|
@ -76,10 +67,6 @@
|
|||
<handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
|
||||
<handler event="keypress" key="y" modifiers="accel" command="cmd_redo"/>
|
||||
<handler event="keypress" key="a" modifiers="alt" command="cmd_selectAll"/>
|
||||
<handler event="keypress" keycode="VK_F20" command="cmd_cut" />
|
||||
<handler event="keypress" keycode="VK_F16" command="cmd_copy" />
|
||||
<handler event="keypress" keycode="VK_F18" command="cmd_paste" />
|
||||
<handler event="keypress" keycode="VK_F14" command="cmd_undo" />
|
||||
</handlers>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
|
|
@ -178,14 +178,11 @@ struct nsKeyConverter nsKeycodes[] = {
|
|||
{ NS_VK_EQUALS, GDK_plus }
|
||||
};
|
||||
|
||||
#ifdef SOLARIS
|
||||
// map Sun Keyboard special keysyms on to NS_VK keys
|
||||
struct nsKeyConverter nsSunKeycodes[] = {
|
||||
{NS_VK_F1, GDK_Help }, //Mapping Help key to F1
|
||||
{NS_VK_F11, 0x1005ff10 }, //Sun F11 key generates SunF36(0x1005ff10) keysym
|
||||
{NS_VK_F12, 0x1005ff11 } //Sun F12 key generates SunF37(0x1005ff11) keysym
|
||||
};
|
||||
#endif
|
||||
|
||||
int
|
||||
GdkKeyCodeToDOMKeyCode(int aKeysym)
|
||||
|
@ -211,13 +208,11 @@ GdkKeyCodeToDOMKeyCode(int aKeysym)
|
|||
if (aKeysym >= GDK_KP_0 && aKeysym <= GDK_KP_9)
|
||||
return aKeysym - GDK_KP_0 + NS_VK_NUMPAD0;
|
||||
|
||||
#ifdef SOLARIS
|
||||
// map Sun Keyboard special keysyms
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(nsSunKeycodes); i++) {
|
||||
if (nsSunKeycodes[i].keysym == aKeysym)
|
||||
return(nsSunKeycodes[i].vkCode);
|
||||
}
|
||||
#endif /* SOLARIS */
|
||||
|
||||
// misc other things
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(nsKeycodes); i++) {
|
||||
|
|
|
@ -3041,6 +3041,15 @@ nsWindow::DispatchCommandEvent(nsIAtom* aCommand)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsWindow::DispatchContentCommandEvent(PRInt32 aMsg)
|
||||
{
|
||||
nsEventStatus status;
|
||||
nsContentCommandEvent event(PR_TRUE, aMsg, this);
|
||||
DispatchEvent(&event, status);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static PRUint32
|
||||
GetCharCodeFor(const GdkEventKey *aEvent, guint aShiftState,
|
||||
gint aGroup)
|
||||
|
@ -3187,6 +3196,20 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
|
|||
return DispatchCommandEvent(nsWidgetAtoms::Bookmarks);
|
||||
case XF86XK_HomePage:
|
||||
return DispatchCommandEvent(nsWidgetAtoms::Home);
|
||||
case XF86XK_Copy:
|
||||
case GDK_F16: // F16, F20, F18, F14 are old keysyms for Copy Cut Paste Undo
|
||||
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_COPY);
|
||||
case XF86XK_Cut:
|
||||
case GDK_F20:
|
||||
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_CUT);
|
||||
case XF86XK_Paste:
|
||||
case GDK_F18:
|
||||
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_PASTE);
|
||||
case GDK_Redo:
|
||||
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_REDO);
|
||||
case GDK_Undo:
|
||||
case GDK_F14:
|
||||
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_UNDO);
|
||||
}
|
||||
#endif /* ! AIX */
|
||||
#endif /* MOZ_X11 */
|
||||
|
|
|
@ -382,6 +382,7 @@ private:
|
|||
void SetDefaultIcon(void);
|
||||
void InitButtonEvent(nsMouseEvent &aEvent, GdkEventButton *aGdkEvent);
|
||||
PRBool DispatchCommandEvent(nsIAtom* aCommand);
|
||||
PRBool DispatchContentCommandEvent(PRInt32 aMsg);
|
||||
void SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
||||
PRBool aIntersectWithExisting);
|
||||
PRBool GetDragInfo(nsMouseEvent* aMouseEvent,
|
||||
|
|
|
@ -75,6 +75,7 @@ static struct nsKeyConverter nsKeycodes[] =
|
|||
{ NS_VK_PRINTSCREEN, Qt::Key_Print },
|
||||
{ NS_VK_INSERT, Qt::Key_Insert },
|
||||
{ NS_VK_DELETE, Qt::Key_Delete },
|
||||
{ NS_VK_HELP, Qt::Key_Help },
|
||||
|
||||
{ NS_VK_0, Qt::Key_0 },
|
||||
{ NS_VK_1, Qt::Key_1 },
|
||||
|
@ -172,15 +173,6 @@ static struct nsKeyConverter nsKeycodes[] =
|
|||
{ NS_VK_META, Qt::Key_Meta }
|
||||
};
|
||||
|
||||
|
||||
#ifdef SOLARIS
|
||||
struct nsKeyConverter nsSunKeycodes[] = {
|
||||
{NS_VK_F1, Qt::Key_Help }, //Mapping Help key to F1
|
||||
{NS_VK_F11, 0x1005ff10 }, //Sun F11 key generates SunF36(0x1005ff10) keysym
|
||||
{NS_VK_F12, 0x1005ff11 } //Sun F12 key generates SunF37(0x1005ff11) keysym
|
||||
};
|
||||
#endif
|
||||
|
||||
int
|
||||
QtKeyCodeToDOMKeyCode(int aKeysym)
|
||||
{
|
||||
|
@ -203,14 +195,6 @@ QtKeyCodeToDOMKeyCode(int aKeysym)
|
|||
// if (aKeysym >= Qt::Key_KP_0 && aKeysym <= Qt::Key_KP_9)
|
||||
// return aKeysym - Qt::Key_KP_0 + NS_VK_NUMPAD0;
|
||||
|
||||
#ifdef SOLARIS
|
||||
// map Sun Keyboard special keysyms
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(nsSunKeycodes); i++) {
|
||||
if (nsSunKeycodes[i].keysym == aKeysym)
|
||||
return(nsSunKeycodes[i].vkCode);
|
||||
}
|
||||
#endif
|
||||
|
||||
// misc other things
|
||||
for (i = 0; i < NS_ARRAY_LENGTH(nsKeycodes); i++) {
|
||||
if (nsKeycodes[i].keysym == aKeysym)
|
||||
|
|
|
@ -1478,14 +1478,26 @@ is_latin_shortcut_key(quint32 aKeyval)
|
|||
(Qt::Key_A <= aKeyval && aKeyval <= Qt::Key_Z));
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsEventStatus
|
||||
nsWindow::DispatchCommandEvent(nsIAtom* aCommand)
|
||||
{
|
||||
nsCommandEvent event(PR_TRUE, nsWidgetAtoms::onAppCommand, aCommand, this);
|
||||
|
||||
DispatchEvent(&event);
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&event, status);
|
||||
|
||||
return PR_TRUE;
|
||||
return status;
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
nsWindow::DispatchContentCommandEvent(PRInt32 aMsg)
|
||||
{
|
||||
nsContentCommandEvent event(PR_TRUE, aMsg, this);
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&event, status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
|
@ -1622,6 +1634,46 @@ nsWindow::OnKeyPressEvent(QKeyEvent *aEvent)
|
|||
nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
// Look for specialized app-command keys
|
||||
switch (aEvent->key()) {
|
||||
case Qt::Key_Back:
|
||||
return DispatchCommandEvent(nsWidgetAtoms::Back);
|
||||
case Qt::Key_Forward:
|
||||
return DispatchCommandEvent(nsWidgetAtoms::Forward);
|
||||
case Qt::Key_Refresh:
|
||||
return DispatchCommandEvent(nsWidgetAtoms::Reload);
|
||||
case Qt::Key_Stop:
|
||||
return DispatchCommandEvent(nsWidgetAtoms::Stop);
|
||||
case Qt::Key_Search:
|
||||
return DispatchCommandEvent(nsWidgetAtoms::Search);
|
||||
case Qt::Key_Favorites:
|
||||
return DispatchCommandEvent(nsWidgetAtoms::Bookmarks);
|
||||
case Qt::Key_HomePage:
|
||||
return DispatchCommandEvent(nsWidgetAtoms::Home);
|
||||
case Qt::Key_Copy:
|
||||
case Qt::Key_F16: // F16, F20, F18, F14 are old keysyms for Copy Cut Paste Undo
|
||||
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_COPY);
|
||||
case Qt::Key_Cut:
|
||||
case Qt::Key_F20:
|
||||
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_CUT);
|
||||
case Qt::Key_Paste:
|
||||
case Qt::Key_F18:
|
||||
case Qt::Key_F9:
|
||||
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_PASTE);
|
||||
case Qt::Key_F14:
|
||||
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_UNDO);
|
||||
}
|
||||
|
||||
#ifdef MOZ_X11
|
||||
// Qt::Key_Redo and Qt::Key_Undo are not available yet.
|
||||
if (aEvent->nativeVirtualKey() == 0xff66) {
|
||||
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_REDO);
|
||||
}
|
||||
if (aEvent->nativeVirtualKey() == 0xff65) {
|
||||
return DispatchContentCommandEvent(NS_CONTENT_COMMAND_UNDO);
|
||||
}
|
||||
#endif // MOZ_X11
|
||||
|
||||
nsKeyEvent event(PR_TRUE, NS_KEY_PRESS, this);
|
||||
InitKeyEvent(event, aEvent);
|
||||
|
||||
|
|
|
@ -345,7 +345,8 @@ private:
|
|||
nsresult SetWindowIconList(const nsTArray<nsCString> &aIconList);
|
||||
void SetDefaultIcon(void);
|
||||
void InitButtonEvent(nsMouseEvent &event, QGraphicsSceneMouseEvent *aEvent, int aClickCount = 1);
|
||||
PRBool DispatchCommandEvent(nsIAtom* aCommand);
|
||||
nsEventStatus DispatchCommandEvent(nsIAtom* aCommand);
|
||||
nsEventStatus DispatchContentCommandEvent(PRInt32 aMsg);
|
||||
MozQWidget* createQWidget(MozQWidget *parent, nsWidgetInitData *aInitData);
|
||||
|
||||
PRBool IsAcceleratedQView(QGraphicsView* aView);
|
||||
|
|
Загрузка…
Ссылка в новой задаче