X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6150a29606ca14c90f29f0449983c106bc72ca84..fb8d7eb7a880f1f2e32d8830f9c5e12b2536e05f:/src/gtk/menu.cpp diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 09fecd8a14..686761a6be 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -152,6 +152,18 @@ wxMenuBar::wxMenuBar() namespace { +// This should be called when detaching menus to ensure that they don't keep +// focus grab, because if they do, they continue getting all GTK+ messages +// which they can't process any more in their (soon to be) unrealized state. +void +EnsureNoGrab(GtkWidget* widget) +{ +#if !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 + gtk_widget_hide(widget); + gtk_grab_remove(widget); +#endif // !wxUSE_LIBHILDON && !wxUSE_LIBHILDON2 +} + void DetachFromFrame(wxMenu* menu, wxFrame* frame) { @@ -173,6 +185,8 @@ DetachFromFrame(wxMenu* menu, wxFrame* frame) DetachFromFrame(menuitem->GetSubMenu(), frame); node = node->GetNext(); } + + EnsureNoGrab(menu->m_menu); } void @@ -260,6 +274,8 @@ void wxMenuBar::Detach() node = node->GetNext(); } + EnsureNoGrab(m_widget); + wxMenuBarBase::Detach(); }