Fixed proper focus setup
authorromashin
Sat, 19 Apr 2008 18:38:12 +0300
changeset 16812 4d7e1d1f29039329bac817d8729000bab6db80cb
parent 16811 b28149d233d297c1ba218e17c1a66c33a894010e
child 16813 f35018ecbc7c93cb4bf7340cb8175750bbe058cf
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
milestone2.0a1pre
Fixed proper focus setup
widget/src/qt/nsWindow.cpp
--- a/widget/src/qt/nsWindow.cpp
+++ b/widget/src/qt/nsWindow.cpp
@@ -1406,17 +1406,17 @@ nsWindow::OnButtonPressEvent(QMouseEvent
     nsEventStatus status;
     DispatchEvent(&event, status);
 
     // right menu click on linux should also pop up a context menu
     if (domButton == nsMouseEvent::eRightButton &&
         NS_LIKELY(!mIsDestroyed)) {
         nsMouseEvent contextMenuEvent(PR_TRUE, NS_CONTEXTMENU, this,
                                       nsMouseEvent::eReal);
-        InitButtonEvent(contextMenuEvent, aEvent);
+        InitButtonEvent(contextMenuEvent, aEvent, 1);
         DispatchEvent(&contextMenuEvent, status);
     }
 
     return ignoreEvent(status);
 }
 
 bool
 nsWindow::OnButtonReleaseEvent(QMouseEvent *aEvent)
@@ -1433,17 +1433,17 @@ nsWindow::OnButtonReleaseEvent(QMouseEve
         break;
     default:
         domButton = nsMouseEvent::eLeftButton;
         break;
     }
 
     nsMouseEvent event(PR_TRUE, NS_MOUSE_BUTTON_UP, this, nsMouseEvent::eReal);
     event.button = domButton;
-    InitButtonEvent(event, aEvent);
+    InitButtonEvent(event, aEvent, 1);
 
     nsEventStatus status;
     DispatchEvent(&event, status);
     return ignoreEvent(status);
 }
 
 bool
 nsWindow::mouseDoubleClickEvent(QMouseEvent *e)
@@ -1475,48 +1475,43 @@ nsWindow::mouseDoubleClickEvent(QMouseEv
 bool
 nsWindow::OnContainerFocusInEvent(QFocusEvent *aEvent)
 {
     LOGFOCUS(("OnContainerFocusInEvent [%p]\n", (void *)this));
     // Return if someone has blocked events for this widget.  This will
     // happen if someone has called gtk_widget_grab_focus() from
     // nsWindow::SetFocus() and will prevent recursion.
 
-    if (mIsTopLevel)
-        mActivatePending = PR_TRUE;
+    if (!mDrawingarea)
+        return FALSE;
 
     // Unset the urgency hint, if possible
 //    SetUrgencyHint(top_window, PR_FALSE);
 
     // dispatch a got focus event
     DispatchGotFocusEvent();
 
     // send the activate event if it wasn't already sent via any
     // SetFocus() calls that were the result of the GOTFOCUS event
     // above.
-    if (mActivatePending) {
-        mActivatePending = PR_FALSE;
-        DispatchActivateEvent();
-    }
+    DispatchActivateEvent();
 
     LOGFOCUS(("Events sent from focus in event [%p]\n", (void *)this));
     return FALSE;
 }
 
 bool
 nsWindow::OnContainerFocusOutEvent(QFocusEvent *aEvent)
 {
     LOGFOCUS(("OnContainerFocusOutEvent [%p]\n", (void *)this));
 
     DispatchLostFocusEvent();
     if (mDrawingarea)
         DispatchDeactivateEvent();
 
-    mActivatePending = PR_FALSE;
-
     LOGFOCUS(("Done with container focus out [%p]\n", (void *)this));
     return FALSE;
 }
 
 inline PRBool
 is_latin_shortcut_key(quint32 aKeyval)
 {
     return ((Qt::Key_0 <= aKeyval && aKeyval <= Qt::Key_9) ||