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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user