+// ----------------------------------------------------------------------------
+// "key_press_event"
+// ----------------------------------------------------------------------------
+
+extern "C" {
+static gboolean
+wxgtk_tlw_key_press_event(GtkWidget *widget, GdkEventKey *event)
+{
+ GtkWindow* const window = GTK_WINDOW(widget);
+
+ // By default GTK+ checks for the menu accelerators in this (top level)
+ // window first and then propagates the event to the currently focused
+ // child from where it bubbles up the window parent chain. In wxWidgets,
+ // however, we want the child window to have the event first but still
+ // handle it as an accelerator if it's not processed there, so we need to
+ // customize this by reversing the order of the steps done in the standard
+ // GTK+ gtk_window_key_press_event() handler.
+
+ if ( gtk_window_propagate_key_event(window, event) )
+ return TRUE;
+
+ if ( gtk_window_activate_key(window, event) )
+ return TRUE;
+
+ if (GTK_WIDGET_GET_CLASS(widget)->key_press_event(widget, event))
+ return TRUE;
+
+ return FALSE;
+}
+}
+