[gtk/wip/matthiasc/focus2: 12/33] stack: Implement next_focus_child



commit 53be8c9909d18d4e949e23f6c1a4035f51c655d9
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Mar 2 14:34:28 2019 -0500

    stack: Implement next_focus_child
    
    We only return the visible page here, to avoid
    focus moving into other pages.

 gtk/gtkstack.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index d7222f9e5e..04b4b0b422 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -533,6 +533,9 @@ static void     gtk_stack_forall                         (GtkContainer  *contain
 static void     gtk_stack_compute_expand                 (GtkWidget     *widget,
                                                           gboolean      *hexpand,
                                                           gboolean      *vexpand);
+static GtkWidget *gtk_stack_next_focus_child             (GtkWidget     *widget,
+                                                          GtkWidget     *child,
+                                                          GtkDirectionType direction);
 static void     gtk_stack_size_allocate                  (GtkWidget     *widget,
                                                           int            width,
                                                           int            height,
@@ -724,6 +727,7 @@ gtk_stack_class_init (GtkStackClass *klass)
   widget_class->snapshot = gtk_stack_snapshot;
   widget_class->measure = gtk_stack_measure;
   widget_class->compute_expand = gtk_stack_compute_expand;
+  widget_class->next_focus_child = gtk_stack_next_focus_child;
 
   container_class->add = gtk_stack_add;
   container_class->remove = gtk_stack_remove;
@@ -2434,6 +2438,19 @@ gtk_stack_measure (GtkWidget      *widget,
     }
 }
 
+static GtkWidget *
+gtk_stack_next_focus_child (GtkWidget *widget,
+                            GtkWidget *child,
+                            GtkDirectionType direction)
+{
+  GtkStackPrivate *priv = gtk_stack_get_instance_private (GTK_STACK (widget));
+
+  if (child == NULL)
+    return priv->visible_child->widget;
+
+  return NULL;
+}
+
 static void
 gtk_stack_init (GtkStack *stack)
 {


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