]> git.saurik.com Git - wxWidgets.git/commitdiff
in addition to key events, also prevent unhandled mouse events from propagating up...
authorPaul Cornett <paulcor@bullseye.com>
Sat, 14 Jan 2012 19:54:50 +0000 (19:54 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Sat, 14 Jan 2012 19:54:50 +0000 (19:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70342 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/window.cpp

index 9d99c4b6b7a042b4b78661170d910b4672eb21ea..526a47f492770f541725fa3f955cb2ce2e086b55 100644 (file)
@@ -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