From 6d1b6c71c47d26be741a153e913d7845475a2a5a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 25 Oct 2019 03:49:15 +0200 Subject: [PATCH] Fix wxUpdateUIEvent prcoessing for standard menu items under Mac Handle these events in the menu itself first, then the window and only then at the application level instead of falling back on the application before searching the window for the handler. This requires using the logic already present in the base class DoProcessEvent() method, so make it protected to allow reuse. Closes #4769. --- include/wx/menu.h | 2 +- src/osx/menu_osx.cpp | 18 +----------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/include/wx/menu.h b/include/wx/menu.h index eb262bc2da..af9f2e7364 100644 --- a/include/wx/menu.h +++ b/include/wx/menu.h @@ -398,7 +398,7 @@ protected: static bool ms_locked; -private: +protected: // Common part of SendEvent() and ProcessMenuEvent(): sends the event to // its intended recipients, returns true if it was processed. static bool DoProcessEvent(wxMenuBase* menu, wxEvent& event, wxWindow* win); diff --git a/src/osx/menu_osx.cpp b/src/osx/menu_osx.cpp index e24ce81579..75251bc06a 100644 --- a/src/osx/menu_osx.cpp +++ b/src/osx/menu_osx.cpp @@ -326,23 +326,7 @@ bool wxMenu::HandleCommandUpdateStatus( wxMenuItem* item, wxWindow* senderWindow wxUpdateUIEvent event(menuid); event.SetEventObject( this ); - bool processed = false; - - // Try the menu's event handler - { - wxEvtHandler *handler = GetEventHandler(); - if ( handler ) - processed = handler->ProcessEvent(event); - } - - // Try the window the menu was popped up from - // (and up through the hierarchy) - if ( !processed ) - { - wxWindow *win = GetWindow(); - if ( win ) - processed = win->HandleWindowEvent(event); - } + bool processed = DoProcessEvent(this, event, GetWindow()); if ( !processed && senderWindow != NULL) {