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.
This commit is contained in:
Vadim Zeitlin 2019-10-25 03:49:15 +02:00
parent 7a475e4695
commit 6d1b6c71c4
2 changed files with 2 additions and 18 deletions

View File

@ -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);

View File

@ -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)
{