[clutter/wip/apocalypses/apocalypse-1: 82/92] actor: Remove automagic "expand" flag
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/apocalypses/apocalypse-1: 82/92] actor: Remove automagic "expand" flag
- Date: Tue, 3 Jan 2012 22:27:04 +0000 (UTC)
commit 51e85061c9d2cfcecd38a5f6fe25c5b4c773d117
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Wed Dec 21 17:07:25 2011 +0000
actor: Remove automagic "expand" flag
I don't feel comfortable with this feature, and its implementation
still has too many rough edges. We can safely punt it for now, and
introduce it at a later point, as it doesn't block existing features
or API.
clutter/clutter-actor.c | 471 +-------------------------------------
clutter/clutter-actor.h | 10 -
clutter/clutter-box-layout.c | 57 +-----
clutter/clutter-layout-manager.c | 16 --
clutter/clutter-layout-manager.h | 10 +-
clutter/clutter-table-layout.c | 42 +---
6 files changed, 14 insertions(+), 592 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 264a88f..9be5a55 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -479,12 +479,6 @@ struct _ClutterActorPrivate
the redraw was queued from or it will be NULL if the redraw was
queued without an effect. */
guint is_dirty : 1;
- /* expand flag management */
- guint x_expand_set : 1;
- guint x_expand_effective : 1;
- guint y_expand_set : 1;
- guint y_expand_effective : 1;
- guint needs_compute_expand : 1;
guint bg_color_set : 1;
};
@@ -576,8 +570,6 @@ enum
PROP_LAYOUT_MANAGER,
- PROP_X_EXPAND,
- PROP_Y_EXPAND,
PROP_X_ALIGN,
PROP_Y_ALIGN,
PROP_MARGIN_TOP,
@@ -1306,7 +1298,7 @@ clutter_actor_show (ClutterActor *self)
g_signal_emit (self, actor_signals[SHOW], 0);
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_VISIBLE]);
- if (priv->parent)
+ if (priv->parent != NULL)
clutter_actor_queue_redraw (priv->parent);
g_object_thaw_notify (G_OBJECT (self));
@@ -1399,7 +1391,7 @@ clutter_actor_hide (ClutterActor *self)
g_signal_emit (self, actor_signals[HIDE], 0);
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_VISIBLE]);
- if (priv->parent)
+ if (priv->parent != NULL)
clutter_actor_queue_redraw (priv->parent);
g_object_thaw_notify (G_OBJECT (self));
@@ -3766,14 +3758,6 @@ clutter_actor_set_property (GObject *object,
clutter_actor_set_layout_manager (actor, g_value_get_object (value));
break;
- case PROP_X_EXPAND:
- clutter_actor_set_x_expand (actor, g_value_get_boolean (value));
- break;
-
- case PROP_Y_EXPAND:
- clutter_actor_set_y_expand (actor, g_value_get_boolean (value));
- break;
-
case PROP_X_ALIGN:
clutter_actor_set_x_align (actor, g_value_get_enum (value));
break;
@@ -4130,24 +4114,6 @@ clutter_actor_get_property (GObject *object,
g_value_set_object (value, priv->layout_manager);
break;
- case PROP_X_EXPAND:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_boolean (value, info->x_expand);
- }
- break;
-
- case PROP_Y_EXPAND:
- {
- const ClutterLayoutInfo *info;
-
- info = _clutter_actor_get_layout_info_or_defaults (actor);
- g_value_set_boolean (value, info->y_expand);
- }
- break;
-
case PROP_X_ALIGN:
{
const ClutterLayoutInfo *info;
@@ -5288,42 +5254,11 @@ clutter_actor_class_init (ClutterActorClass *klass)
/**
- * ClutterActor:x-expand:
- *
- * Whether the actor should use extra space on the X axis when allocating.
- *
- * Since: 1.10
- */
- obj_props[PROP_X_EXPAND] =
- g_param_spec_boolean ("x-expand",
- P_("X Expand"),
- P_("Whether the actor should expand on the X axis"),
- FALSE,
- CLUTTER_PARAM_READWRITE);
-
- /**
- * ClutterActor:y-expand:
- *
- * Whether the actor should use extra space on the Y axis when allocating.
- *
- * Since: 1.10
- */
- obj_props[PROP_Y_EXPAND] =
- g_param_spec_boolean ("y-expand",
- P_("Y Expand"),
- P_("Whether the actor should expand on the Y axis"),
- FALSE,
- CLUTTER_PARAM_READWRITE);
-
- /**
* ClutterActor:x-align:
*
* The alignment of an actor on the X axis, if the actor has been given
* extra space for its allocation.
*
- * This property only applies if the #ClutterActor:x-expand property
- * has been set to %TRUE.
- *
* Since: 1.10
*/
obj_props[PROP_X_ALIGN] =
@@ -5340,9 +5275,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
* The alignment of an actor on the Y axis, if the actor has been given
* extra space for its allocation.
*
- * This property only applies if the #ClutterActor:y-expand property
- * has been set to %TRUE.
- *
* Since: 1.10
*/
obj_props[PROP_Y_ALIGN] =
@@ -7365,7 +7297,7 @@ clutter_actor_allocate (ClutterActor *self,
}
}
- /* adjust the allocation depending on the align/expand/margin properties */
+ /* adjust the allocation depending on the align/margin properties */
clutter_actor_adjust_allocation (self, &real_allocation);
if (real_allocation.x2 < real_allocation.x1 ||
@@ -9666,22 +9598,6 @@ clutter_actor_add_child_internal (ClutterActor *self,
clutter_actor_queue_relayout (child->priv->parent);
}
- /* child expand flags may cause the parent's expand flags
- * to change; if a child is not set to expand then it cannot
- * modify its parent's expand flags.
- *
- * this check, plus defaulting to needs_compute_expand to FALSE,
- * should avoid having to walk the hierarchy at UI construction
- * time.
- */
- if (CLUTTER_ACTOR_IS_MAPPED (child) &&
- (child->priv->needs_compute_expand ||
- child->priv->x_expand_effective ||
- child->priv->y_expand_effective))
- {
- clutter_actor_queue_compute_expand (self);
- }
-
if (emit_signal)
g_signal_emit_by_name (self, "actor-added", child);
}
@@ -10011,17 +9927,6 @@ clutter_actor_remove_child_internal (ClutterActor *self,
if (was_mapped)
clutter_actor_queue_relayout (self);
- /* the parent may no longer need to expand if the child was the only
- * thing responsible for expand_effective being TRUE
- */
- if (CLUTTER_ACTOR_IS_MAPPED (child) &&
- (child->priv->needs_compute_expand ||
- child->priv->x_expand_effective ||
- child->priv->y_expand_effective))
- {
- clutter_actor_queue_compute_expand (self);
- }
-
/* we need to emit the signal before dropping the reference */
if (emit_signal)
g_signal_emit_by_name (self, "actor-removed", child);
@@ -14675,8 +14580,6 @@ static const ClutterLayoutInfo default_layout_info = {
0.f, /* fixed-x */
0.f, /* fixed-y */
{ 0, 0, 0, 0 }, /* margin */
- FALSE, /* x-expand */
- FALSE, /* y-expand */
CLUTTER_ACTOR_ALIGN_FILL, /* x-align */
CLUTTER_ACTOR_ALIGN_FILL, /* y-align */
0.f, 0.f, /* min_width, natural_width */
@@ -14751,368 +14654,6 @@ _clutter_actor_get_layout_info_or_defaults (ClutterActor *self)
return info;
}
-typedef struct _ExpandClosure
-{
- gboolean x_expand;
- gboolean y_expand;
- ClutterLayoutManager *layout_manager;
- ClutterContainer *container;
-} ExpandClosure;
-
-static gboolean
-foreach_compute_expand (ClutterActor *child,
- gpointer data_)
-{
- 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;
-}
-
-static void
-clutter_actor_compute_expand (ClutterActor *self,
- gboolean *x_expand,
- gboolean *y_expand)
-{
- ExpandClosure data;
-
- 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,
- &data);
-
- if (x_expand != NULL)
- *x_expand = data.x_expand;
-
- if (y_expand != NULL)
- *y_expand = data.y_expand;
-}
-
-static inline void
-clutter_actor_update_effective_expand (ClutterActor *self)
-{
- ClutterActorPrivate *priv = self->priv;
- const ClutterLayoutInfo *info;
- gboolean x_expand, y_expand;
-
- if (!priv->needs_compute_expand)
- return;
-
- info = _clutter_actor_get_layout_info_or_defaults (self);
-
- if (priv->x_expand_set)
- x_expand = info->x_expand;
- else
- x_expand = FALSE;
-
- if (priv->y_expand_set)
- y_expand = info->y_expand;
- else
- y_expand = FALSE;
-
- /* we don't need to traverse the children of the actor if expand
- * has been explicitly set
- */
- if (priv->n_children != 0 || !(priv->x_expand_set && priv->y_expand_set))
- {
- gboolean dummy = FALSE;
-
- clutter_actor_compute_expand (self,
- priv->x_expand_set ? &dummy : &x_expand,
- priv->y_expand_set ? &dummy : &y_expand);
- }
-
- 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");
-}
-
-/**
- * clutter_actor_needs_x_expand:
- * @self: a #ClutterActor
- *
- * Whether an actor should receive extra horizontal space when possible
- * during the allocation.
- *
- * This function takes into consideration eventual actors contained by
- * @self, under the invariant that if an actor has the #ClutterActor:x-expand
- * property set then its parent will need to expand as well.
- *
- * Unlike clutter_actor_get_x_expand(), this function may return %TRUE even
- * if clutter_actor_set_x_expand() hasn't been called on @self.
- *
- * Layout managers should call this function on their children, instead of
- * using clutter_actor_get_x_expand().
- *
- * Return value: %TRUE if the actor should expand, and %FALSE otherwise
- *
- * Since: 1.10
- */
-gboolean
-clutter_actor_needs_x_expand (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- if (!CLUTTER_ACTOR_IS_VISIBLE (self))
- return FALSE;
-
- if (!CLUTTER_ACTOR_IS_MAPPED (self))
- return FALSE;
-
- clutter_actor_update_effective_expand (self);
-
- return self->priv->x_expand_effective;
-}
-
-/**
- * clutter_actor_needs_y_expand:
- * @self: a #ClutterActor
- *
- * Whether an actor should receive extra vertical space when possible
- * during the allocation.
- *
- * This function takes into consideration eventual actors contained by
- * @self, under the invariant that if an actor has the #ClutterActor:y-expand
- * property set then its parent will need to expand as well.
- *
- * Unlike clutter_actor_get_y_expand(), this function may return %TRUE even
- * if clutter_actor_set_y_expand() hasn't been called on @self.
- *
- * Layout managers should call this function on their children, instead of
- * using clutter_actor_get_y_expand().
- *
- * Return value: %TRUE if the actor should expand, and %FALSE otherwise
- *
- * Since: 1.10
- */
-gboolean
-clutter_actor_needs_y_expand (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- if (!CLUTTER_ACTOR_IS_VISIBLE (self))
- return FALSE;
-
- if (!CLUTTER_ACTOR_IS_MAPPED (self))
- return FALSE;
-
- clutter_actor_update_effective_expand (self);
-
- return self->priv->y_expand_effective;
-}
-
-/**
- * clutter_actor_queue_compute_expand:
- * @self: a #ClutterActor
- *
- * Asks a #ClutterActor to (lazily) compute its expand flags.
- *
- * This function should be called by layout managers when setting legacy
- * expand layout properties.
- *
- * Since: 1.10
- */
-void
-clutter_actor_queue_compute_expand (ClutterActor *self)
-{
- ClutterActor *parent_actor;
- gboolean changed_anything;
-
- if (self->priv->needs_compute_expand)
- return;
-
- changed_anything = FALSE;
- parent_actor = self;
- while (parent_actor != NULL)
- {
- if (!parent_actor->priv->needs_compute_expand)
- {
- parent_actor->priv->needs_compute_expand = TRUE;
- changed_anything = TRUE;
- }
-
- parent_actor = parent_actor->priv->parent;
- }
-
- if (changed_anything)
- clutter_actor_queue_relayout (self);
-}
-
-/**
- * clutter_actor_set_x_expand:
- * @self: a #ClutterActor
- * @x_expand: whether the actor should expand
- *
- * Sets whether a #ClutterActor should receive extra space when possible,
- * during the allocation.
- *
- * Whenever a #ClutterActor is resized, all the actors that it contains that
- * have the #ClutterActor:x-expand property set to %TRUE will receive extra
- * horizontal space.
- *
- * By default, actors will expand if any of their children want to expand. A
- * layout manager can check whether a #ClutterActor should expand by using
- * clutter_actor_needs_x_expand().
- *
- * By setting the #ClutterActor:x-expand property explicitly, the default
- * automatic behavior is overridden, regardless of whether an actor has
- * children or not.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_x_expand (ClutterActor *self,
- gboolean x_expand)
-{
- ClutterActorPrivate *priv;
- ClutterLayoutInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- x_expand = !!x_expand;
-
- priv = self->priv;
- info = _clutter_actor_get_layout_info (self);
-
- if (priv->x_expand_set &&
- info->x_expand == x_expand)
- return;
-
- priv->x_expand_set = TRUE;
- info->x_expand = x_expand;
-
- clutter_actor_queue_compute_expand (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_X_EXPAND]);
-}
-
-/**
- * clutter_actor_get_x_expand:
- * @self: a #ClutterActor
- *
- * Retrieves the value set using clutter_actor_set_x_expand().
- *
- * Layout managers should use clutter_actor_needs_x_expand() instead, as that
- * function will check whether any of the actor's children need to expand.
- *
- * Return value: %TRUE if the #ClutterActor was explicitly set to expand.
- *
- * Since: 1.10
- */
-gboolean
-clutter_actor_get_x_expand (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return _clutter_actor_get_layout_info_or_defaults (self)->x_expand;
-}
-
-/**
- * clutter_actor_set_y_expand:
- * @self: a #ClutterActor
- * @y_expand: whether the actor should expand
- *
- * Sets whether a #ClutterActor should receive extra space when possible,
- * during the allocation.
- *
- * Whenever a #ClutterActor is resized, all the actors that it contains that
- * have the #ClutterActor:y-expand property set to %TRUE will receive extra
- * horizontal space.
- *
- * By default, actors will expand if any of their children want to expand. A
- * layout manager can check whether a #ClutterActor should expand by using
- * clutter_actor_needs_y_expand().
- *
- * By setting the #ClutterActor:y-expand property explicitly, the default
- * automatic behavior is overridden, regardless of whether an actor has
- * children or not.
- *
- * Since: 1.10
- */
-void
-clutter_actor_set_y_expand (ClutterActor *self,
- gboolean y_expand)
-{
- ClutterActorPrivate *priv;
- ClutterLayoutInfo *info;
-
- g_return_if_fail (CLUTTER_IS_ACTOR (self));
-
- y_expand = !!y_expand;
-
- priv = self->priv;
- info = _clutter_actor_get_layout_info (self);
-
- if (priv->y_expand_set &&
- info->y_expand == y_expand)
- return;
-
- priv->y_expand_set = TRUE;
- info->y_expand = y_expand;
-
- clutter_actor_queue_compute_expand (self);
-
- g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_Y_EXPAND]);
-}
-
-/**
- * clutter_actor_get_y_expand:
- * @self: a #ClutterActor
- *
- * Retrieves the value set using clutter_actor_set_y_expand().
- *
- * Layout managers should use clutter_actor_needs_y_expand() instead, as that
- * function will check whether any of the actor's children need to expand.
- *
- * Return value: %TRUE if the #ClutterActor was explicitly set to expand.
- *
- * Since: 1.10
- */
-gboolean
-clutter_actor_get_y_expand (ClutterActor *self)
-{
- g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
-
- return _clutter_actor_get_layout_info_or_defaults (self)->y_expand;
-}
-
/**
* clutter_actor_set_x_align:
* @self: a #ClutterActor
@@ -15121,8 +14662,7 @@ clutter_actor_get_y_expand (ClutterActor *self)
* Sets the horizontal alignment policy of a #ClutterActor, in case the
* actor received extra horizontal space.
*
- * See also the #ClutterActor:x-align property, as well as the
- * #ClutterActor:x-expand property.
+ * See also the #ClutterActor:x-align property.
*
* Since: 1.10
*/
@@ -15173,8 +14713,7 @@ clutter_actor_get_x_align (ClutterActor *self)
* Sets the vertical alignment policy of a #ClutterActor, in case the
* actor received extra vertical space.
*
- * See also the #ClutterActor:y-align property, as well as the
- * #ClutterActor:y-expand property.
+ * See also the #ClutterActor:y-align property.
*
* Since: 1.10
*/
diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h
index 7ca0a9b..fee443c 100644
--- a/clutter/clutter-actor.h
+++ b/clutter/clutter-actor.h
@@ -377,16 +377,6 @@ void clutter_actor_set_layout_manager (ClutterActor
ClutterLayoutManager *manager);
ClutterLayoutManager *clutter_actor_get_layout_manager (ClutterActor *self);
-void clutter_actor_set_x_expand (ClutterActor *self,
- gboolean x_expand);
-gboolean clutter_actor_get_x_expand (ClutterActor *self);
-void clutter_actor_set_y_expand (ClutterActor *self,
- gboolean y_expand);
-gboolean clutter_actor_get_y_expand (ClutterActor *self);
-gboolean clutter_actor_needs_x_expand (ClutterActor *self);
-gboolean clutter_actor_needs_y_expand (ClutterActor *self);
-void clutter_actor_queue_compute_expand (ClutterActor *self);
-
void clutter_actor_set_x_align (ClutterActor *self,
ClutterActorAlign x_align);
ClutterActorAlign clutter_actor_get_x_align (ClutterActor *self);
diff --git a/clutter/clutter-box-layout.c b/clutter/clutter-box-layout.c
index 595a76a..c7055ba 100644
--- a/clutter/clutter-box-layout.c
+++ b/clutter/clutter-box-layout.c
@@ -276,11 +276,6 @@ box_child_set_expand (ClutterBoxChild *self,
else
clutter_layout_manager_layout_changed (layout);
- /* we need to let the scene graph that the expand flags may have
- * been changed
- */
- clutter_actor_queue_compute_expand (CLUTTER_CHILD_META (self)->actor);
-
g_object_notify (G_OBJECT (self), "expand");
}
}
@@ -747,10 +742,8 @@ count_expand_children (ClutterLayoutManager *layout,
gint *visible_children,
gint *expand_children)
{
- ClutterBoxLayoutPrivate *priv;
ClutterActor *actor, *child;
- priv = CLUTTER_BOX_LAYOUT (layout)->priv;
actor = CLUTTER_ACTOR (container);
*visible_children = *expand_children = 0;
@@ -762,7 +755,6 @@ count_expand_children (ClutterLayoutManager *layout,
if (CLUTTER_ACTOR_IS_VISIBLE (child))
{
ClutterLayoutMeta *meta;
- gboolean needs_expand;
*visible_children += 1;
@@ -770,12 +762,7 @@ count_expand_children (ClutterLayoutManager *layout,
container,
child);
- if (priv->is_vertical)
- needs_expand = clutter_actor_needs_y_expand (child);
- else
- needs_expand = clutter_actor_needs_x_expand (child);
-
- if (CLUTTER_BOX_CHILD (meta)->expand || needs_expand)
+ if (CLUTTER_BOX_CHILD (meta)->expand)
*expand_children += 1;
}
}
@@ -1070,16 +1057,9 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
}
else
{
- gboolean needs_expand;
-
child_size = sizes[i].minimum_size;
- if (priv->is_vertical)
- needs_expand = clutter_actor_needs_y_expand (child);
- else
- needs_expand = clutter_actor_needs_x_expand (child);
-
- if (box_child->expand || needs_expand)
+ if (box_child->expand)
{
child_size += extra;
@@ -1190,38 +1170,6 @@ clutter_box_layout_end_animation (ClutterLayoutManager *manager)
}
static void
-clutter_box_layout_compute_expand (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor,
- gboolean *x_expand_p,
- gboolean *y_expand_p)
-{
- ClutterBoxLayoutPrivate *priv;
- ClutterLayoutMeta *meta;
- gboolean x_expand, y_expand;
-
- priv = CLUTTER_BOX_LAYOUT (manager)->priv;
- meta = clutter_layout_manager_get_child_meta (manager, container, actor);
-
- if (priv->is_vertical)
- {
- x_expand = FALSE;
- y_expand = CLUTTER_BOX_CHILD (meta)->expand;
- }
- else
- {
- x_expand = CLUTTER_BOX_CHILD (meta)->expand;
- y_expand = FALSE;
- }
-
- if (x_expand_p != NULL)
- *x_expand_p = x_expand;
-
- if (y_expand_p != NULL)
- *y_expand_p = y_expand;
-}
-
-static void
clutter_box_layout_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
@@ -1331,7 +1279,6 @@ clutter_box_layout_class_init (ClutterBoxLayoutClass *klass)
clutter_box_layout_get_child_meta_type;
layout_class->begin_animation = clutter_box_layout_begin_animation;
layout_class->end_animation = clutter_box_layout_end_animation;
- layout_class->compute_expand = clutter_box_layout_compute_expand;
g_type_class_add_private (klass, sizeof (ClutterBoxLayoutPrivate));
diff --git a/clutter/clutter-layout-manager.c b/clutter/clutter-layout-manager.c
index 475e849..9538b96 100644
--- a/clutter/clutter-layout-manager.c
+++ b/clutter/clutter-layout-manager.c
@@ -578,21 +578,6 @@ layout_manager_real_end_animation (ClutterLayoutManager *manager)
}
static void
-layout_manager_real_compute_expand (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *child,
- gboolean *x_expand,
- gboolean *y_expand)
-{
- /* be default, we don't interfere with the Actor [xy]-expand */
- if (x_expand != NULL)
- *x_expand = FALSE;
-
- if (y_expand != NULL)
- *y_expand = FALSE;
-}
-
-static void
clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
{
quark_layout_meta =
@@ -609,7 +594,6 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
klass->get_animation_progress = layout_manager_real_get_animation_progress;
klass->end_animation = layout_manager_real_end_animation;
klass->set_container = layout_manager_real_set_container;
- klass->compute_expand = layout_manager_real_compute_expand;
/**
* ClutterLayoutManager::layout-changed:
diff --git a/clutter/clutter-layout-manager.h b/clutter/clutter-layout-manager.h
index f3cc11b..6d65d3b 100644
--- a/clutter/clutter-layout-manager.h
+++ b/clutter/clutter-layout-manager.h
@@ -90,9 +90,6 @@ struct _ClutterLayoutManager
* progress of the animation of a #ClutterLayoutManager
* @layout_changed: class handler for the #ClutterLayoutManager::layout-changed
* signal
- * @compute_expand: virtual function, used to let the layout manager instance
- * influence the result of the clutter_actor_needs_x_expand() and
- * clutter_actor_needs_y_expand() functions
*
* The #ClutterLayoutManagerClass structure contains only private
* data and should be accessed using the provided API
@@ -136,12 +133,6 @@ struct _ClutterLayoutManagerClass
void (* layout_changed) (ClutterLayoutManager *manager);
- void (* compute_expand) (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *child,
- gboolean *x_expand,
- gboolean *y_expand);
-
/*< private >*/
/* padding for future expansion */
void (* _clutter_padding_1) (void);
@@ -151,6 +142,7 @@ struct _ClutterLayoutManagerClass
void (* _clutter_padding_5) (void);
void (* _clutter_padding_6) (void);
void (* _clutter_padding_7) (void);
+ void (* _clutter_padding_8) (void);
};
GType clutter_layout_manager_get_type (void) G_GNUC_CONST;
diff --git a/clutter/clutter-table-layout.c b/clutter/clutter-table-layout.c
index fcf4b2c..7a29308 100644
--- a/clutter/clutter-table-layout.c
+++ b/clutter/clutter-table-layout.c
@@ -433,8 +433,6 @@ table_child_set_expand (ClutterTableChild *self,
else
clutter_layout_manager_layout_changed (layout);
- clutter_actor_queue_compute_expand (CLUTTER_CHILD_META (self)->actor);
-
if (x_changed)
g_object_notify (G_OBJECT (self), "x-expand");
@@ -806,9 +804,8 @@ calculate_col_widths (ClutterTableLayout *self,
col->min_size = MAX (col->min_size, c_min);
col->pref_size = MAX (col->pref_size, c_pref);
- col->expand = MAX (col->expand,
- MAX (meta->x_expand,
- clutter_actor_needs_x_expand (child)));
+ if (!col->expand)
+ col->expand = meta->x_expand;
}
/* STAGE TWO: take spanning children into account */
@@ -1035,8 +1032,8 @@ calculate_row_heights (ClutterTableLayout *self,
g_array_set_size (priv->rows, 0);
g_array_set_size (priv->rows, self->priv->n_rows);
- rows = (DimensionData*) priv->rows->data;
- columns = (DimensionData*) priv->columns->data;
+ rows = (DimensionData *) priv->rows->data;
+ columns = (DimensionData *) priv->columns->data;
/* reset the visibility of all rows */
priv->visible_rows = 0;
@@ -1082,9 +1079,8 @@ calculate_row_heights (ClutterTableLayout *self,
row->min_size = MAX (row->min_size, c_min);
row->pref_size = MAX (row->pref_size, c_pref);
- row->expand = MAX (row->expand,
- MAX (meta->y_expand,
- clutter_actor_needs_y_expand (child)));
+ if (!row->expand)
+ row->expand = meta->y_expand;
}
/* STAGE TWO: take spanning children into account */
@@ -1631,31 +1627,6 @@ clutter_table_layout_end_animation (ClutterLayoutManager *manager)
}
static void
-clutter_table_layout_compute_expand (ClutterLayoutManager *manager,
- ClutterContainer *container,
- ClutterActor *actor,
- gboolean *x_expand_p,
- gboolean *y_expand_p)
-{
- ClutterLayoutMeta *meta;
-
- meta = clutter_layout_manager_get_child_meta (manager, container, actor);
-
- if (x_expand_p != NULL)
- *x_expand_p = CLUTTER_TABLE_CHILD (meta)->x_expand ||
- clutter_actor_needs_x_expand (actor);
-
- if (y_expand_p != NULL)
- *y_expand_p = CLUTTER_TABLE_CHILD (meta)->y_expand ||
- clutter_actor_needs_y_expand (actor);
-
- g_debug ("Computing expand for '%s': x:%s, y:%s",
- G_OBJECT_TYPE_NAME (actor),
- x_expand_p != NULL ? (*x_expand_p ? "Y" : "N") : "N",
- y_expand_p != NULL ? (*y_expand_p ? "Y" : "N") : "N");
-}
-
-static void
clutter_table_layout_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
@@ -1761,7 +1732,6 @@ clutter_table_layout_class_init (ClutterTableLayoutClass *klass)
clutter_table_layout_get_child_meta_type;
layout_class->begin_animation = clutter_table_layout_begin_animation;
layout_class->end_animation = clutter_table_layout_end_animation;
- layout_class->compute_expand = clutter_table_layout_compute_expand;
g_type_class_add_private (klass, sizeof (ClutterTableLayoutPrivate));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]