summaryrefslogtreecommitdiff
path: root/gtk/gtkcontainer.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-12-14 19:39:44 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-12-14 19:39:44 +0000
commitd095fa575df5ea2a343bc1d545367b97907b8ed6 (patch)
tree8e2600b705e9a142cfc0da0caba55fc0e8f27c37 /gtk/gtkcontainer.c
parentc5cc9b7162a049505c46e87738dc823fad002b3c (diff)
downloadgtk+-d095fa575df5ea2a343bc1d545367b97907b8ed6.tar.gz
Skip unrealized children when doing focus sorting. (#323995, Dan Winship)
2005-12-14 Matthias Clasen <mclasen@redhat.com> * gtk/gtkcontainer.c (_gtk_container_focus_sort): Skip unrealized children when doing focus sorting. (#323995, Dan Winship)
Diffstat (limited to 'gtk/gtkcontainer.c')
-rw-r--r--gtk/gtkcontainer.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 7f7bff9d33..e246b498fe 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -1706,10 +1706,8 @@ up_down_compare (gconstpointer a,
CompareInfo *compare = data;
gint y1, y2;
- if (!get_allocation_coords (compare->container, (GtkWidget *)a, &allocation1))
- return 0;
- if (!get_allocation_coords (compare->container, (GtkWidget *)b, &allocation2))
- return 0;
+ get_allocation_coords (compare->container, (GtkWidget *)a, &allocation1);
+ get_allocation_coords (compare->container, (GtkWidget *)b, &allocation2);
y1 = allocation1.y + allocation1.height / 2;
y2 = allocation2.y + allocation2.height / 2;
@@ -1835,10 +1833,8 @@ left_right_compare (gconstpointer a,
CompareInfo *compare = data;
gint x1, x2;
- if (!get_allocation_coords (compare->container, (GtkWidget *)a, &allocation1))
- return 0;
- if (!get_allocation_coords (compare->container, (GtkWidget *)b, &allocation2))
- return 0;
+ get_allocation_coords (compare->container, (GtkWidget *)a, &allocation1);
+ get_allocation_coords (compare->container, (GtkWidget *)b, &allocation2);
x1 = allocation1.x + allocation1.width / 2;
x2 = allocation2.x + allocation2.width / 2;
@@ -1979,19 +1975,26 @@ _gtk_container_focus_sort (GtkContainer *container,
GtkDirectionType direction,
GtkWidget *old_focus)
{
- children = g_list_copy (children);
+ GList *visible_children = NULL;
+
+ while (children)
+ {
+ if (GTK_WIDGET_REALIZED (children->data))
+ visible_children = g_list_prepend (visible_children, children->data);
+ children = children->next;
+ }
switch (direction)
{
case GTK_DIR_TAB_FORWARD:
case GTK_DIR_TAB_BACKWARD:
- return gtk_container_focus_sort_tab (container, children, direction, old_focus);
+ return gtk_container_focus_sort_tab (container, visible_children, direction, old_focus);
case GTK_DIR_UP:
case GTK_DIR_DOWN:
- return gtk_container_focus_sort_up_down (container, children, direction, old_focus);
+ return gtk_container_focus_sort_up_down (container, visible_children, direction, old_focus);
case GTK_DIR_LEFT:
case GTK_DIR_RIGHT:
- return gtk_container_focus_sort_left_right (container, children, direction, old_focus);
+ return gtk_container_focus_sort_left_right (container, visible_children, direction, old_focus);
}
g_assert_not_reached ();