mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
actor: Coalesce needs_[xy]_expand() into one method
Use the orientation enumeration instead of a per-axis method.
This commit is contained in:
parent
807d77c0f3
commit
78aae84d43
@ -18318,7 +18318,7 @@ clutter_actor_set_x_expand (ClutterActor *self,
|
||||
*
|
||||
* Retrieves the value set with clutter_actor_set_x_expand().
|
||||
*
|
||||
* See also: clutter_actor_needs_x_expand()
|
||||
* See also: clutter_actor_needs_expand()
|
||||
*
|
||||
* Return value: %TRUE if the actor has been set to expand
|
||||
*
|
||||
@ -18377,7 +18377,7 @@ clutter_actor_set_y_expand (ClutterActor *self,
|
||||
*
|
||||
* Retrieves the value set with clutter_actor_set_y_expand().
|
||||
*
|
||||
* See also: clutter_actor_needs_y_expand()
|
||||
* See also: clutter_actor_needs_expand()
|
||||
*
|
||||
* Return value: %TRUE if the actor has been set to expand
|
||||
*
|
||||
@ -18402,11 +18402,18 @@ clutter_actor_compute_expand_recursive (ClutterActor *self,
|
||||
|
||||
x_expand = y_expand = FALSE;
|
||||
|
||||
/* note that we don't recurse into children if we're already set to expand;
|
||||
* this avoids traversing the whole actor tree, even if it may lead to some
|
||||
* child left with the needs_compute_expand flag set.
|
||||
*/
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
{
|
||||
x_expand = x_expand || clutter_actor_needs_x_expand (child);
|
||||
y_expand = y_expand || clutter_actor_needs_y_expand (child);
|
||||
x_expand = x_expand ||
|
||||
clutter_actor_needs_expand (child, CLUTTER_ORIENTATION_HORIZONTAL);
|
||||
|
||||
y_expand = y_expand ||
|
||||
clutter_actor_needs_expand (child, CLUTTER_ORIENTATION_VERTICAL);
|
||||
}
|
||||
|
||||
*x_expand_p = x_expand;
|
||||
@ -18459,24 +18466,26 @@ clutter_actor_compute_expand (ClutterActor *self)
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_needs_x_expand:
|
||||
* clutter_actor_needs_expand:
|
||||
* @self: a #ClutterActor
|
||||
* @orientation: the direction of expansion
|
||||
*
|
||||
* Checks whether an actor, or any of its children, is set to expand
|
||||
* horizontally.
|
||||
* horizontally or vertically.
|
||||
*
|
||||
* This function should only be called by layout managers that can
|
||||
* assign extra space to their children.
|
||||
*
|
||||
* If you want to know whether the actor was explicitly set to expand,
|
||||
* use clutter_actor_get_y_expand().
|
||||
* use clutter_actor_get_x_expand() or clutter_actor_get_y_expand().
|
||||
*
|
||||
* Return value: %TRUE if the actor should expand
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
gboolean
|
||||
clutter_actor_needs_x_expand (ClutterActor *self)
|
||||
clutter_actor_needs_expand (ClutterActor *self,
|
||||
ClutterOrientation orientation)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
||||
|
||||
@ -18488,38 +18497,14 @@ clutter_actor_needs_x_expand (ClutterActor *self)
|
||||
|
||||
clutter_actor_compute_expand (self);
|
||||
|
||||
return self->priv->needs_x_expand;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_needs_y_expand:
|
||||
* @self: a #ClutterActor
|
||||
*
|
||||
* Checks whether an actor, or any of its children, is set to expand
|
||||
* vertically.
|
||||
*
|
||||
* This function should only be called by layout managers that can
|
||||
* assign extra space to their children.
|
||||
*
|
||||
* If you want to know whether the actor was explicitly set to expand,
|
||||
* use clutter_actor_get_y_expand().
|
||||
*
|
||||
* Return value: %TRUE if the actor should expand
|
||||
*
|
||||
* Since: 1.12
|
||||
*/
|
||||
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_IN_DESTRUCTION (self))
|
||||
return FALSE;
|
||||
|
||||
clutter_actor_compute_expand (self);
|
||||
|
||||
return self->priv->needs_x_expand;
|
||||
switch (orientation)
|
||||
{
|
||||
case CLUTTER_ORIENTATION_HORIZONTAL:
|
||||
return self->priv->needs_x_expand;
|
||||
|
||||
case CLUTTER_ORIENTATION_VERTICAL:
|
||||
return self->priv->needs_y_expand;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -450,9 +450,8 @@ void clutter_actor_set_y_expand
|
||||
CLUTTER_AVAILABLE_IN_1_12
|
||||
gboolean clutter_actor_get_y_expand (ClutterActor *self);
|
||||
CLUTTER_AVAILABLE_IN_1_12
|
||||
gboolean clutter_actor_needs_x_expand (ClutterActor *self);
|
||||
CLUTTER_AVAILABLE_IN_1_12
|
||||
gboolean clutter_actor_needs_y_expand (ClutterActor *self);
|
||||
gboolean clutter_actor_needs_expand (ClutterActor *self,
|
||||
ClutterOrientation orientation);
|
||||
|
||||
/* Paint */
|
||||
void clutter_actor_set_clip (ClutterActor *self,
|
||||
|
@ -461,7 +461,7 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||
child_alloc.x2 = available_w;
|
||||
child_alloc.y2 = available_h;
|
||||
|
||||
if (clutter_actor_needs_x_expand (child))
|
||||
if (clutter_actor_needs_expand (child, CLUTTER_ORIENTATION_HORIZONTAL))
|
||||
{
|
||||
ClutterActorAlign align;
|
||||
|
||||
@ -475,7 +475,7 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||
x_align = get_bin_alignment_factor (layer->x_align);
|
||||
}
|
||||
|
||||
if (clutter_actor_needs_y_expand (child))
|
||||
if (clutter_actor_needs_expand (child, CLUTTER_ORIENTATION_VERTICAL))
|
||||
{
|
||||
ClutterActorAlign align;
|
||||
|
||||
|
@ -192,8 +192,7 @@ clutter_actor_meta_set_name
|
||||
clutter_actor_move_anchor_point
|
||||
clutter_actor_move_anchor_point_from_gravity
|
||||
clutter_actor_move_by
|
||||
clutter_actor_needs_x_expand
|
||||
clutter_actor_needs_y_expand
|
||||
clutter_actor_needs_expand
|
||||
clutter_actor_new
|
||||
clutter_actor_paint
|
||||
clutter_actor_pop_internal
|
||||
|
Loading…
Reference in New Issue
Block a user