[clutter] actor: Provide a better default pick() behaviour
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] actor: Provide a better default pick() behaviour
- Date: Tue, 17 Jan 2012 16:22:10 +0000 (UTC)
commit 629ded568e30a845337e41f04b04b5fcc20a82d4
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Tue Jan 17 16:13:55 2012 +0000
actor: Provide a better default pick() behaviour
The default pick() behaviour does not take into consideration the
children of a ClutterActor because the existing containter actors
usually override pick(), chain up, and then paint their children.
With ClutterActor now a concrete class, though, we need a way to pick
its children without requiring a sub-class; we could simply iterate over
the children inside the default pick() implementation, but this would
lead to double painting, which is not acceptable.
A moderately gross hack is to check if the Actor instance did override
the pick() implementation, and if it is not the case, paint the children
in pick mode.
clutter/clutter-actor.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 9ec6ceb..c51d8c0 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -1703,6 +1703,23 @@ clutter_actor_real_pick (ClutterActor *self,
cogl_rectangle (0, 0, width, height);
}
+
+ /* XXX - this thoroughly sucks, but we need to maintain compatibility
+ * with existing container classes that override the pick() virtual
+ * and chain up to the default implementation - otherwise we'll end up
+ * painting our children twice.
+ *
+ * this has to go away for 2.0; hopefully along the pick() itself.
+ */
+ if (CLUTTER_ACTOR_GET_CLASS (self)->pick == clutter_actor_real_pick)
+ {
+ ClutterActor *iter;
+
+ for (iter = self->priv->first_child;
+ iter != NULL;
+ iter = iter->priv->next_sibling)
+ clutter_actor_paint (iter);
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]