[clutter/clutter-1.10] actor: Call show() on set parent conditionally



commit 12a3e65ca0c6f6956a96611b209d48355ab3909e
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Apr 26 14:06:00 2012 +0100

    actor: Call show() on set parent conditionally
    
    This commit adds a further conditional check for calling
    clutter_actor_show() when adding a child to an actor. We cannot
    unconditionally change the value of the show-on-set-parent property like
    the original solution of commit 81b19a78f5e02ae8ffd9235054d80b172496415b
    as that breaks the document invariant that show-on-set-parent will be
    changed iff an actor is without a parent.
    
    The new ADD_CHILD_SHOW_ON_SET_PARENT flag is part of the default and
    legacy flags, thus retaining the default behaviour when adding a child;
    the flag is not passed when reordering the list of children, which means
    we ignore the state of the show-on-set-parent property.
    
    The conformance test suite fully passes, including the newly added test
    to verify that changing the paint order does not trigger visibility.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=674510

 clutter/clutter-actor.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index a0932c3..433dc67 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -10896,23 +10896,26 @@ typedef void (* ClutterActorAddChildFunc) (ClutterActor *parent,
                                            gpointer      data);
 
 typedef enum {
-  ADD_CHILD_CREATE_META       = 1 << 0,
-  ADD_CHILD_EMIT_PARENT_SET   = 1 << 1,
-  ADD_CHILD_EMIT_ACTOR_ADDED  = 1 << 2,
-  ADD_CHILD_CHECK_STATE       = 1 << 3,
-  ADD_CHILD_NOTIFY_FIRST_LAST = 1 << 4,
+  ADD_CHILD_CREATE_META        = 1 << 0,
+  ADD_CHILD_EMIT_PARENT_SET    = 1 << 1,
+  ADD_CHILD_EMIT_ACTOR_ADDED   = 1 << 2,
+  ADD_CHILD_CHECK_STATE        = 1 << 3,
+  ADD_CHILD_NOTIFY_FIRST_LAST  = 1 << 4,
+  ADD_CHILD_SHOW_ON_SET_PARENT = 1 << 5,
 
   /* default flags for public API */
   ADD_CHILD_DEFAULT_FLAGS    = ADD_CHILD_CREATE_META |
                                ADD_CHILD_EMIT_PARENT_SET |
                                ADD_CHILD_EMIT_ACTOR_ADDED |
                                ADD_CHILD_CHECK_STATE |
-                               ADD_CHILD_NOTIFY_FIRST_LAST,
+                               ADD_CHILD_NOTIFY_FIRST_LAST |
+                               ADD_CHILD_SHOW_ON_SET_PARENT,
 
   /* flags for legacy/deprecated API */
   ADD_CHILD_LEGACY_FLAGS     = ADD_CHILD_EMIT_PARENT_SET |
                                ADD_CHILD_CHECK_STATE |
-                               ADD_CHILD_NOTIFY_FIRST_LAST
+                               ADD_CHILD_NOTIFY_FIRST_LAST |
+                               ADD_CHILD_SHOW_ON_SET_PARENT
 } ClutterActorAddChildFlags;
 
 /*< private >
@@ -10943,6 +10946,7 @@ clutter_actor_add_child_internal (ClutterActor              *self,
   gboolean emit_parent_set, emit_actor_added;
   gboolean check_state;
   gboolean notify_first_last;
+  gboolean show_on_set_parent;
   ClutterActor *old_first_child, *old_last_child;
 
   if (child->priv->parent != NULL)
@@ -11019,6 +11023,7 @@ clutter_actor_add_child_internal (ClutterActor              *self,
   emit_actor_added = (flags & ADD_CHILD_EMIT_ACTOR_ADDED) != 0;
   check_state = (flags & ADD_CHILD_CHECK_STATE) != 0;
   notify_first_last = (flags & ADD_CHILD_NOTIFY_FIRST_LAST) != 0;
+  show_on_set_parent = (flags & ADD_CHILD_SHOW_ON_SET_PARENT) != 0;
 
   old_first_child = self->priv->first_child;
   old_last_child = self->priv->last_child;
@@ -11064,7 +11069,7 @@ clutter_actor_add_child_internal (ClutterActor              *self,
       clutter_actor_set_text_direction (child, text_dir);
     }
 
-  if (child->priv->show_on_set_parent)
+  if (show_on_set_parent && child->priv->show_on_set_parent)
     clutter_actor_show (child);
 
   if (CLUTTER_ACTOR_IS_MAPPED (child))



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