diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 9d99c4b6b7..526a47f492 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1069,15 +1069,16 @@ gtk_window_key_release_callback( GtkWidget * WXUNUSED(widget), } //----------------------------------------------------------------------------- -// "key_press_event"/"key_release_event", after, from m_widget +// key and mouse events, after, from m_widget //----------------------------------------------------------------------------- extern "C" { -static gboolean key_event_after(GtkWidget* widget, GdkEventKey*, wxWindow*) +static gboolean key_and_mouse_event_after(GtkWidget* widget, GdkEventKey*, wxWindow*) { - // If a widget does not handle a key event, GTK+ sends it up the parent - // chain until it is handled. Key events are not supposed to propagate in - // wxWidgets, so prevent it unless widget is in a native container. + // If a widget does not handle a key or mouse event, GTK+ sends it up the + // parent chain until it is handled. These events are not supposed to + // propagate in wxWidgets, so prevent it unless widget is in a native + // container. return WX_IS_PIZZA(gtk_widget_get_parent(widget)); } } @@ -2371,9 +2372,17 @@ void wxWindowGTK::PostCreation() ConnectWidget( connect_widget ); - // connect handler to prevent key events from propagating up parent chain - g_signal_connect_after(m_widget, "key_press_event", G_CALLBACK(key_event_after), this); - g_signal_connect_after(m_widget, "key_release_event", G_CALLBACK(key_event_after), this); + // connect handler to prevent events from propagating up parent chain + g_signal_connect_after(m_widget, + "key_press_event", G_CALLBACK(key_and_mouse_event_after), this); + g_signal_connect_after(m_widget, + "key_release_event", G_CALLBACK(key_and_mouse_event_after), this); + g_signal_connect_after(m_widget, + "button_press_event", G_CALLBACK(key_and_mouse_event_after), this); + g_signal_connect_after(m_widget, + "button_release_event", G_CALLBACK(key_and_mouse_event_after), this); + g_signal_connect_after(m_widget, + "motion_notify_event", G_CALLBACK(key_and_mouse_event_after), this); // We cannot set colours, fonts and cursors before the widget has been // realized, so we do this directly after realization -- unless the widget