X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fec9cc08e7d94574af3f04b4c5fbafde63ac0b31..30c4dd918ad3fd79065f5253e012b39e5fe942c8:/src/gtk1/window.cpp diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index a96be8e042..25864e277a 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -28,12 +28,13 @@ #include "wx/settings.h" #include "wx/msgdlg.h" #include "wx/textctrl.h" + #include "wx/combobox.h" + #include "wx/layout.h" + #include "wx/statusbr.h" + #include "wx/math.h" + #include "wx/module.h" #endif -#include "wx/layout.h" -#include "wx/module.h" -#include "wx/combobox.h" - #if wxUSE_DRAG_AND_DROP #include "wx/dnd.h" #endif @@ -46,14 +47,12 @@ #include "wx/caret.h" #endif // wxUSE_CARET -#include "wx/statusbr.h" #include "wx/fontutil.h" #ifdef __WXDEBUG__ #include "wx/thread.h" #endif -#include "wx/math.h" #include #include "wx/gtk1/private.h" @@ -226,6 +225,10 @@ wxWindowGTK *g_delayedFocus = (wxWindowGTK*) NULL; // the last click here (extern: used from gtk/menu.cpp) guint32 wxGtkTimeLastClick = 0; +// Save the last mouse event for drag start +GdkEvent *g_lastMouseEvent = (GdkEvent*) NULL; +int g_lastButtonNumber = 0; + extern bool g_mainThreadLocked; //----------------------------------------------------------------------------- @@ -826,7 +829,7 @@ static long wxTranslateKeySymToWXKey(KeySym keysym, bool isChar) break; case GDK_KP_Next: // == GDK_KP_Page_Down - key_code = isChar ? WXK_NEXT : WXK_NUMPAD_PAGEDOWN; + key_code = isChar ? WXK_PAGEDOWN : WXK_NUMPAD_PAGEDOWN; break; case GDK_KP_End: @@ -1469,6 +1472,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE; + g_lastButtonNumber = gdk_event->button; + if (win->m_wxwindow && (g_focusWindow != win) && win->AcceptsFocus()) { gtk_widget_grab_focus( win->m_wxwindow ); @@ -1576,6 +1581,8 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, return FALSE; } + g_lastMouseEvent = (GdkEvent*) gdk_event; + wxMouseEvent event( event_type ); InitMouseEvent( win, event, gdk_event ); @@ -1652,6 +1659,8 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE; + g_lastButtonNumber = 0; + wxEventType event_type = wxEVT_NULL; switch (gdk_event->button) @@ -1673,6 +1682,8 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, return FALSE; } + g_lastMouseEvent = (GdkEvent*) gdk_event; + wxMouseEvent event( event_type ); InitMouseEvent( win, event, gdk_event ); @@ -1724,6 +1735,8 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, gdk_event->y = y; } + g_lastMouseEvent = (GdkEvent*) gdk_event; + /* printf( "OnMotion from " ); if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) @@ -2932,13 +2945,11 @@ void wxWindowGTK::OnInternalIdle() gdk_window_set_cursor( window, cursor.GetCursor() ); } - else + else if ( m_widget ) { - GdkWindow *window = m_widget->window; - if ((window) && !(GTK_WIDGET_NO_WINDOW(m_widget))) + if ( window && !GTK_WIDGET_NO_WINDOW(m_widget) ) gdk_window_set_cursor( window, cursor.GetCursor() ); - } } @@ -3415,16 +3426,14 @@ bool wxWindowGTK::SetCursor( const wxCursor &cursor ) { wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") ); - if (cursor == m_cursor) + if ( cursor.IsSameAs(m_cursor) ) return false; if (g_isIdle) wxapp_install_idle_handler(); - if (cursor == wxNullCursor) - return wxWindowBase::SetCursor( *wxSTANDARD_CURSOR ); - else - return wxWindowBase::SetCursor( cursor ); + return wxWindowBase::SetCursor( cursor.IsOk() ? cursor + : *wxSTANDARD_CURSOR ); } void wxWindowGTK::WarpPointer( int x, int y )