[gtk/matthiasc/for-master] text widgets: Don't lose focus after Emoji



commit 9b5dc9c8355e0aa956f4f0d73b706d06b8bb00d8
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Sep 2 10:26:13 2020 -0400

    text widgets: Don't lose focus after Emoji
    
    Make sure to grab focus back when the Emoji chooser
    disappears. This prevents focus going nowhere when
    the Emoji chooser is canceled.
    
    Fixes: #3112

 gtk/gtktext.c     | 1 +
 gtk/gtktextview.c | 1 +
 2 files changed, 2 insertions(+)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index a87f21b798..16968119bc 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -6825,6 +6825,7 @@ gtk_text_insert_emoji (GtkText *self)
 
       gtk_widget_set_parent (chooser, GTK_WIDGET (self));
       g_signal_connect (chooser, "emoji-picked", G_CALLBACK (emoji_picked), self);
+      g_signal_connect_swapped (chooser, "hide", G_CALLBACK (gtk_widget_grab_focus), self);
     }
 
   gtk_popover_popup (GTK_POPOVER (chooser));
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 06caf5e3ee..5b0715befd 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -9637,6 +9637,7 @@ gtk_text_view_insert_emoji (GtkTextView *text_view)
 
       gtk_widget_set_parent (chooser, GTK_WIDGET (text_view));
       g_signal_connect (chooser, "emoji-picked", G_CALLBACK (emoji_picked), text_view);
+      g_signal_connect_swapped (chooser, "hide", G_CALLBACK (gtk_widget_grab_focus), text_view);
     }
 
   buffer = get_buffer (text_view);


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