]> git.saurik.com Git - wxWidgets.git/commitdiff
Ensure that key events are sent to focused window first in wxGTK.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 7 Oct 2012 22:42:50 +0000 (22:42 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 7 Oct 2012 22:42:50 +0000 (22:42 +0000)
Start processing key events from the currently focused window, this ensures
that its key event handlers are tried before the top level window
accelerators.

This is consistent with wxMSW and allows a window to locally override the
global accelerators which really makes sense.

Closes #14553.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72640 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/gtk/toplevel.cpp

index af95c7bb2f6fc38f49999b13775cdd173b03fffe..9a7e08d7e190a1482f46cd1d87c3e9508e4ef0a2 100644 (file)
@@ -574,6 +574,7 @@ wxGTK:
 - Provide native implementation of wxNotificationMessage using libnotify.
 - Generate clipboard events for wxComboBox and not only wxTextCtrl.
 - Improve drag-and-drop of URLs.
+- Make key event handling consistent with wxMSW (John Rails).
 
 wxMSW:
 
index b561d5f61d7cf094e6b5891598f2893cbb36ecd1..99119fa8964d9ef03f8ade707b58703ebd712433 100644 (file)
@@ -640,6 +640,14 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
     g_signal_connect_after (m_widget, "focus_out_event",
                       G_CALLBACK (gtk_frame_focus_out_callback), this);
 
+    // GTK processes key events at the top level first, which handles for
+    // menu accelerators and shortcuts before passing the event on to the
+    // focus child window to begin propagation. We want to propagate
+    // first, so we connect gtk_window_propagate_key_event to
+    // key_press_event.
+    g_signal_connect (m_widget, "key_press_event",
+                      G_CALLBACK (gtk_window_propagate_key_event), NULL);
+
 #ifdef GDK_WINDOWING_X11
 #ifdef __WXGTK3__
     if (GDK_IS_X11_SCREEN(gtk_window_get_screen(GTK_WINDOW(m_widget))))