[gtk/wip/matthiasc/focus2] Force focus chain to be cyclic



commit 00d8238076e3fa689693e4f5abfa90619761bdf9
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Mar 4 22:44:50 2019 -0500

    Force focus chain to be cyclic
    
    Move the enforcement of focus chain wraparound to
    gtk_widget_get_next_focus. This lets next_focus_child
    implementation be simpler.

 gtk/gtkwidgetfocus.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwidgetfocus.c b/gtk/gtkwidgetfocus.c
index a380295798..e6f4e3060f 100644
--- a/gtk/gtkwidgetfocus.c
+++ b/gtk/gtkwidgetfocus.c
@@ -495,8 +495,15 @@ gtk_widget_get_next_focus (GtkWidget        *widget,
     next = GTK_WIDGET_GET_CLASS (widget)->next_focus_child (widget, prev, dir);
     if (next == NULL)
       {
-        prev = widget;
-        widget = gtk_widget_get_parent (widget);
+        if (GTK_IS_ROOT (widget))
+          {
+            prev = NULL;
+          }
+        else
+          {
+            prev = widget;
+            widget = gtk_widget_get_parent (widget);
+          }
       }
     else if (gtk_widget_can_take_focus (next))
       {


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