[gtk/gtk4_fix_focus_jump] Fix wrong focus jump after closing context menu




commit 84c0307bb4ceecdca483e8f600f73f5f89813add
Author: Nelson Benítez León <nbenitezl gmail com>
Date:   Sun Aug 28 18:57:11 2022 -0400

    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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]