X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/113faca13fe634e34752e63530409ee40f84334f..68d89837ca67e18c1a10f3581cd965d114794bce:/src/gtk/window.cpp diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index c631f3b014..e8851e90a4 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -210,6 +210,11 @@ wxWindowGTK *g_focusWindowLast = (wxWindowGTK*) NULL; // yet, defer setting the focus to idle time. wxWindowGTK *g_delayedFocus = (wxWindowGTK*) NULL; +// global variables because GTK+ DnD want to have the +// mouse event that caused it +GdkEvent *g_lastMouseEvent = (GdkEvent*) NULL; +int g_lastButtonNumber = 0; + extern bool g_mainThreadLocked; //----------------------------------------------------------------------------- @@ -1462,6 +1467,8 @@ gtk_window_button_press_callback( GtkWidget *widget, { wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win); + g_lastButtonNumber = gdk_event->button; + if (win->m_wxwindow && (g_focusWindow != win) && win->AcceptsFocus()) { gtk_widget_grab_focus( win->m_wxwindow ); @@ -1578,6 +1585,8 @@ gtk_window_button_press_callback( GtkWidget *widget, return FALSE; } + g_lastMouseEvent = (GdkEvent*) gdk_event; + wxMouseEvent event( event_type ); InitMouseEvent( win, event, gdk_event ); @@ -1599,8 +1608,10 @@ gtk_window_button_press_callback( GtkWidget *widget, if (win->GTKProcessEvent( event )) { + g_lastMouseEvent = NULL; return TRUE; } + g_lastMouseEvent = NULL; if (event_type == wxEVT_RIGHT_DOWN) { @@ -1633,6 +1644,8 @@ gtk_window_button_release_callback( GtkWidget *widget, { wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win); + g_lastButtonNumber = 0; + wxEventType event_type = wxEVT_NULL; switch (gdk_event->button) @@ -1654,6 +1667,8 @@ gtk_window_button_release_callback( GtkWidget *widget, return FALSE; } + g_lastMouseEvent = (GdkEvent*) gdk_event; + wxMouseEvent event( event_type ); InitMouseEvent( win, event, gdk_event ); @@ -1693,6 +1708,8 @@ gtk_window_motion_notify_callback( GtkWidget *widget, gdk_event->y = y; } + g_lastMouseEvent = (GdkEvent*) gdk_event; + wxMouseEvent event( wxEVT_MOTION ); InitMouseEvent(win, event, gdk_event); @@ -1735,7 +1752,11 @@ gtk_window_motion_notify_callback( GtkWidget *widget, } } - return win->GTKProcessEvent(event); + bool ret = win->GTKProcessEvent(event); + + g_lastMouseEvent = NULL; + + return ret; } //----------------------------------------------------------------------------- @@ -4236,6 +4257,7 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) m_clipPaintRegion = false; +#if wxUSE_CARET bool restoreCaret = (GetCaret() != NULL && GetCaret()->IsVisible()); if (restoreCaret) { @@ -4255,6 +4277,7 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) RefreshRect(caretRect); } +#endif } void wxWindowGTK::GtkScrolledWindowSetBorder(GtkWidget* w, int wxstyle)