Fix duplicate wxContextMenuEvent generation in wxMSW.

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
This commit is contained in:
Vadim Zeitlin
2013-05-08 11:21:41 +00:00
parent 0ba28d4196
commit 54753c3d75

View 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