From 84c0307bb4ceecdca483e8f600f73f5f89813add Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nelson=20Ben=C3=ADtez=20Le=C3=B3n?= Date: Sun, 28 Aug 2022 18:57:11 -0400 Subject: [PATCH] Fix wrong focus jump after closing context menu 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 --- gtk/gtktext.c | 1 + 1 file changed, 1 insertion(+) 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);