gtkwindow: Perform key activation in gtk_main_do_event()

In a similar spirit to the previous commit, make window shortcut
activation happen by default on toplevels, without relying on
legacy controllers.
This commit is contained in:
Carlos Garnacho 2018-03-11 13:47:11 +01:00
parent 6892b5c5ba
commit ad5f0a63a3
2 changed files with 4 additions and 21 deletions

View File

@ -1688,6 +1688,10 @@ gtk_main_do_event (GdkEvent *event)
{
GtkWidget *focus_widget;
if (event->any.type == GDK_KEY_PRESS &&
gtk_window_activate_key (GTK_WINDOW (event_widget), (GdkEventKey *) event))
goto cleanup;
focus_widget = gtk_window_get_focus (GTK_WINDOW (event_widget));
if (focus_widget)
event_widget = focus_widget;

View File

@ -431,8 +431,6 @@ static gboolean gtk_window_configure_event (GtkWidget *widget,
GdkEvent *event);
static gboolean gtk_window_event (GtkWidget *widget,
GdkEvent *event);
static gint gtk_window_key_press_event (GtkWidget *widget,
GdkEventKey *event);
static void gtk_window_focus_in (GtkWidget *widget);
static void gtk_window_focus_out (GtkWidget *widget);
static void surface_state_changed (GtkWidget *widget);
@ -804,7 +802,6 @@ gtk_window_class_init (GtkWindowClass *klass)
widget_class->unrealize = gtk_window_unrealize;
widget_class->size_allocate = gtk_window_size_allocate;
widget_class->event = gtk_window_event;
widget_class->key_press_event = gtk_window_key_press_event;
widget_class->focus = gtk_window_focus;
widget_class->move_focus = gtk_window_move_focus;
widget_class->measure = gtk_window_measure;
@ -7413,24 +7410,6 @@ gtk_window_propagate_key_event (GtkWindow *window,
return handled;
}
static gint
gtk_window_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
GtkWindow *window = GTK_WINDOW (widget);
gboolean handled = FALSE;
/* handle mnemonics and accelerators */
if (!handled)
handled = gtk_window_activate_key (window, event);
/* Chain up, invokes binding set */
if (!handled)
handled = GTK_WIDGET_CLASS (gtk_window_parent_class)->key_press_event (widget, event);
return handled;
}
static GtkWindowRegion
get_active_region_type (GtkWindow *window, gint x, gint y)
{