-}
-
-// used to pass the coordinates from wxWindowGTK::DoPopupMenu() to
-// wxPopupMenuPositionCallback()
-//
-// should be safe even in the MT case as the user can hardly popup 2 menus
-// simultaneously, can he?
-static gint gs_pop_x = 0;
-static gint gs_pop_y = 0;
-
-extern "C" void wxPopupMenuPositionCallback( GtkMenu *menu,
- gint *x, gint *y,
-#ifdef __WXGTK20__
- gboolean * WXUNUSED(whatever),
-#endif
- gpointer WXUNUSED(user_data) )
-{
- // ensure that the menu appears entirely on screen
- GtkRequisition req;
- gtk_widget_get_child_requisition(GTK_WIDGET(menu), &req);
-
- wxSize sizeScreen = wxGetDisplaySize();
-
- gint xmax = sizeScreen.x - req.width,
- ymax = sizeScreen.y - req.height;
-
- *x = gs_pop_x < xmax ? gs_pop_x : xmax;
- *y = gs_pop_y < ymax ? gs_pop_y : ymax;
-}
-
-bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
-{
- wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid window") );
-
- wxCHECK_MSG( menu != NULL, FALSE, wxT("invalid popup-menu") );
-
- SetInvokingWindow( menu, this );
-
- menu->UpdateUI();
-
- gs_pop_x = x;
- gs_pop_y = y;
- ClientToScreen( &gs_pop_x, &gs_pop_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
- (GtkWidget *) NULL, // parent menu item
- wxPopupMenuPositionCallback, // function to position it
- NULL, // client data
- 0, // button used to activate it
- gs_timeLastClick // the time of activation
- );
-
- while (is_waiting)