[clutter/wip/apocalypses/apocalypse-1: 21/46] 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: 21/46] actor: Implement Container::sort_depth_order
- Date: Thu, 8 Dec 2011 12:10:38 +0000 (UTC)
commit 556f81bf73fe102404c4f111ccc3de9eb4afe316
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 5774e3f..84f77f7 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -10171,6 +10171,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)
{
@@ -10180,6 +10206,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]