From 6892b5c5ba453c9062dae0021e8cafbbcc3970ec Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Sun, 11 Mar 2018 13:44:37 +0100 Subject: [PATCH] gtkwidget: Activate key bindings through run_controllers() Deferring a bit further making those a standalone controller, make binding activation happen on run_controllers(), so it happens by default on widgets (unless the key event was consumed earlier) without the need of a legacy event controller. --- gtk/gtkwidget.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 24a142e1e9..3fa0ee6cdc 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -5138,14 +5138,14 @@ static gboolean gtk_widget_real_key_press_event (GtkWidget *widget, GdkEventKey *event) { - return gtk_bindings_activate_event (G_OBJECT (widget), event); + return FALSE; } static gboolean gtk_widget_real_key_release_event (GtkWidget *widget, GdkEventKey *event) { - return gtk_bindings_activate_event (G_OBJECT (widget), event); + return FALSE; } #define WIDGET_REALIZED_FOR_EVENT(widget, event) \ @@ -5424,6 +5424,11 @@ gtk_widget_event_internal (GtkWidget *widget, return_val |= _gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_BUBBLE); g_object_unref (event_copy); + if (return_val == FALSE && + (event->any.type == GDK_KEY_PRESS || + event->any.type == GDK_KEY_RELEASE)) + return_val |= gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *) event); + return return_val; }