From 09c05de7250578d2a00caa2144aacc8abb56c46f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Wed, 18 Jun 2014 12:57:26 +0000 Subject: [PATCH] Handle WM_*MENU* events in wxWindow. Contrary to MSDN implications, at least some of these messages are not actually sent to the TLW for popup menus, but to the owning window or even its parent window (!). Catch the events in wxWindow and forward to the TLW. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76724 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/window.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 0e3f79e4db..ee6ce9f202 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -3491,6 +3491,26 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result, } } break; + +#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__) + case WM_INITMENUPOPUP: + case WM_MENUSELECT: + case WM_EXITMENULOOP: + case WM_UNINITMENUPOPUP: + { + // Contrary to MSDN implications, at least some of these messages are + // not actually sent to the TLW for popup menus, but to the owning + // window or even its parent window. + // + // wx-3.1+ handles these messages in wxWindow instead, but binary + // compatibility requirements on wx-3.0 make it simpler to just forward + // the messages to the wxTLW. + wxWindow *tlw = wxGetTopLevelParent(this); + if ( tlw && tlw != this ) + processed = tlw->MSWWindowProc(message, wParam, lParam); + } + break; +#endif // !__WXMICROWIN__ #endif // wxUSE_MENUS #ifndef __WXWINCE__