[clutter/wip/apocalypses/apocalypse-1: 20/43] actor: Implement Container::sort_depth_order
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/apocalypses/apocalypse-1: 20/43] actor: Implement Container::sort_depth_order
- Date: Wed, 7 Dec 2011 18:15:03 +0000 (UTC)
commit c3671b361b4da62431ee20f67a5ef2145649f14a
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Tue Nov 29 18:02:20 2011 +0000
actor: Implement Container::sort_depth_order
There's no reason this vfunc should be left out.
clutter/clutter-actor.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 12e0345..34edc94 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -10154,6 +10154,32 @@ container_lower (ClutterContainer *container,
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
clutter_container_iface_init (ClutterContainerIface *iface)
{
@@ -10163,6 +10189,7 @@ clutter_container_iface_init (ClutterContainerIface *iface)
iface->raise = container_raise;
iface->lower = container_lower;
+ iface->sort_depth_order = container_sort_by_depth;
}
typedef enum
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]