2007-11-14 Emmanuele Bassi <ebassi@openedhand.com>
authorEmmanuele Bassi <ebassi@openedhand.com>
Wed, 14 Nov 2007 13:36:31 +0000 (13:36 +0000)
committerEmmanuele Bassi <ebassi@openedhand.com>
Wed, 14 Nov 2007 13:36:31 +0000 (13:36 +0000)
* clutter/clutter-clone-texture.c (set_parent_texture): Hide the
clone texture only if it was visible, and show it again if we
are adding a visible texture.

* tests/test-script.json: Test the CloneTexture actor.

ChangeLog
clutter/clutter-clone-texture.c
tests/test-script.json

index 689625c..3a6c11c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2007-11-14  Emmanuele Bassi  <ebassi@openedhand.com>
 
+       * clutter/clutter-clone-texture.c (set_parent_texture): Hide the
+       clone texture only if it was visible, and show it again if we
+       are adding a visible texture.
+
+       * tests/test-script.json: Test the CloneTexture actor.
+
+2007-11-14  Emmanuele Bassi  <ebassi@openedhand.com>
+
        * clutter/clutter-actor.[ch]: Rename clutter_actor_get_id() to
        clutter_actor_get_gid().
 
index 423b275..9a18661 100644 (file)
@@ -236,14 +236,16 @@ set_parent_texture (ClutterCloneTexture *ctexture,
 {
   ClutterCloneTexturePrivate *priv = ctexture->priv;
   ClutterActor *actor = CLUTTER_ACTOR (ctexture);
+  gboolean was_visible = CLUTTER_ACTOR_IS_VISIBLE (ctexture);
 
   if (priv->parent_texture)
     {
       g_object_unref (priv->parent_texture);
       priv->parent_texture = NULL;
-    }
 
-  clutter_actor_hide (actor);
+      if (was_visible)
+        clutter_actor_hide (actor);
+    }
 
   if (texture) 
     {
@@ -256,9 +258,12 @@ set_parent_texture (ClutterCloneTexture *ctexture,
       clutter_actor_set_size (actor, width, height);
 
       /* queue a redraw if the cloned texture is already visible */
-      if (CLUTTER_ACTOR_IS_VISIBLE (CLUTTER_ACTOR (priv->parent_texture)) &&
-          CLUTTER_ACTOR_IS_VISIBLE (actor))
-        clutter_actor_queue_redraw (actor);
+      if (CLUTTER_ACTOR_IS_VISIBLE (priv->parent_texture) &&
+          was_visible)
+        {
+          clutter_actor_show (actor);
+          clutter_actor_queue_redraw (actor);
+        }
     }
       
 }
index 868b9e9..c58800e 100644 (file)
         "id" : "red-button",
         "type" : "ClutterRectangle",
         "color" : "#ff0000ff",
-        "x" : 50,
-        "y" : 50,
-        "width" : 100,
-        "height" : 100,
+        "x" : 50, "y" : 50, "width" : 100, "height" : 100,
         "visible" : true,
         "reactive" : true,
-        "behaviours" : [ "fade-behaviour", "path-behaviour" ]
+        "behaviours" : [ "fade-behaviour", "path-behaviour" ],
       },
       {
         "id" : "green-button",
         "type" : "ClutterTexture",
         "pixbuf" : "redhand.png",
         "x" : 50,
-        "y" : 50,
+        "y" : 150,
         "opacity" : 100,
         "visible" : true,
         "behaviours" : [ "rotate-behaviour", "fade-behaviour" ]
       },
       {
+        "id" : "red-hand-clone",
+        "type" : "ClutterCloneTexture",
+        "parent-texture" : "red-hand",
+        "x" : 250,
+        "y" : 150,
+        "opacity" : 100,
+        "visible" : true
+      },
+      {
         "id" : "label",
         "type" : "ClutterLabel",
         "x" : 50,