Ensure that key events are sent to focused window first in wxGTK.

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
This commit is contained in:
Vadim Zeitlin 2012-10-07 22:42:50 +00:00
parent d34d31f6d6
commit 1bcef6701b
2 changed files with 9 additions and 0 deletions

View 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:

View 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))))