summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNelson Benítez León <nbenitezl@gmail.com>2022-08-28 18:57:11 -0400
committerNelson Benítez León <nbenitezl@gmail.com>2022-08-28 19:35:55 -0400
commit84c0307bb4ceecdca483e8f600f73f5f89813add (patch)
tree8bc041d63a25b431a5a9723a4e19ab1e212aeeac
parenta217be14f9d30fb97004deb3f1d93bea1ca2e617 (diff)
downloadgtk+-gtk4_fix_focus_jump.tar.gz
Fix wrong focus jump after closing context menugtk4_fix_focus_jump
instead of staying in the text entry which launched the context menu. Fixed by using the same logic used in GtkEmojiChooser which is to explicitly focus the text entry in the "hide" signal of the GtkPopoverMenu. Fixes #4903
-rw-r--r--gtk/gtktext.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index b95d6d8c51..1b0983a70a 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -2674,6 +2674,7 @@ gtk_text_do_popup (GtkText *self,
model = gtk_text_get_menu_model (self);
priv->popup_menu = gtk_popover_menu_new_from_model (model);
gtk_widget_set_parent (priv->popup_menu, GTK_WIDGET (self));
+ g_signal_connect_swapped (priv->popup_menu, "hide", G_CALLBACK (gtk_text_grab_focus_without_selecting), self);
gtk_popover_set_position (GTK_POPOVER (priv->popup_menu), GTK_POS_BOTTOM);
gtk_popover_set_has_arrow (GTK_POPOVER (priv->popup_menu), FALSE);