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)
This commit is contained in:
Matthias Clasen 2005-12-14 19:39:44 +00:00 committed by Matthias Clasen
parent c5cc9b7162
commit d095fa575d
3 changed files with 25 additions and 12 deletions

View File

@ -1,3 +1,8 @@
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)
2005-12-14 Rodney Dawes <dobey@novell.com>
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_volume_render_icon):

View File

@ -1,3 +1,8 @@
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)
2005-12-14 Rodney Dawes <dobey@novell.com>
* gtk/gtkfilesystemunix.c (gtk_file_system_unix_volume_render_icon):

View File

@ -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 ();