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.
This commit is contained in:
Emmanuele Bassi 2011-12-21 17:07:25 +00:00 committed by Emmanuele Bassi
parent 72b523c9e9
commit 72fa75c034
6 changed files with 14 additions and 592 deletions

View File

@ -479,12 +479,6 @@ struct _ClutterActorPrivate
the redraw was queued from or it will be NULL if the redraw was the redraw was queued from or it will be NULL if the redraw was
queued without an effect. */ queued without an effect. */
guint is_dirty : 1; 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; guint bg_color_set : 1;
}; };
@ -576,8 +570,6 @@ enum
PROP_LAYOUT_MANAGER, PROP_LAYOUT_MANAGER,
PROP_X_EXPAND,
PROP_Y_EXPAND,
PROP_X_ALIGN, PROP_X_ALIGN,
PROP_Y_ALIGN, PROP_Y_ALIGN,
PROP_MARGIN_TOP, PROP_MARGIN_TOP,
@ -1306,7 +1298,7 @@ clutter_actor_show (ClutterActor *self)
g_signal_emit (self, actor_signals[SHOW], 0); g_signal_emit (self, actor_signals[SHOW], 0);
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_VISIBLE]); 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); clutter_actor_queue_redraw (priv->parent);
g_object_thaw_notify (G_OBJECT (self)); 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_signal_emit (self, actor_signals[HIDE], 0);
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_VISIBLE]); 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); clutter_actor_queue_redraw (priv->parent);
g_object_thaw_notify (G_OBJECT (self)); g_object_thaw_notify (G_OBJECT (self));
@ -3783,14 +3775,6 @@ clutter_actor_set_property (GObject *object,
clutter_actor_set_layout_manager (actor, g_value_get_object (value)); clutter_actor_set_layout_manager (actor, g_value_get_object (value));
break; 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: case PROP_X_ALIGN:
clutter_actor_set_x_align (actor, g_value_get_enum (value)); clutter_actor_set_x_align (actor, g_value_get_enum (value));
break; break;
@ -4147,24 +4131,6 @@ clutter_actor_get_property (GObject *object,
g_value_set_object (value, priv->layout_manager); g_value_set_object (value, priv->layout_manager);
break; 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: case PROP_X_ALIGN:
{ {
const ClutterLayoutInfo *info; const ClutterLayoutInfo *info;
@ -5280,43 +5246,12 @@ clutter_actor_class_init (ClutterActorClass *klass)
CLUTTER_PARAM_READWRITE); CLUTTER_PARAM_READWRITE);
/**
* 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: * ClutterActor:x-align:
* *
* The alignment of an actor on the X axis, if the actor has been given * The alignment of an actor on the X axis, if the actor has been given
* extra space for its allocation. * extra space for its allocation.
* *
* This property only applies if the #ClutterActor:x-expand property
* has been set to %TRUE.
*
* Since: 1.10 * Since: 1.10
*/ */
obj_props[PROP_X_ALIGN] = obj_props[PROP_X_ALIGN] =
@ -5333,9 +5268,6 @@ clutter_actor_class_init (ClutterActorClass *klass)
* The alignment of an actor on the Y axis, if the actor has been given * The alignment of an actor on the Y axis, if the actor has been given
* extra space for its allocation. * extra space for its allocation.
* *
* This property only applies if the #ClutterActor:y-expand property
* has been set to %TRUE.
*
* Since: 1.10 * Since: 1.10
*/ */
obj_props[PROP_Y_ALIGN] = obj_props[PROP_Y_ALIGN] =
@ -7358,7 +7290,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); clutter_actor_adjust_allocation (self, &real_allocation);
if (real_allocation.x2 < real_allocation.x1 || if (real_allocation.x2 < real_allocation.x1 ||
@ -9659,22 +9591,6 @@ clutter_actor_add_child_internal (ClutterActor *self,
clutter_actor_queue_relayout (child->priv->parent); 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) if (emit_signal)
g_signal_emit_by_name (self, "actor-added", child); g_signal_emit_by_name (self, "actor-added", child);
} }
@ -10004,17 +9920,6 @@ clutter_actor_remove_child_internal (ClutterActor *self,
if (was_mapped) if (was_mapped)
clutter_actor_queue_relayout (self); 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 */ /* we need to emit the signal before dropping the reference */
if (emit_signal) if (emit_signal)
g_signal_emit_by_name (self, "actor-removed", child); g_signal_emit_by_name (self, "actor-removed", child);
@ -14668,8 +14573,6 @@ static const ClutterLayoutInfo default_layout_info = {
0.f, /* fixed-x */ 0.f, /* fixed-x */
0.f, /* fixed-y */ 0.f, /* fixed-y */
{ 0, 0, 0, 0 }, /* margin */ { 0, 0, 0, 0 }, /* margin */
FALSE, /* x-expand */
FALSE, /* y-expand */
CLUTTER_ACTOR_ALIGN_FILL, /* x-align */ CLUTTER_ACTOR_ALIGN_FILL, /* x-align */
CLUTTER_ACTOR_ALIGN_FILL, /* y-align */ CLUTTER_ACTOR_ALIGN_FILL, /* y-align */
0.f, 0.f, /* min_width, natural_width */ 0.f, 0.f, /* min_width, natural_width */
@ -14744,368 +14647,6 @@ _clutter_actor_get_layout_info_or_defaults (ClutterActor *self)
return info; 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: * clutter_actor_set_x_align:
* @self: a #ClutterActor * @self: a #ClutterActor
@ -15114,8 +14655,7 @@ clutter_actor_get_y_expand (ClutterActor *self)
* Sets the horizontal alignment policy of a #ClutterActor, in case the * Sets the horizontal alignment policy of a #ClutterActor, in case the
* actor received extra horizontal space. * actor received extra horizontal space.
* *
* See also the #ClutterActor:x-align property, as well as the * See also the #ClutterActor:x-align property.
* #ClutterActor:x-expand property.
* *
* Since: 1.10 * Since: 1.10
*/ */
@ -15166,8 +14706,7 @@ clutter_actor_get_x_align (ClutterActor *self)
* Sets the vertical alignment policy of a #ClutterActor, in case the * Sets the vertical alignment policy of a #ClutterActor, in case the
* actor received extra vertical space. * actor received extra vertical space.
* *
* See also the #ClutterActor:y-align property, as well as the * See also the #ClutterActor:y-align property.
* #ClutterActor:y-expand property.
* *
* Since: 1.10 * Since: 1.10
*/ */

View File

@ -377,16 +377,6 @@ void clutter_actor_set_layout_manager (ClutterActor
ClutterLayoutManager *manager); ClutterLayoutManager *manager);
ClutterLayoutManager *clutter_actor_get_layout_manager (ClutterActor *self); 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, void clutter_actor_set_x_align (ClutterActor *self,
ClutterActorAlign x_align); ClutterActorAlign x_align);
ClutterActorAlign clutter_actor_get_x_align (ClutterActor *self); ClutterActorAlign clutter_actor_get_x_align (ClutterActor *self);

View File

@ -276,11 +276,6 @@ box_child_set_expand (ClutterBoxChild *self,
else else
clutter_layout_manager_layout_changed (layout); 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"); g_object_notify (G_OBJECT (self), "expand");
} }
} }
@ -747,10 +742,8 @@ count_expand_children (ClutterLayoutManager *layout,
gint *visible_children, gint *visible_children,
gint *expand_children) gint *expand_children)
{ {
ClutterBoxLayoutPrivate *priv;
ClutterActor *actor, *child; ClutterActor *actor, *child;
priv = CLUTTER_BOX_LAYOUT (layout)->priv;
actor = CLUTTER_ACTOR (container); actor = CLUTTER_ACTOR (container);
*visible_children = *expand_children = 0; *visible_children = *expand_children = 0;
@ -762,7 +755,6 @@ count_expand_children (ClutterLayoutManager *layout,
if (CLUTTER_ACTOR_IS_VISIBLE (child)) if (CLUTTER_ACTOR_IS_VISIBLE (child))
{ {
ClutterLayoutMeta *meta; ClutterLayoutMeta *meta;
gboolean needs_expand;
*visible_children += 1; *visible_children += 1;
@ -770,12 +762,7 @@ count_expand_children (ClutterLayoutManager *layout,
container, container,
child); child);
if (priv->is_vertical) if (CLUTTER_BOX_CHILD (meta)->expand)
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)
*expand_children += 1; *expand_children += 1;
} }
} }
@ -1070,16 +1057,9 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
} }
else else
{ {
gboolean needs_expand;
child_size = sizes[i].minimum_size; child_size = sizes[i].minimum_size;
if (priv->is_vertical) if (box_child->expand)
needs_expand = clutter_actor_needs_y_expand (child);
else
needs_expand = clutter_actor_needs_x_expand (child);
if (box_child->expand || needs_expand)
{ {
child_size += extra; child_size += extra;
@ -1189,38 +1169,6 @@ clutter_box_layout_end_animation (ClutterLayoutManager *manager)
parent_class->end_animation (manager); parent_class->end_animation (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 static void
clutter_box_layout_set_property (GObject *gobject, clutter_box_layout_set_property (GObject *gobject,
guint prop_id, guint prop_id,
@ -1331,7 +1279,6 @@ clutter_box_layout_class_init (ClutterBoxLayoutClass *klass)
clutter_box_layout_get_child_meta_type; clutter_box_layout_get_child_meta_type;
layout_class->begin_animation = clutter_box_layout_begin_animation; layout_class->begin_animation = clutter_box_layout_begin_animation;
layout_class->end_animation = clutter_box_layout_end_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)); g_type_class_add_private (klass, sizeof (ClutterBoxLayoutPrivate));

View File

@ -577,21 +577,6 @@ layout_manager_real_end_animation (ClutterLayoutManager *manager)
clutter_layout_manager_layout_changed (manager); clutter_layout_manager_layout_changed (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 static void
clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass) clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
{ {
@ -609,7 +594,6 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
klass->get_animation_progress = layout_manager_real_get_animation_progress; klass->get_animation_progress = layout_manager_real_get_animation_progress;
klass->end_animation = layout_manager_real_end_animation; klass->end_animation = layout_manager_real_end_animation;
klass->set_container = layout_manager_real_set_container; klass->set_container = layout_manager_real_set_container;
klass->compute_expand = layout_manager_real_compute_expand;
/** /**
* ClutterLayoutManager::layout-changed: * ClutterLayoutManager::layout-changed:

View File

@ -90,9 +90,6 @@ struct _ClutterLayoutManager
* progress of the animation of a #ClutterLayoutManager * progress of the animation of a #ClutterLayoutManager
* @layout_changed: class handler for the #ClutterLayoutManager::layout-changed * @layout_changed: class handler for the #ClutterLayoutManager::layout-changed
* signal * 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 * The #ClutterLayoutManagerClass structure contains only private
* data and should be accessed using the provided API * data and should be accessed using the provided API
@ -136,12 +133,6 @@ struct _ClutterLayoutManagerClass
void (* layout_changed) (ClutterLayoutManager *manager); void (* layout_changed) (ClutterLayoutManager *manager);
void (* compute_expand) (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *child,
gboolean *x_expand,
gboolean *y_expand);
/*< private >*/ /*< private >*/
/* padding for future expansion */ /* padding for future expansion */
void (* _clutter_padding_1) (void); void (* _clutter_padding_1) (void);
@ -151,6 +142,7 @@ struct _ClutterLayoutManagerClass
void (* _clutter_padding_5) (void); void (* _clutter_padding_5) (void);
void (* _clutter_padding_6) (void); void (* _clutter_padding_6) (void);
void (* _clutter_padding_7) (void); void (* _clutter_padding_7) (void);
void (* _clutter_padding_8) (void);
}; };
GType clutter_layout_manager_get_type (void) G_GNUC_CONST; GType clutter_layout_manager_get_type (void) G_GNUC_CONST;

View File

@ -433,8 +433,6 @@ table_child_set_expand (ClutterTableChild *self,
else else
clutter_layout_manager_layout_changed (layout); clutter_layout_manager_layout_changed (layout);
clutter_actor_queue_compute_expand (CLUTTER_CHILD_META (self)->actor);
if (x_changed) if (x_changed)
g_object_notify (G_OBJECT (self), "x-expand"); 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->min_size = MAX (col->min_size, c_min);
col->pref_size = MAX (col->pref_size, c_pref); col->pref_size = MAX (col->pref_size, c_pref);
col->expand = MAX (col->expand, if (!col->expand)
MAX (meta->x_expand, col->expand = meta->x_expand;
clutter_actor_needs_x_expand (child)));
} }
/* STAGE TWO: take spanning children into account */ /* 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, 0);
g_array_set_size (priv->rows, self->priv->n_rows); g_array_set_size (priv->rows, self->priv->n_rows);
rows = (DimensionData*) priv->rows->data; rows = (DimensionData *) priv->rows->data;
columns = (DimensionData*) priv->columns->data; columns = (DimensionData *) priv->columns->data;
/* reset the visibility of all rows */ /* reset the visibility of all rows */
priv->visible_rows = 0; priv->visible_rows = 0;
@ -1082,9 +1079,8 @@ calculate_row_heights (ClutterTableLayout *self,
row->min_size = MAX (row->min_size, c_min); row->min_size = MAX (row->min_size, c_min);
row->pref_size = MAX (row->pref_size, c_pref); row->pref_size = MAX (row->pref_size, c_pref);
row->expand = MAX (row->expand, if (!row->expand)
MAX (meta->y_expand, row->expand = meta->y_expand;
clutter_actor_needs_y_expand (child)));
} }
/* STAGE TWO: take spanning children into account */ /* STAGE TWO: take spanning children into account */
@ -1630,31 +1626,6 @@ clutter_table_layout_end_animation (ClutterLayoutManager *manager)
parent_class->end_animation (manager); parent_class->end_animation (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 static void
clutter_table_layout_set_property (GObject *gobject, clutter_table_layout_set_property (GObject *gobject,
guint prop_id, guint prop_id,
@ -1761,7 +1732,6 @@ clutter_table_layout_class_init (ClutterTableLayoutClass *klass)
clutter_table_layout_get_child_meta_type; clutter_table_layout_get_child_meta_type;
layout_class->begin_animation = clutter_table_layout_begin_animation; layout_class->begin_animation = clutter_table_layout_begin_animation;
layout_class->end_animation = clutter_table_layout_end_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)); g_type_class_add_private (klass, sizeof (ClutterTableLayoutPrivate));