AcceleratorTableNotes - robmcmullen/peppy GitHub Wiki
In the attempt to convert to using accelerator tables to process keystrokes, I've run into a lot of problems and platform differences. Here are my notes.
The GTK accelerator processing in the C++ is in src/gtk/window.cpp gtk_window_key_press_callback:
if (!ret)
{
wxWindowGTK *ancestor = win;
while (ancestor)
{
int command = ancestor->GetAcceleratorTable()->GetCommand( event );
if (command != -1)
{
wxCommandEvent menu_event( wxEVT_COMMAND_MENU_SELECTED, command
);
ret = ancestor->HandleWindowEvent( menu_event );
if ( !ret )
{
// if the accelerator wasn't handled as menu event, try
// it as button click (for compatibility with other
// platforms):
wxCommandEvent button_event( wxEVT_COMMAND_BUTTON_CLICKED, c
ommand );
ret = ancestor->HandleWindowEvent( button_event );
}
break;
}
if (ancestor->IsTopLevel())
break;
ancestor = ancestor->GetParent();
}
}
so it looks like there can be different accelerator tables down to the very lowest level widget that can accept keyboard focus. I wonder if this is causing problems that I see where when changing menus there seems to be accelerator table entries from the previous menu that get swallowed.
UPDATE: Nope. I put some debugging print statements in the C++ code, and after switching menus using change-accelerator-table.py, the gtk_window_key_press_callback function never gets called.