b=793501 set gFocusWindow on fallback instead of early, which interfered with container window focus change detection in SetFocus() r=roc
authorKarl Tomlinson <karlt+@karlt.net>
Tue, 23 Oct 2012 11:31:53 +1300
changeset 111100 45b8a00043d5ab818a276d528cb46083beb8a5ce
parent 111099 363b1a7f2cae656f2afe35f6497bcd2432c5a50d
child 111101 31df6929909f429b5c9c7e20376a7c49cdb2befc
push id16872
push userktomlinson@mozilla.com
push dateTue, 23 Oct 2012 02:15:22 +0000
treeherdermozilla-inbound@a0158d370785 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs793501
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
b=793501 set gFocusWindow on fallback instead of early, which interfered with container window focus change detection in SetFocus() r=roc
widget/gtk2/nsWindow.cpp
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -2789,25 +2789,30 @@ nsWindow::OnContainerFocusInEvent(GtkWid
 
     // Return if being called within SetFocus because the focus manager
     // already knows that the window is active.
     if (gBlockActivateEvent) {
         LOGFOCUS(("activated notification is blocked [%p]\n", (void *)this));
         return;
     }
 
-    // This is not usually the correct window for dispatching key events,
-    // but the focus manager will call SetFocus to set the correct window if
-    // keyboard input will be accepted.  Setting a non-NULL value here
-    // prevents OnButtonPressEvent() from dispatching an activation
-    // notification if the widget is already active.
-    gFocusWindow = this;
+    // If keyboard input will be accepted, the focus manager will call
+    // SetFocus to set the correct window.
+    gFocusWindow = nullptr;
 
     DispatchActivateEvent();
 
+    if (!gFocusWindow) {
+        // We don't really have a window for dispatching key events, but
+        // setting a non-NULL value here prevents OnButtonPressEvent() from
+        // dispatching an activation notification if the widget is already
+        // active.
+        gFocusWindow = this;
+    }
+
     LOGFOCUS(("Events sent from focus in event [%p]\n", (void *)this));
 }
 
 void
 nsWindow::OnContainerFocusOutEvent(GtkWidget *aWidget, GdkEventFocus *aEvent)
 {
     LOGFOCUS(("OnContainerFocusOutEvent [%p]\n", (void *)this));