1
0
Fork 0

2007-10-12 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-actor.c: Add a :depth property, so we can
	set the initial depth of an actor inside the UI definition
	files.
This commit is contained in:
Emmanuele Bassi 2007-10-12 12:42:54 +00:00
parent d9d10f4704
commit 12b9b3bbfc
2 changed files with 51 additions and 15 deletions

View file

@ -1,3 +1,9 @@
2007-10-12 Emmanuele Bassi <ebassi@openedhand.com>
* 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 <tf@o-hand.com>
* tests/test-actors.c:

View file

@ -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:
*
@ -2339,22 +2361,30 @@ clutter_actor_set_depth (ClutterActor *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");
}
}
/**