[clutter] actor: Ask the LayoutManager to compute the expansion flags
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] actor: Ask the LayoutManager to compute the expansion flags
- Date: Mon, 16 Jan 2012 23:58:06 +0000 (UTC)
commit 508f09f0a0c326b9a04cf021d134611e75690dd5
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Tue Dec 20 18:40:11 2011 +0000
actor: Ask the LayoutManager to compute the expansion flags
If an actor has a layout manager, we want to involve the delegate object
into the lazy computation of the expansion flags state.
clutter/clutter-actor.c | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 4e03447..acb0a6f 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -14748,6 +14748,8 @@ typedef struct _ExpandClosure
{
gboolean x_expand;
gboolean y_expand;
+ ClutterLayoutManager *layout_manager;
+ ClutterContainer *container;
} ExpandClosure;
static gboolean
@@ -14756,9 +14758,35 @@ foreach_compute_expand (ClutterActor *child,
{
ExpandClosure *data = data_;
+ /* if there is a layout manager, we ask it to influence the result
+ * in case it has layout properties that map to [xy]-expand
+ */
+ if (data->layout_manager != NULL)
+ {
+ ClutterLayoutManagerClass *manager_class;
+ gboolean x_expand, y_expand;
+
+ x_expand = y_expand = FALSE;
+ manager_class = CLUTTER_LAYOUT_MANAGER_GET_CLASS (data->layout_manager);
+ manager_class->compute_expand (data->layout_manager,
+ data->container,
+ child,
+ &x_expand,
+ &y_expand);
+
+ data->x_expand = data->x_expand || x_expand;
+ data->y_expand = data->y_expand || y_expand;
+ }
+
data->x_expand = data->x_expand || clutter_actor_needs_x_expand (child);
data->y_expand = data->y_expand || clutter_actor_needs_y_expand (child);
+ /* we stop recursing as soon as we know that we are set to expand
+ * in both directions
+ */
+ if (data->x_expand && data->y_expand)
+ return FALSE;
+
return TRUE;
}
@@ -14771,6 +14799,8 @@ clutter_actor_compute_expand (ClutterActor *self,
data.x_expand = FALSE;
data.y_expand = FALSE;
+ data.layout_manager = self->priv->layout_manager;
+ data.container = CLUTTER_CONTAINER (self);
_clutter_actor_foreach_child (self,
foreach_compute_expand,
@@ -14820,6 +14850,11 @@ clutter_actor_update_effective_expand (ClutterActor *self)
priv->needs_compute_expand = FALSE;
priv->x_expand_effective = x_expand != FALSE;
priv->y_expand_effective = y_expand != FALSE;
+
+ g_debug ("Actor %s expand effective - x:%s, y:%s",
+ _clutter_actor_get_debug_name (self),
+ priv->x_expand_effective ? "Y" : "N",
+ priv->y_expand_effective ? "Y" : "N");
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]