From a8d72a9c1e7e9b6469a4b858bc3c0231f37aa0f8 Mon Sep 17 00:00:00 2001 From: Olivier Brunel Date: Tue, 28 Jan 2014 20:33:09 +0100 Subject: [PATCH] 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 https://bugzilla.gnome.org/show_bug.cgi?id=723402 --- gtk/gtkwidget.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 8795189fa5..29157c02f3 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; } } }