From 4ae711c91a7639617da44cf5be60359f5a496626 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 30 Jul 2003 00:15:26 +0000 Subject: [PATCH] reverted GTK 1.x part of the last patch, it breaks popup menus sometimes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@22378 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 8 +++++++- src/gtk1/window.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index a4defbdf7d..7c4c00df1a 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -255,6 +255,10 @@ wxWindowGTK *g_delayedFocus = (wxWindowGTK*) NULL; // send any activate events at all static int g_sendActivateEvent = -1; +// hack: we need something to pass to gtk_menu_popup, so we store the time of +// the last click here +static guint32 gs_timeLastClick = 0; + extern bool g_mainThreadLocked; //----------------------------------------------------------------------------- @@ -1577,6 +1581,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, if ( !g_captureWindow ) win = FindWindowForMouseEvent(win, event.m_x, event.m_y); + gs_timeLastClick = gdk_event->time; + /* wxPrintf( wxT("2) OnButtonPress from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) @@ -4231,7 +4237,7 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) #ifdef __WXGTK20__ gtk_get_current_event_time() #else - GDK_CURRENT_TIME + gs_timeLastClick // the time of activation #endif ); diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index a4defbdf7d..7c4c00df1a 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -255,6 +255,10 @@ wxWindowGTK *g_delayedFocus = (wxWindowGTK*) NULL; // send any activate events at all static int g_sendActivateEvent = -1; +// hack: we need something to pass to gtk_menu_popup, so we store the time of +// the last click here +static guint32 gs_timeLastClick = 0; + extern bool g_mainThreadLocked; //----------------------------------------------------------------------------- @@ -1577,6 +1581,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, if ( !g_captureWindow ) win = FindWindowForMouseEvent(win, event.m_x, event.m_y); + gs_timeLastClick = gdk_event->time; + /* wxPrintf( wxT("2) OnButtonPress from ") ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) @@ -4231,7 +4237,7 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y ) #ifdef __WXGTK20__ gtk_get_current_event_time() #else - GDK_CURRENT_TIME + gs_timeLastClick // the time of activation #endif );