[gnome-shell] Only use visible actors for paging/allocation



commit 0f63ae186986c933fd8f37a2ec99a813e2c61506
Author: Colin Walters <walters verbum org>
Date:   Thu Sep 24 18:33:54 2009 -0400

    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

 src/shell-overflow-list.c |   31 ++++++++++++++++++++++++-------
 1 files changed, 24 insertions(+), 7 deletions(-)
---
diff --git a/src/shell-overflow-list.c b/src/shell-overflow-list.c
index 2e28b00..a5dc8f9 100644
--- a/src/shell-overflow-list.c
+++ b/src/shell-overflow-list.c
@@ -24,6 +24,23 @@ struct _ShellOverflowListPrivate {
   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
 recalc_displayed_count (ShellOverflowList *self)
 {
@@ -32,7 +49,7 @@ recalc_displayed_count (ShellOverflowList *self)
   int displayed_count;
   int page, n_pages;
 
-  children = clutter_container_get_children (CLUTTER_CONTAINER (self));
+  children = get_visible_children (self);
   n_children = g_list_length (children);
   g_list_free (children);
 
@@ -136,7 +153,7 @@ shell_overflow_list_allocate (ClutterActor           *actor,
   curheight = 0;
   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_fits = 0;
@@ -189,7 +206,7 @@ shell_overflow_list_paint (ClutterActor *actor)
   GList *children, *iter;
   int i;
 
-  children = clutter_container_get_children (CLUTTER_CONTAINER (self));
+  children = get_visible_children (self);
 
   if (children == NULL)
     return;
@@ -232,7 +249,7 @@ shell_overflow_list_get_preferred_height (ClutterActor *actor,
   if (natural_height_p)
     {
       int n_children;
-      children = clutter_container_get_children (CLUTTER_CONTAINER (self));
+      children = get_visible_children (self);
       n_children = g_list_length (children);
       if (n_children == 0)
         *natural_height_p = 0;
@@ -254,7 +271,7 @@ shell_overflow_list_get_preferred_width (ClutterActor *actor,
   GList *iter;
   GList *children;
 
-  children = clutter_container_get_children (CLUTTER_CONTAINER (self));
+  children = get_visible_children (self);
 
   for (iter = children; iter; iter = iter->next)
     {
@@ -374,7 +391,7 @@ shell_overflow_list_get_displayed_actor (ShellOverflowList *self,
 {
   GList *children, *iter;
 
-  children = clutter_container_get_children (CLUTTER_CONTAINER (self));
+  children = get_visible_children (self);
 
   if (children == NULL)
     return NULL;
@@ -405,7 +422,7 @@ shell_overflow_list_get_actor_index (ShellOverflowList *self,
   int i;
   int result;
 
-  children = clutter_container_get_children (CLUTTER_CONTAINER (self));
+  children = get_visible_children (self);
 
   if (children == NULL)
     return -1;



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