[clutter/wip/apocalypses/apocalypse-1: 5/92] actor: Default to a fixed layout manager
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/apocalypses/apocalypse-1: 5/92] actor: Default to a fixed layout manager
- Date: Tue, 3 Jan 2012 22:20:37 +0000 (UTC)
commit 3c7ecc5f23fd3ce4f715e717f1cf20de45bb0b89
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Thu Dec 8 11:57:19 2011 +0000
actor: Default to a fixed layout manager
In case no layout manager was set during construction, we fall back to a
FixedLayout. The FixedLayout has the property of making the fixed
positioning and sizing API, as well as the various Constraints, work
out of the box.
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 31a91cb..075be91 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -308,6 +308,7 @@
#include "clutter-debug.h"
#include "clutter-effect-private.h"
#include "clutter-enum-types.h"
+#include "clutter-fixed-layout.h"
#include "clutter-main.h"
#include "clutter-marshal.h"
#include "clutter-flatten-effect.h"
@@ -3952,6 +3953,21 @@ clutter_actor_real_has_overlaps (ClutterActor *self)
}
static void
+clutter_actor_constructed (GObject *gobject)
+{
+ ClutterActor *self = CLUTTER_ACTOR (gobject);
+
+ /* if we weren't constructed with a layout manager, we fall back to a
+ * fixed layout; this is the most sensible option, as it will make
+ * things like constraints work out of the box
+ */
+ if (self->priv->layout_manager == NULL)
+ clutter_actor_set_layout_manager (self, clutter_fixed_layout_new ());
+
+ G_OBJECT_CLASS (clutter_actor_parent_class)->constructed (gobject);
+}
+
+static void
clutter_actor_class_init (ClutterActorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -3959,6 +3975,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
quark_shader_data = g_quark_from_static_string ("-clutter-actor-shader-data");
+ object_class->constructed = clutter_actor_constructed;
object_class->set_property = clutter_actor_set_property;
object_class->get_property = clutter_actor_get_property;
object_class->dispose = clutter_actor_dispose;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]