Avoid duplicate wxEVT_UPDATE_UI for popup menus
Don't call wxMenu::UpdateUI() explicitly in wxMSW, wxGTK and wxOSX code before showing the popup menu as it is also called when any menu is opened from port-independent wxFrameBase wxEVT_MENU_OPEN handler, resulting in two events being generated. But also don't send the events from wxFrameBase handler only to the frame itself, by explicitly passing "source" argument to wxMenu::UpdateUI(), as this prevented the event from being sent to the window popping up the menu. By just omitting this parameter we ensure that this event is sent to the right window. Closes #17352 (but notice that there are still duplicate events under OS X, see #17354).
This commit is contained in:
parent
0ddf12104a
commit
f74379c751
@ -631,8 +631,7 @@ void wxFrameBase::DoMenuUpdates(wxMenu* menu)
|
||||
{
|
||||
if (menu)
|
||||
{
|
||||
wxEvtHandler* source = GetEventHandler();
|
||||
menu->UpdateUI(source);
|
||||
menu->UpdateUI();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4685,8 +4685,6 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") );
|
||||
|
||||
menu->UpdateUI();
|
||||
|
||||
wxPoint pos;
|
||||
gpointer userdata;
|
||||
GtkMenuPositionFunc posfunc;
|
||||
|
@ -2099,8 +2099,6 @@ static void wxYieldForCommandsOnly()
|
||||
|
||||
bool wxWindowMSW::DoPopupMenu(wxMenu *menu, int x, int y)
|
||||
{
|
||||
menu->UpdateUI();
|
||||
|
||||
wxPoint pt;
|
||||
if ( x == wxDefaultCoord && y == wxDefaultCoord )
|
||||
{
|
||||
|
@ -910,8 +910,6 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor)
|
||||
bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y)
|
||||
{
|
||||
#ifndef __WXUNIVERSAL__
|
||||
menu->UpdateUI();
|
||||
|
||||
if ( x == wxDefaultCoord && y == wxDefaultCoord )
|
||||
{
|
||||
wxPoint mouse = wxGetMousePosition();
|
||||
|
Loading…
Reference in New Issue
Block a user