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:
@@ -398,7 +398,7 @@ protected:
|
|||||||
static bool ms_locked;
|
static bool ms_locked;
|
||||||
|
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
// Common part of SendEvent() and ProcessMenuEvent(): sends the event to
|
// Common part of SendEvent() and ProcessMenuEvent(): sends the event to
|
||||||
// its intended recipients, returns true if it was processed.
|
// its intended recipients, returns true if it was processed.
|
||||||
static bool DoProcessEvent(wxMenuBase* menu, wxEvent& event, wxWindow* win);
|
static bool DoProcessEvent(wxMenuBase* menu, wxEvent& event, wxWindow* win);
|
||||||
|
@@ -326,23 +326,7 @@ bool wxMenu::HandleCommandUpdateStatus( wxMenuItem* item, wxWindow* senderWindow
|
|||||||
wxUpdateUIEvent event(menuid);
|
wxUpdateUIEvent event(menuid);
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
|
|
||||||
bool processed = false;
|
bool processed = DoProcessEvent(this, event, GetWindow());
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !processed && senderWindow != NULL)
|
if ( !processed && senderWindow != NULL)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user