[gtk] emojichooser: Fix keynav



commit 3408ff1dd7b0713b0172eedd15ff38147198e84e
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Mar 17 21:48:45 2020 -0400

    emojichooser: Fix keynav
    
    Make arrow and tab keys work in the
    variations popover again.

 gtk/gtkemojichooser.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c
index 121b1b697f..66594db645 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -104,11 +104,27 @@ gtk_emoji_chooser_child_size_allocate (GtkWidget *widget,
     gtk_native_check_resize (GTK_NATIVE (child->variations));
 }
 
+static gboolean
+gtk_emoji_chooser_child_focus (GtkWidget        *widget,
+                               GtkDirectionType  direction)
+{
+  GtkEmojiChooserChild *child = (GtkEmojiChooserChild *)widget;
+
+  if (child->variations && gtk_widget_is_visible (child->variations))
+    {
+      if (gtk_widget_child_focus (child->variations, direction))
+        return TRUE;
+    }
+
+  return GTK_WIDGET_CLASS (gtk_emoji_chooser_child_parent_class)->focus (widget, direction);
+}
+
 static void
 gtk_emoji_chooser_child_class_init (GtkEmojiChooserChildClass *class)
 {
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
   widget_class->size_allocate = gtk_emoji_chooser_child_size_allocate;
+  widget_class->focus = gtk_emoji_chooser_child_focus;
   gtk_widget_class_set_css_name (widget_class, "emoji");
 }
 
@@ -351,6 +367,7 @@ show_variations (GtkEmojiChooser *chooser,
 
   parent_popover = gtk_widget_get_ancestor (child, GTK_TYPE_POPOVER);
   popover = ch->variations = gtk_popover_new ();
+  gtk_popover_set_autohide (GTK_POPOVER (popover), TRUE);
   gtk_widget_set_parent (popover, child);
   view = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
   gtk_widget_add_css_class (view, "view");


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