Bug 609843 - Make Fn key working. r=romaxa a=npodb

This commit is contained in:
Jeremias Bosch
2011-01-26 11:01:01 +02:00
parent 51bd182611
commit 16f2f65bd6

View File

@@ -177,6 +177,8 @@ static PRBool check_for_rollup(double aMouseX, double aMouseY,
static bool
is_mouse_in_window (MozQWidget* aWindow, double aMouseX, double aMouseY);
static bool sAltGrModifier = false;
static PRBool
isContextMenuKeyEvent(const QKeyEvent *qe)
{
@@ -198,6 +200,11 @@ InitKeyEvent(nsKeyEvent &aEvent, QKeyEvent *aQEvent)
aEvent.isMeta = (aQEvent->modifiers() & Qt::MetaModifier) ? PR_TRUE : PR_FALSE;
aEvent.time = 0;
if (sAltGrModifier) {
aEvent.isControl = PR_TRUE;
aEvent.isAlt = PR_TRUE;
}
// The transformations above and in qt for the keyval are not invertible
// so link to the QKeyEvent (which will vanish soon after return from the
// event callback) to give plugins access to hardware_keycode and state.
@@ -1461,6 +1468,10 @@ nsWindow::OnKeyPressEvent(QKeyEvent *aEvent)
PRBool setNoDefault = PR_FALSE;
if (aEvent->key() == Qt::Key_AltGr) {
sAltGrModifier = true;
}
#ifdef MOZ_X11
// before we dispatch a key, check if it's the context menu key.
// If so, send a context menu key event instead.
@@ -1821,6 +1832,10 @@ nsWindow::OnKeyReleaseEvent(QKeyEvent *aEvent)
nsKeyEvent event(PR_TRUE, NS_KEY_UP, this);
InitKeyEvent(event, aEvent);
if (aEvent->key() == Qt::Key_AltGr) {
sAltGrModifier = false;
}
event.keyCode = domKeyCode;
// unset the key down flag