Bug 537907 - [qt] Can't type with keyboard because of broken focus. r=vlad
authorMiika Jarvinen <mjarvin@gmail.com>
Fri, 08 Jan 2010 09:12:21 +0100
changeset 36948 6ce98ed11af8a38561d23d132668dd0793408533
parent 36947 1f9ae6f1f9c55e256aa99649a8a91dea1e065df8
child 36949 99bb0c6877f02bb9e7f2d2cd55963cd6fca2582c
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersvlad
bugs537907
milestone1.9.3a1pre
Bug 537907 - [qt] Can't type with keyboard because of broken focus. r=vlad
widget/src/qt/mozqwidget.cpp
widget/src/qt/nsWindow.cpp
--- a/widget/src/qt/mozqwidget.cpp
+++ b/widget/src/qt/mozqwidget.cpp
@@ -88,24 +88,24 @@ bool MozQWidget::event(QEvent *e)
     break;
     case QEvent::IMEnd:
     {
         QIMEvent *iev = (QIMEvent*)(e);
         status = mReceiver->imEndEvent(iev);
     }
     break;
 */
-    case QEvent::FocusIn:
+    case QEvent::WindowActivate:
     {
         QFocusEvent *fev = (QFocusEvent*)(e);
         mReceiver->OnFocusInEvent(fev);
         return TRUE;
     }
     break;
-    case QEvent::FocusOut:
+    case QEvent::WindowDeactivate:
     {
         QFocusEvent *fev = (QFocusEvent*)(e);
         mReceiver->OnFocusOutEvent(fev);
         return TRUE;
     }
     break;
     case QEvent::Enter:
     {
--- a/widget/src/qt/nsWindow.cpp
+++ b/widget/src/qt/nsWindow.cpp
@@ -136,20 +136,20 @@ isContextMenuKeyEvent(const QKeyEvent *q
     PRBool isShift = qe->modifiers() & Qt::ShiftModifier;
     return (kc == NS_VK_F10 && isShift) ||
         (kc == NS_VK_CONTEXT_MENU && !isShift);
 }
 
 static void
 InitKeyEvent(nsKeyEvent &aEvent, QKeyEvent *aQEvent)
 {
-    aEvent.isShift   = aQEvent->modifiers() & Qt::ShiftModifier;
-    aEvent.isControl = aQEvent->modifiers() & Qt::ControlModifier;
-    aEvent.isAlt     = aQEvent->modifiers() & Qt::AltModifier;
-    aEvent.isMeta    = aQEvent->modifiers() & Qt::MetaModifier;
+    aEvent.isShift   = (aQEvent->modifiers() & Qt::ShiftModifier) ? PR_TRUE : PR_FALSE;
+    aEvent.isControl = (aQEvent->modifiers() & Qt::ControlModifier) ? PR_TRUE : PR_FALSE;
+    aEvent.isAlt     = (aQEvent->modifiers() & Qt::AltModifier) ? PR_TRUE : PR_FALSE;
+    aEvent.isMeta    = (aQEvent->modifiers() & Qt::MetaModifier) ? PR_TRUE : PR_FALSE;
     aEvent.time      = 0;
 
     // The transformations above and in gdk for the keyval are not invertible
     // so link to the GdkEvent (which will vanish soon after return from the
     // event callback) to give plugins access to hardware_keycode and state.
     // (An XEvent would be nice but the GdkEvent is good enough.)
     aEvent.pluginEvent = (void *)aQEvent;
 }