From 2d914d52be79f32ec051602153da23e7951ffc83 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 26 Jun 2020 14:08:35 -0400 Subject: [PATCH] text: Handle key events in the target phase This makes sure that we do actual key input right in the middle between all the capture and bubble event controllers, and are not dependent on the ordering of those controllers. The bug that triggered this change was that the shortcut for activation (Enter) was getting triggered before the key input, causing Ctrl-Shift-u hex to stop working, since it never received the enter to commit the sequence. --- gtk/gtktext.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gtk/gtktext.c b/gtk/gtktext.c index bea689c7d1..2e4484c1f6 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -1884,6 +1884,7 @@ gtk_text_init (GtkText *self) gtk_widget_add_controller (GTK_WIDGET (self), controller); priv->key_controller = gtk_event_controller_key_new (); + gtk_event_controller_set_propagation_phase (priv->key_controller, GTK_PHASE_TARGET); gtk_event_controller_set_name (priv->key_controller, "gtk-text-key-controller"); g_signal_connect (priv->key_controller, "key-pressed", G_CALLBACK (gtk_text_key_controller_key_pressed), self);