[gtk+] widget: Fix set_focus_child handling during focus changes



commit a8d72a9c1e7e9b6469a4b858bc3c0231f37aa0f8
Author: Olivier Brunel <jjk jjacky com>
Date:   Tue Jan 28 20:33:09 2014 +0100

    widget: Fix set_focus_child handling during focus changes
    
    10b5ec20 made sure not to set focus_child to NULL all the way up to the
    top, but only up to the common ancestor. However, it would never set it
    on the common ancestor itself, which would therefore remain with a
    focus_child set when it shouldn't.
    
    A manifestation of the bug: focus column headers of a treeview, press Tab.
    Now pressing Shift+Tab will go to another widget and not the column
    headers, and Tab will (appear to) do nothing, all because the treeview
    still has a focus_child set to column headers after a grab_focus().
    
    Signed-off-by: Olivier Brunel <jjk jjacky com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723402

 gtk/gtkwidget.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 8795189..29157c0 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -7533,10 +7533,12 @@ gtk_widget_real_grab_focus (GtkWidget *focus_widget)
 
              if (widget != common_ancestor)
                {
-                 while (widget->priv->parent && widget->priv->parent != common_ancestor)
+                 while (widget->priv->parent)
                    {
                      widget = widget->priv->parent;
                      gtk_container_set_focus_child (GTK_CONTAINER (widget), NULL);
+                     if (widget == common_ancestor)
+                       break;
                    }
                }
            }


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