Bug 787818. Send activate and deactivate notifications to the correct window. r=enndeakin a=akeybl
authorTimothy Nikkel <tnikkel@gmail.com>
Fri, 16 Nov 2012 17:40:28 -0600
changeset 117027 9e7aeb6be40a95f4b2ac96f27132c72f794408ac
parent 117026 80afbd9cf1e53727f80b97a528ad9abe430cdb6f
child 117028 1f1083953e62a30a77627837a41150d2885ba339
push id1717
push usertnikkel@gmail.com
push dateTue, 20 Nov 2012 19:44:05 +0000
treeherdermozilla-beta@9e7aeb6be40a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin, akeybl
bugs787818
milestone18.0
Bug 787818. Send activate and deactivate notifications to the correct window. r=enndeakin a=akeybl
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -4011,22 +4011,16 @@ bool nsWindow::DispatchMouseEvent(uint32
 }
 
 void nsWindow::DispatchFocusToTopLevelWindow(bool aIsActivate)
 {
   if (aIsActivate)
     sJustGotActivate = false;
   sJustGotDeactivate = false;
 
-  if (!aIsActivate && BlurEventsSuppressed())
-    return;
-
-  if (!mWidgetListener)
-    return;
-
   // retrive the toplevel window or dialog
   HWND curWnd = mWnd;
   HWND toplevelWnd = NULL;
   while (curWnd) {
     toplevelWnd = curWnd;
 
     nsWindow *win = WinUtils::GetNSWindowPtr(curWnd);
     if (win) {
@@ -4036,21 +4030,24 @@ void nsWindow::DispatchFocusToTopLevelWi
         break;
     }
 
     curWnd = ::GetParent(curWnd); // Parent or owner (if has no parent)
   }
 
   if (toplevelWnd) {
     nsWindow *win = WinUtils::GetNSWindowPtr(toplevelWnd);
-    if (win) {
-      if (aIsActivate)
-        mWidgetListener->WindowActivated();
-      else
-        mWidgetListener->WindowDeactivated();
+    if (win && win->mWidgetListener) {
+      if (aIsActivate) {
+        win->mWidgetListener->WindowActivated();
+      } else {
+        if (!win->BlurEventsSuppressed()) {
+          win->mWidgetListener->WindowDeactivated();
+        }
+      }
     }
   }
 }
 
 bool nsWindow::IsTopLevelMouseExit(HWND aWnd)
 {
   DWORD pos = ::GetMessagePos();
   POINT mp;