]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix duplicate wxContextMenuEvent generation in wxMSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 8 May 2013 11:21:41 +0000 (11:21 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 8 May 2013 11:21:41 +0000 (11:21 +0000)
Prevent WM_CONTEXTMENU from being propagated upwards the window parent chain
by DefWindowProc(), we already do it ourselves and not marking the message as
processed could result in multiple calls to the same wxEVT_CONTEXT_MENU
handler if it skipped the event.

See #13683.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/window.cpp

index 908424749ec180319fd72f39af0058dfc38227e5..c614dca82d7e207af53bbe66d2df194e288b093e 100644 (file)
@@ -3433,6 +3433,12 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
 #if !defined(__WXWINCE__)
         case WM_CONTEXTMENU:
             {
+                // As with WM_HELP above, this message is propagated upwards
+                // the parent chain by DefWindowProc() itself, so we should
+                // always mark it as processed to prevent it from doing this
+                // as this would result in duplicate calls to event handlers.
+                processed = true;
+
                 // we don't convert from screen to client coordinates as
                 // the event may be handled by a parent window
                 wxPoint pt(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
@@ -3452,7 +3458,7 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
                     win = this;
 
                 evtCtx.SetEventObject(win);
-                processed = win->HandleWindowEvent(evtCtx);
+                win->HandleWindowEvent(evtCtx);
             }
             break;
 #endif