Bug 511010, don't activate panels when clicking on one to close a menu, fixes flickering when closing menulist in bookmarks panel, r=jmathies,a=bsmedberg
authorNeil Deakin <neil@mozilla.com>
Wed, 24 Nov 2010 13:31:24 -0500
changeset 58173 4d4cbab267d955ab27931f64e759745b112ded1a
parent 58172 3bb695b1a788146c849f242fb424a29d86bb14f1
child 58174 1bb96fbc54f8528acd0d2eb46e2695203e1e7769
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersjmathies, bsmedberg
bugs511010
milestone2.0b8pre
Bug 511010, don't activate panels when clicking on one to close a menu, fixes flickering when closing menulist in bookmarks panel, r=jmathies,a=bsmedberg
widget/src/windows/nsWindow.cpp
widget/src/windows/nsWindow.h
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -8244,17 +8244,32 @@ nsWindow::DealWithPopups(HWND inWnd, UIN
         sRollupMsgId = 0;
         sRollupMsgWnd = NULL;
 
         // return TRUE tells Windows that the event is consumed,
         // false allows the event to be dispatched
         //
         // So if we are NOT supposed to be consuming events, let it go through
         if (consumeRollupEvent && inMsg != WM_RBUTTONDOWN) {
-          *outResult = TRUE;
+          *outResult = MA_ACTIVATE;
+
+          // However, don't activate panels
+#ifndef WINCE
+          if (inMsg == WM_MOUSEACTIVATE) {
+            nsWindow* activateWindow = GetNSWindowPtr(inWnd);
+            if (activateWindow) {
+              nsWindowType wintype;
+              activateWindow->GetWindowType(wintype);
+              if (wintype == eWindowType_popup && activateWindow->PopupType() == ePopupTypePanel) {
+                *outResult = MA_NOACTIVATE;
+              }
+            }
+          }
+#endif
+
           return TRUE;
         }
 #ifndef WINCE
         // if we are only rolling up some popups, don't activate and don't let
         // the event go through. This prevents clicks menus higher in the
         // chain from opening when a context menu is open
         if (popupsToRollup != PR_UINT32_MAX && inMsg == WM_MOUSEACTIVATE) {
           *outResult = MA_NOACTIVATEANDEAT;
--- a/widget/src/windows/nsWindow.h
+++ b/widget/src/windows/nsWindow.h
@@ -451,16 +451,18 @@ protected:
   static void             ActivateOtherWindowHelper(HWND aWnd);
   static PRUint16         GetMouseInputSource();
 #endif
 #ifdef ACCESSIBILITY
   static STDMETHODIMP_(LRESULT) LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc);
 #endif // ACCESSIBILITY
   void                    ClearCachedResources();
 
+  nsPopupType PopupType() { return mPopupType; }
+
 protected:
   nsCOMPtr<nsIWidget>   mParent;
   nsIntSize             mLastSize;
   nsIntPoint            mLastPoint;
   HWND                  mWnd;
   WNDPROC               mPrevWndProc;
   HBRUSH                mBrush;
   PRPackedBool          mIsTopWidgetWindow;