+ // Next check for accelerators.
+#if wxUSE_ACCEL
+ 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, command );
+ ret = ancestor->HandleWindowEvent( button_event );
+ }
+
+ break;
+ }
+ if (ancestor->IsTopLevel())
+ break;
+ ancestor = ancestor->GetParent();
+ }
+#endif // wxUSE_ACCEL
+
+ // If not an accelerator, then emit KEY_DOWN event
+ if ( !ret )
+ ret = win->HandleWindowEvent( event );