From 50b58dec17f90370a1ae76ad00aaff8c3c5066a9 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 8 Feb 2005 17:02:57 +0000 Subject: [PATCH] Check accelerators before sending EVT_CHAR git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31862 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 39 ++++++++++++++++++++------------------- src/gtk1/window.cpp | 39 ++++++++++++++++++++------------------- 2 files changed, 40 insertions(+), 38 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index ddd4ba38f3..4e92f5a423 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1219,6 +1219,26 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, #endif // #ifndef __WXGTK20__ +#if wxUSE_ACCEL + if (!ret) + { + wxWindowGTK *ancestor = win; + while (ancestor) + { + int command = ancestor->GetAcceleratorTable()->GetCommand( event ); + if (command != -1) + { + wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command ); + ret = ancestor->GetEventHandler()->ProcessEvent( command_event ); + break; + } + if (ancestor->IsTopLevel()) + break; + ancestor = ancestor->GetParent(); + } + } +#endif // wxUSE_ACCEL + // Only send wxEVT_CHAR event if not processed yet. Thus, ALT-x // will only be sent if it is not in an accelerator table. if (!ret) @@ -1267,25 +1287,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, -#if wxUSE_ACCEL - if (!ret) - { - wxWindowGTK *ancestor = win; - while (ancestor) - { - int command = ancestor->GetAcceleratorTable()->GetCommand( event ); - if (command != -1) - { - wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command ); - ret = ancestor->GetEventHandler()->ProcessEvent( command_event ); - break; - } - if (ancestor->IsTopLevel()) - break; - ancestor = ancestor->GetParent(); - } - } -#endif // wxUSE_ACCEL // win is a control: tab can be propagated up diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index ddd4ba38f3..4e92f5a423 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1219,6 +1219,26 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, #endif // #ifndef __WXGTK20__ +#if wxUSE_ACCEL + if (!ret) + { + wxWindowGTK *ancestor = win; + while (ancestor) + { + int command = ancestor->GetAcceleratorTable()->GetCommand( event ); + if (command != -1) + { + wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command ); + ret = ancestor->GetEventHandler()->ProcessEvent( command_event ); + break; + } + if (ancestor->IsTopLevel()) + break; + ancestor = ancestor->GetParent(); + } + } +#endif // wxUSE_ACCEL + // Only send wxEVT_CHAR event if not processed yet. Thus, ALT-x // will only be sent if it is not in an accelerator table. if (!ret) @@ -1267,25 +1287,6 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, -#if wxUSE_ACCEL - if (!ret) - { - wxWindowGTK *ancestor = win; - while (ancestor) - { - int command = ancestor->GetAcceleratorTable()->GetCommand( event ); - if (command != -1) - { - wxCommandEvent command_event( wxEVT_COMMAND_MENU_SELECTED, command ); - ret = ancestor->GetEventHandler()->ProcessEvent( command_event ); - break; - } - if (ancestor->IsTopLevel()) - break; - ancestor = ancestor->GetParent(); - } - } -#endif // wxUSE_ACCEL // win is a control: tab can be propagated up -- 2.47.2