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:
@@ -1219,6 +1219,26 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
|
|||||||
|
|
||||||
#endif // #ifndef __WXGTK20__
|
#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
|
// Only send wxEVT_CHAR event if not processed yet. Thus, ALT-x
|
||||||
// will only be sent if it is not in an accelerator table.
|
// will only be sent if it is not in an accelerator table.
|
||||||
if (!ret)
|
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
|
// win is a control: tab can be propagated up
|
||||||
|
@@ -1219,6 +1219,26 @@ static gint gtk_window_key_press_callback( GtkWidget *widget,
|
|||||||
|
|
||||||
#endif // #ifndef __WXGTK20__
|
#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
|
// Only send wxEVT_CHAR event if not processed yet. Thus, ALT-x
|
||||||
// will only be sent if it is not in an accelerator table.
|
// will only be sent if it is not in an accelerator table.
|
||||||
if (!ret)
|
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
|
// win is a control: tab can be propagated up
|
||||||
|
Reference in New Issue
Block a user