Bug 1219215 - part 0: fix context menu code to take window dragging region into account, r=jimm draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 18 Jan 2016 14:30:44 +0000
changeset 323634 2feea836b779b237d2da9f5f2e966ed3c6c37d4b
parent 323475 c2139fedfe55c5e36d173268eea3aba55467b12f
child 323635 4dc5670d87d40b8e21cd19fa01b91c34606251a6
child 323923 ff9d7691e203697caddb3a9f2de6cb676a15a6b4
push id9760
push usergijskruitbosch@gmail.com
push dateWed, 20 Jan 2016 21:28:51 +0000
reviewersjimm
bugs1219215
milestone46.0a1
Bug 1219215 - part 0: fix context menu code to take window dragging region into account, r=jimm
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -5305,23 +5305,29 @@ nsWindow::ProcessMessage(UINT msg, WPARA
       }
 
       result = DispatchMouseEvent(eContextMenu, wParam, pos, contextMenukey,
                                   contextMenukey ?
                                     WidgetMouseEvent::eLeftButton :
                                     WidgetMouseEvent::eRightButton,
                                   MOUSE_INPUT_SOURCE());
       if (lParam != -1 && !result && mCustomNonClient) {
-        WidgetMouseEvent event(true, eMouseHitTest, this,
-                               WidgetMouseEvent::eReal,
-                               WidgetMouseEvent::eNormal);
-        event.refPoint = LayoutDeviceIntPoint(GET_X_LPARAM(pos), GET_Y_LPARAM(pos));
-        event.inputSource = MOUSE_INPUT_SOURCE();
-        event.mFlags.mOnlyChromeDispatch = true;
-        if (DispatchWindowEvent(&event)) {
+        bool shouldShowMenu = false;
+        if (mDraggableRegion.Contains(GET_X_LPARAM(pos), GET_Y_LPARAM(pos))) {
+          shouldShowMenu = true;
+        } else {
+          WidgetMouseEvent event(true, eMouseHitTest, this,
+                                 WidgetMouseEvent::eReal,
+                                 WidgetMouseEvent::eNormal);
+          event.refPoint = LayoutDeviceIntPoint(GET_X_LPARAM(pos), GET_Y_LPARAM(pos));
+          event.inputSource = MOUSE_INPUT_SOURCE();
+          event.mFlags.mOnlyChromeDispatch = true;
+          shouldShowMenu = DispatchWindowEvent(&event);
+        }
+        if (shouldShowMenu) {
           // Blank area hit, throw up the system menu.
           DisplaySystemMenu(mWnd, mSizeMode, mIsRTL, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
           result = true;
         }
       }
     }
     break;