Check accelerators before sending EVT_CHAR

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31862 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2005-02-08 17:02:57 +00:00
parent 4d3ab2a036
commit 50b58dec17
2 changed files with 40 additions and 38 deletions

View File

@@ -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

View File

@@ -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