actor: Implement Container::sort_depth_order

There's no reason this vfunc should be left out.
This commit is contained in:
Emmanuele Bassi 2011-11-29 18:02:20 +00:00 committed by Emmanuele Bassi
parent 86ec629776
commit b773785533

View File

@ -10207,6 +10207,32 @@ container_lower (ClutterContainer *container,
clutter_actor_queue_relayout (self); clutter_actor_queue_relayout (self);
} }
static gint
sort_by_depth (gconstpointer a,
gconstpointer b)
{
const ClutterActor *actor_a = a;
const ClutterActor *actor_b = b;
if (actor_a->priv->z < actor_b->priv->z)
return -1;
if (actor_a->priv->z > actor_b->priv->z)
return 1;
return 0;
}
static void
container_sort_by_depth (ClutterContainer *container)
{
ClutterActorPrivate *priv = CLUTTER_ACTOR (container)->priv;
priv->children = g_list_sort (priv->children, sort_by_depth);
clutter_actor_queue_relayout (CLUTTER_ACTOR (container));
}
static void static void
clutter_container_iface_init (ClutterContainerIface *iface) clutter_container_iface_init (ClutterContainerIface *iface)
{ {
@ -10216,6 +10242,7 @@ clutter_container_iface_init (ClutterContainerIface *iface)
iface->raise = container_raise; iface->raise = container_raise;
iface->lower = container_lower; iface->lower = container_lower;
iface->sort_depth_order = container_sort_by_depth;
} }
typedef enum typedef enum