]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/window.cpp
Fixed some compile errors (MSVC++ 6) and some very strange link errors when
[wxWidgets.git] / src / gtk / window.cpp
index bfdc8bcc81d78c1a89a15e77313428a6cf5e7844..1cc1b40434972962de461bff551aa0f74b5cf33b 100644 (file)
@@ -132,7 +132,7 @@ extern bool       g_blockEventsOnDrag;
 extern bool       g_blockEventsOnScroll;
 extern wxCursor   g_globalCursor;
 static wxWindow  *g_captureWindow = (wxWindow*) NULL;
-static wxWindow  *g_focusWindow = (wxWindow*) NULL;
+       wxWindow  *g_focusWindow = (wxWindow*) NULL;
 
 /* hack: we need something to pass to gtk_menu_popup, so we store the time of
    the last click here */
@@ -812,7 +812,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
         ret = (ret || win->GetEventHandler()->ProcessEvent( event2 ));
     }
 
-
     /* win is a control: tab can be propagated up */
     if ( (!ret) &&
          ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab)) &&
@@ -2845,6 +2844,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 +2893,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 +2907,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;
 }