From 12b9b3bbfc70522c9ed0930d6b5e878ae267d3f8 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 12 Oct 2007 12:42:54 +0000 Subject: [PATCH] 2007-10-12 Emmanuele Bassi * clutter/clutter-actor.c: Add a :depth property, so we can set the initial depth of an actor inside the UI definition files. --- ChangeLog | 6 +++++ clutter/clutter-actor.c | 60 ++++++++++++++++++++++++++++++----------- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index b94cb32bd..138c9670c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-10-12 Emmanuele Bassi + + * clutter/clutter-actor.c: Add a :depth property, so we can + set the initial depth of an actor inside the UI definition + files. + 2007-10-12 Tomas Frydrych * tests/test-actors.c: diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 27313de83..ac50c732f 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -99,6 +99,7 @@ enum PROP_Y, PROP_WIDTH, PROP_HEIGHT, + PROP_DEPTH, PROP_CLIP, PROP_HAS_CLIP, PROP_OPACITY, @@ -899,6 +900,9 @@ clutter_actor_set_property (GObject *object, clutter_actor_get_width (actor), g_value_get_int (value)); break; + case PROP_DEPTH: + clutter_actor_set_depth (actor, g_value_get_int (value)); + break; case PROP_OPACITY: clutter_actor_set_opacity (actor, g_value_get_uchar (value)); break; @@ -964,6 +968,9 @@ clutter_actor_get_property (GObject *object, case PROP_HEIGHT: g_value_set_int (value, clutter_actor_get_height (actor)); break; + case PROP_DEPTH: + g_value_set_int (value, clutter_actor_get_depth (actor)); + break; case PROP_OPACITY: g_value_set_uchar (value, priv->opacity); break; @@ -1087,6 +1094,21 @@ clutter_actor_class_init (ClutterActorClass *klass) 0, G_MAXINT, 0, CLUTTER_PARAM_READWRITE)); + /** + * ClutterActor:depth: + * + * Depth of the actor. + * + * Since: 0.6 + */ + g_object_class_install_property (object_class, + PROP_DEPTH, + g_param_spec_int ("depth", + "Depth", + "Depth of actor", + -G_MAXINT, G_MAXINT, + 0, + CLUTTER_PARAM_READWRITE)); /** * ClutterActor:opacity: * @@ -2338,23 +2360,31 @@ clutter_actor_set_depth (ClutterActor *self, g_return_if_fail (CLUTTER_IS_ACTOR (self)); priv = self->priv; - - /* Sets Z value. - FIXME: should invert ?*/ - priv->z = depth; - - if (priv->parent_actor && CLUTTER_IS_CONTAINER (priv->parent_actor)) + + if (priv->z != depth) { - /* We need to resort the container stacking order as to - * correctly render alpha values. - * - * FIXME: This is sub optimal. maybe queue the the sort - * before stacking - */ - clutter_container_sort_depth_order (CLUTTER_CONTAINER (priv->parent_actor)); - } + /* Sets Z value. - FIXME: should invert ?*/ + priv->z = depth; - if (CLUTTER_ACTOR_IS_VISIBLE (self)) - clutter_actor_queue_redraw (self); + if (priv->parent_actor && CLUTTER_IS_CONTAINER (priv->parent_actor)) + { + ClutterContainer *parent; + + /* We need to resort the container stacking order as to + * correctly render alpha values. + * + * FIXME: This is sub optimal. maybe queue the the sort + * before stacking + */ + parent = CLUTTER_CONTAINER (priv->parent_actor); + clutter_container_sort_depth_order (parent); + } + + if (CLUTTER_ACTOR_IS_VISIBLE (self)) + clutter_actor_queue_redraw (self); + + g_object_notify (G_OBJECT (self), "depth"); + } } /**