X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4dcaf11a7b5189be78e52e1412febd7689a959f8..22d6efa851642c6a69174278fc50f712f41e2271:/src/gtk/window.cpp?ds=inline diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index bfdc8bcc81..dfeb16b66f 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2845,6 +2845,15 @@ void wxWindow::ApplyWidgetStyle() { } +//----------------------------------------------------------------------------- +// Pop-up menu stuff +//----------------------------------------------------------------------------- + +static void gtk_pop_hide_callback( GtkWidget *WXUNUSED(widget), bool* is_waiting ) +{ + *is_waiting = FALSE; +} + static void SetInvokingWindow( wxMenu *menu, wxWindow *win ) { menu->SetInvokingWindow( win ); @@ -2885,6 +2894,11 @@ bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y ) gs_pop_x = x; gs_pop_y = y; + bool is_waiting = TRUE; + + gtk_signal_connect( GTK_OBJECT(menu->m_menu), "hide", + GTK_SIGNAL_FUNC(gtk_pop_hide_callback), (gpointer)&is_waiting ); + gtk_menu_popup( GTK_MENU(menu->m_menu), (GtkWidget *) NULL, // parent menu shell @@ -2894,6 +2908,13 @@ bool wxWindow::DoPopupMenu( wxMenu *menu, int x, int y ) 0, // button used to activate it 0 //gs_timeLastClick // the time of activation ); + + while (is_waiting) + { + while (gtk_events_pending()) + gtk_main_iteration(); + } + return TRUE; }