Only use visible actors for paging/allocation

It's expected that containers skip not-visible actors when
allocating, etc.

https://bugzilla.gnome.org/show_bug.cgi?id=596119
This commit is contained in:
Colin Walters 2009-09-24 18:33:54 -04:00
parent 32ef951fe0
commit 0f63ae1869

View File

@ -24,6 +24,23 @@ struct _ShellOverflowListPrivate {
guint displayed_count; guint displayed_count;
}; };
static GList *
get_visible_children (ShellOverflowList *self)
{
GList *children, *iter, *next;
children = clutter_container_get_children (CLUTTER_CONTAINER (self));
for (iter = children; iter; iter = next)
{
ClutterActor *actor = iter->data;
next = iter->next;
if (!CLUTTER_ACTOR_IS_VISIBLE (actor))
children = g_list_delete_link (children, iter);
}
return children;
}
static void static void
recalc_displayed_count (ShellOverflowList *self) recalc_displayed_count (ShellOverflowList *self)
{ {
@ -32,7 +49,7 @@ recalc_displayed_count (ShellOverflowList *self)
int displayed_count; int displayed_count;
int page, n_pages; int page, n_pages;
children = clutter_container_get_children (CLUTTER_CONTAINER (self)); children = get_visible_children (self);
n_children = g_list_length (children); n_children = g_list_length (children);
g_list_free (children); g_list_free (children);
@ -136,7 +153,7 @@ shell_overflow_list_allocate (ClutterActor *actor,
curheight = 0; curheight = 0;
avail_height = box->y2 - box->y1; avail_height = box->y2 - box->y1;
children = clutter_container_get_children (CLUTTER_CONTAINER (self)); children = get_visible_children (self);
n_children = g_list_length (children); n_children = g_list_length (children);
n_fits = 0; n_fits = 0;
@ -189,7 +206,7 @@ shell_overflow_list_paint (ClutterActor *actor)
GList *children, *iter; GList *children, *iter;
int i; int i;
children = clutter_container_get_children (CLUTTER_CONTAINER (self)); children = get_visible_children (self);
if (children == NULL) if (children == NULL)
return; return;
@ -232,7 +249,7 @@ shell_overflow_list_get_preferred_height (ClutterActor *actor,
if (natural_height_p) if (natural_height_p)
{ {
int n_children; int n_children;
children = clutter_container_get_children (CLUTTER_CONTAINER (self)); children = get_visible_children (self);
n_children = g_list_length (children); n_children = g_list_length (children);
if (n_children == 0) if (n_children == 0)
*natural_height_p = 0; *natural_height_p = 0;
@ -254,7 +271,7 @@ shell_overflow_list_get_preferred_width (ClutterActor *actor,
GList *iter; GList *iter;
GList *children; GList *children;
children = clutter_container_get_children (CLUTTER_CONTAINER (self)); children = get_visible_children (self);
for (iter = children; iter; iter = iter->next) for (iter = children; iter; iter = iter->next)
{ {
@ -374,7 +391,7 @@ shell_overflow_list_get_displayed_actor (ShellOverflowList *self,
{ {
GList *children, *iter; GList *children, *iter;
children = clutter_container_get_children (CLUTTER_CONTAINER (self)); children = get_visible_children (self);
if (children == NULL) if (children == NULL)
return NULL; return NULL;
@ -405,7 +422,7 @@ shell_overflow_list_get_actor_index (ShellOverflowList *self,
int i; int i;
int result; int result;
children = clutter_container_get_children (CLUTTER_CONTAINER (self)); children = get_visible_children (self);
if (children == NULL) if (children == NULL)
return -1; return -1;