diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index d2f0b65e63..3bd97fb96f 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -3970,23 +3970,6 @@ bool wxWindowGTK::SetBackgroundStyle(wxBackgroundStyle style) #if wxUSE_MENUS_NATIVE -static void SetInvokingWindow( wxMenu *menu, wxWindow* win ) -{ - menu->SetInvokingWindow( win ); - - wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst(); - while (node) - { - wxMenuItem *menuitem = node->GetData(); - if (menuitem->IsSubMenu()) - { - SetInvokingWindow( menuitem->GetSubMenu(), win ); - } - - node = node->GetNext(); - } -} - extern "C" { static void wxPopupMenuPositionCallback( GtkMenu *menu, @@ -4015,7 +3998,7 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) wxCHECK_MSG( menu != NULL, false, wxT("invalid popup-menu") ); - SetInvokingWindow( menu, this ); + menu->SetInvokingWindow( this ); menu->UpdateUI(); @@ -4051,6 +4034,8 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) gtk_main_iteration(); } + menu->SetInvokingWindow( NULL ); + return true; }