X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d0fb62a656c9e47dc4887c5143e692616c36aa37..cd95f7e65c4e1ee61a5d90eb13687ff468cb13ad:/src/gtk/window.cpp diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 86eb2c026d..0c05229765 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -37,9 +37,14 @@ #include "wx/gtk/private.h" #include "wx/gtk/private/win_gtk.h" -#include + #include +#include +#if GTK_CHECK_VERSION(3,0,0) +#include +#endif + #if !GTK_CHECK_VERSION(2,10,0) // GTK+ can reliably detect Meta key state only since 2.10 when // GDK_META_MASK was introduced -- there wasn't any way to detect it @@ -729,7 +734,7 @@ static void wxFillOtherKeyEventFields(wxKeyEvent& event, } event.m_rawCode = (wxUint32) gdk_event->keyval; - event.m_rawFlags = 0; + event.m_rawFlags = gdk_event->hardware_keycode; wxGetMousePosition( &x, &y ); win->ScreenToClient( &x, &y ); @@ -879,17 +884,21 @@ bool SendCharHookAndCharEvents(const wxKeyEvent& event, wxWindow *win) { // wxEVT_CHAR_HOOK must be sent to the top level parent window to allow it - // to handle key events in all of its children. - wxWindow * const parent = wxGetTopLevelParent(win); - if ( parent ) - { - // We need to make a copy of the event object because it is - // modified while it's handled, notably its WasProcessed() flag - // is set after it had been processed once. - wxKeyEvent eventCharHook(event); - eventCharHook.SetEventType(wxEVT_CHAR_HOOK); - if ( parent->HandleWindowEvent(eventCharHook) ) - return true; + // to handle key events in all of its children unless the mouse is captured + // in which case we consider that the keyboard should be "captured" too. + if ( !g_captureWindow ) + { + wxWindow * const parent = wxGetTopLevelParent(win); + if ( parent ) + { + // We need to make a copy of the event object because it is + // modified while it's handled, notably its WasProcessed() flag + // is set after it had been processed once. + wxKeyEvent eventCharHook(event); + eventCharHook.SetEventType(wxEVT_CHAR_HOOK); + if ( parent->HandleWindowEvent(eventCharHook) ) + return true; + } } // As above, make a copy of the event first. @@ -2048,9 +2057,7 @@ wxMouseState wxGetMouseState() // method #ifdef __WXUNIVERSAL__ IMPLEMENT_ABSTRACT_CLASS(wxWindowGTK, wxWindowBase) -#else // __WXGTK__ - IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase) -#endif // __WXUNIVERSAL__/__WXGTK__ +#endif // __WXUNIVERSAL__ void wxWindowGTK::Init() { @@ -2617,8 +2624,7 @@ void wxWindowGTK::OnInternalIdle() m_needsStyleChange = false; } - if (wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen()) - UpdateWindowUI(wxUPDATE_UI_FROMIDLE); + wxWindowBase::OnInternalIdle(); } void wxWindowGTK::DoGetSize( int *width, int *height ) const @@ -3782,19 +3788,23 @@ void wxWindowGTK::DoSetToolTip( wxToolTip *tip ) { GtkWidget *w = GetConnectWidget(); wxToolTip::GTKApply(w, NULL); -#if GTK_CHECK_VERSION(2, 12, 0) - // Just applying NULL doesn't work on 2.12.0, so also use - // gtk_widget_set_has_tooltip. It is part of the new GtkTooltip API - // but seems also to work with the old GtkTooltips. - if (gtk_check_version(2, 12, 0) == NULL) - gtk_widget_set_has_tooltip(w, FALSE); -#endif } } void wxWindowGTK::GTKApplyToolTip( GtkTooltips *tips, const gchar *tip ) { - gtk_tooltips_set_tip(tips, GetConnectWidget(), tip, NULL); + GtkWidget *w = GetConnectWidget(); + +#if GTK_CHECK_VERSION(2, 12, 0) + if (!gtk_check_version(2, 12, 0)) + { + gtk_widget_set_tooltip_text (w, tip); + } + else +#endif + { + gtk_tooltips_set_tip(tips, w, tip, NULL); + } } #endif // wxUSE_TOOLTIPS