mirror of
https://github.com/brl/mutter.git
synced 2025-03-25 04:33:52 +00:00
Revert "table-layout: Use the ClutterLayoutManager animation API"
This reverts commit 793bde91430c53edd0b39989e59f9f77b562947e. ClutterLayoutManager implementations should just defer the easing state set up to the child, and not try to impose a global one.
This commit is contained in:
parent
2fef1a174e
commit
1806a2140b
@ -128,6 +128,12 @@ struct _ClutterTableLayoutPrivate
|
|||||||
|
|
||||||
GArray *columns;
|
GArray *columns;
|
||||||
GArray *rows;
|
GArray *rows;
|
||||||
|
|
||||||
|
gulong easing_mode;
|
||||||
|
guint easing_duration;
|
||||||
|
|
||||||
|
guint is_animating : 1;
|
||||||
|
guint use_animations : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _ClutterTableChild
|
struct _ClutterTableChild
|
||||||
@ -171,6 +177,8 @@ enum
|
|||||||
|
|
||||||
PROP_ROW_SPACING,
|
PROP_ROW_SPACING,
|
||||||
PROP_COLUMN_SPACING,
|
PROP_COLUMN_SPACING,
|
||||||
|
PROP_USE_ANIMATIONS,
|
||||||
|
PROP_EASING_MODE,
|
||||||
PROP_EASING_DURATION
|
PROP_EASING_DURATION
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1375,10 +1383,6 @@ clutter_table_layout_allocate (ClutterLayoutManager *layout,
|
|||||||
gint row_spacing, col_spacing;
|
gint row_spacing, col_spacing;
|
||||||
gint i;
|
gint i;
|
||||||
DimensionData *rows, *columns;
|
DimensionData *rows, *columns;
|
||||||
gboolean use_animations;
|
|
||||||
ClutterAnimationMode easing_mode;
|
|
||||||
guint easing_duration, easing_delay;
|
|
||||||
|
|
||||||
|
|
||||||
update_row_col (self, container);
|
update_row_col (self, container);
|
||||||
if (priv->n_cols < 1 || priv->n_rows < 1)
|
if (priv->n_cols < 1 || priv->n_rows < 1)
|
||||||
@ -1399,11 +1403,6 @@ clutter_table_layout_allocate (ClutterLayoutManager *layout,
|
|||||||
rows = (DimensionData *) (void *) priv->rows->data;
|
rows = (DimensionData *) (void *) priv->rows->data;
|
||||||
columns = (DimensionData *) (void *) priv->columns->data;
|
columns = (DimensionData *) (void *) priv->columns->data;
|
||||||
|
|
||||||
use_animations = clutter_layout_manager_get_easing_state (layout,
|
|
||||||
&easing_mode,
|
|
||||||
&easing_duration,
|
|
||||||
&easing_delay);
|
|
||||||
|
|
||||||
for (child = clutter_actor_get_first_child (actor);
|
for (child = clutter_actor_get_first_child (actor);
|
||||||
child != NULL;
|
child != NULL;
|
||||||
child = clutter_actor_get_next_sibling (child))
|
child = clutter_actor_get_next_sibling (child))
|
||||||
@ -1499,12 +1498,11 @@ clutter_table_layout_allocate (ClutterLayoutManager *layout,
|
|||||||
childbox.y1 = (float) child_y;
|
childbox.y1 = (float) child_y;
|
||||||
childbox.y2 = (float) MAX (0, child_y + row_height);
|
childbox.y2 = (float) MAX (0, child_y + row_height);
|
||||||
|
|
||||||
if (use_animations)
|
if (priv->use_animations)
|
||||||
{
|
{
|
||||||
clutter_actor_save_easing_state (child);
|
clutter_actor_save_easing_state (child);
|
||||||
clutter_actor_set_easing_mode (child, easing_mode);
|
clutter_actor_set_easing_mode (child, priv->easing_mode);
|
||||||
clutter_actor_set_easing_duration (child, easing_duration);
|
clutter_actor_set_easing_duration (child, priv->easing_duration);
|
||||||
clutter_actor_set_easing_delay (child, easing_delay);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clutter_actor_needs_expand (child, CLUTTER_ORIENTATION_HORIZONTAL) ||
|
if (clutter_actor_needs_expand (child, CLUTTER_ORIENTATION_HORIZONTAL) ||
|
||||||
@ -1516,7 +1514,7 @@ clutter_table_layout_allocate (ClutterLayoutManager *layout,
|
|||||||
x_fill, y_fill,
|
x_fill, y_fill,
|
||||||
flags);
|
flags);
|
||||||
|
|
||||||
if (use_animations)
|
if (priv->use_animations)
|
||||||
clutter_actor_restore_easing_state (child);
|
clutter_actor_restore_easing_state (child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1539,6 +1537,18 @@ clutter_table_layout_set_property (GObject *gobject,
|
|||||||
clutter_table_layout_set_row_spacing (self, g_value_get_uint (value));
|
clutter_table_layout_set_row_spacing (self, g_value_get_uint (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_USE_ANIMATIONS:
|
||||||
|
clutter_table_layout_set_use_animations (self, g_value_get_boolean (value));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_EASING_MODE:
|
||||||
|
clutter_table_layout_set_easing_mode (self, g_value_get_ulong (value));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_EASING_DURATION:
|
||||||
|
clutter_table_layout_set_easing_duration (self, g_value_get_uint (value));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -1563,6 +1573,18 @@ clutter_table_layout_get_property (GObject *gobject,
|
|||||||
g_value_set_uint (value, priv->col_spacing);
|
g_value_set_uint (value, priv->col_spacing);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_USE_ANIMATIONS:
|
||||||
|
g_value_set_boolean (value, priv->use_animations);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_EASING_MODE:
|
||||||
|
g_value_set_ulong (value, priv->easing_mode);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROP_EASING_DURATION:
|
||||||
|
g_value_set_uint (value, priv->easing_duration);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -1632,11 +1654,74 @@ clutter_table_layout_class_init (ClutterTableLayoutClass *klass)
|
|||||||
CLUTTER_PARAM_READWRITE);
|
CLUTTER_PARAM_READWRITE);
|
||||||
g_object_class_install_property (gobject_class, PROP_ROW_SPACING, pspec);
|
g_object_class_install_property (gobject_class, PROP_ROW_SPACING, pspec);
|
||||||
|
|
||||||
/* a leftover to be compatible to the previous implementation */
|
/**
|
||||||
|
* ClutterTableLayout:use-animations:
|
||||||
|
*
|
||||||
|
* Whether the #ClutterTableLayout should animate changes in the
|
||||||
|
* layout properties.
|
||||||
|
*
|
||||||
|
* By default, #ClutterTableLayout will honour the easing state of
|
||||||
|
* the children when allocating them. Setting this property to
|
||||||
|
* %TRUE will override the easing state with the layout manager's
|
||||||
|
* #ClutterTableLayout:easing-mode and #ClutterTableLayout:easing-duration
|
||||||
|
* properties.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: #ClutterTableLayout will honour the easing state
|
||||||
|
* of the children when allocating them
|
||||||
|
*/
|
||||||
|
pspec = g_param_spec_boolean ("use-animations",
|
||||||
|
P_("Use Animations"),
|
||||||
|
P_("Whether layout changes should be animated"),
|
||||||
|
FALSE,
|
||||||
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
g_object_class_install_property (gobject_class, PROP_USE_ANIMATIONS, pspec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterTableLayout:easing-mode:
|
||||||
|
*
|
||||||
|
* The easing mode for the animations, in case
|
||||||
|
* #ClutterTableLayout:use-animations is set to %TRUE.
|
||||||
|
*
|
||||||
|
* The easing mode has the same semantics of #ClutterAnimation:mode: it can
|
||||||
|
* either be a value from the #ClutterAnimationMode enumeration, like
|
||||||
|
* %CLUTTER_EASE_OUT_CUBIC, or a logical id as returned by
|
||||||
|
* clutter_alpha_register_func().
|
||||||
|
*
|
||||||
|
* The default value is %CLUTTER_EASE_OUT_CUBIC.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: #ClutterTableLayout will honour the easing state
|
||||||
|
* of the children when allocating them
|
||||||
|
*/
|
||||||
|
pspec = g_param_spec_ulong ("easing-mode",
|
||||||
|
P_("Easing Mode"),
|
||||||
|
P_("The easing mode of the animations"),
|
||||||
|
0, G_MAXULONG,
|
||||||
|
CLUTTER_EASE_OUT_CUBIC,
|
||||||
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
g_object_class_install_property (gobject_class, PROP_EASING_MODE, pspec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterTableLayout:easing-duration:
|
||||||
|
*
|
||||||
|
* The duration of the animations, in case #ClutterTableLayout:use-animations
|
||||||
|
* is set to %TRUE.
|
||||||
|
*
|
||||||
|
* The duration is expressed in milliseconds.
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*
|
||||||
|
* Deprecated: 1.12: #ClutterTableLayout will honour the easing state
|
||||||
|
* of the children when allocating them
|
||||||
|
*/
|
||||||
pspec = g_param_spec_uint ("easing-duration",
|
pspec = g_param_spec_uint ("easing-duration",
|
||||||
P_("Easing Duration"),
|
P_("Easing Duration"),
|
||||||
P_("The duration of the animations"),
|
P_("The duration of the animations"),
|
||||||
0, G_MAXUINT, 500,
|
0, G_MAXUINT,
|
||||||
|
500,
|
||||||
CLUTTER_PARAM_READWRITE);
|
CLUTTER_PARAM_READWRITE);
|
||||||
g_object_class_install_property (gobject_class, PROP_EASING_DURATION, pspec);
|
g_object_class_install_property (gobject_class, PROP_EASING_DURATION, pspec);
|
||||||
}
|
}
|
||||||
@ -1651,6 +1736,10 @@ clutter_table_layout_init (ClutterTableLayout *layout)
|
|||||||
priv->row_spacing = 0;
|
priv->row_spacing = 0;
|
||||||
priv->col_spacing = 0;
|
priv->col_spacing = 0;
|
||||||
|
|
||||||
|
priv->use_animations = FALSE;
|
||||||
|
priv->easing_mode = CLUTTER_EASE_OUT_CUBIC;
|
||||||
|
priv->easing_duration = 500;
|
||||||
|
|
||||||
priv->columns = g_array_new (FALSE, TRUE, sizeof (DimensionData));
|
priv->columns = g_array_new (FALSE, TRUE, sizeof (DimensionData));
|
||||||
priv->rows = g_array_new (FALSE, TRUE, sizeof (DimensionData));
|
priv->rows = g_array_new (FALSE, TRUE, sizeof (DimensionData));
|
||||||
}
|
}
|
||||||
@ -2305,17 +2394,26 @@ clutter_table_layout_get_expand (ClutterTableLayout *layout,
|
|||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*
|
*
|
||||||
* Deprecated: 1.12: #ClutterTableLayout will honour the
|
* Deprecated: 1.12: #ClutterTableLayout will honour the easing state
|
||||||
* #ClutterLayoutManager:use-animations property
|
* of the children when allocating them
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clutter_table_layout_set_use_animations (ClutterTableLayout *layout,
|
clutter_table_layout_set_use_animations (ClutterTableLayout *layout,
|
||||||
gboolean animate)
|
gboolean animate)
|
||||||
{
|
{
|
||||||
|
ClutterTableLayoutPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout));
|
g_return_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout));
|
||||||
|
|
||||||
clutter_layout_manager_set_use_animations (CLUTTER_LAYOUT_MANAGER (layout),
|
priv = layout->priv;
|
||||||
animate);
|
|
||||||
|
animate = !!animate;
|
||||||
|
if (priv->use_animations != animate)
|
||||||
|
{
|
||||||
|
priv->use_animations = animate;
|
||||||
|
|
||||||
|
g_object_notify (G_OBJECT (layout), "use-animations");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2330,19 +2428,14 @@ clutter_table_layout_set_use_animations (ClutterTableLayout *layout,
|
|||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*
|
*
|
||||||
* Deprecated: 1.12: #ClutterTable will honour the
|
* Deprecated: 1.12
|
||||||
* #ClutterLayoutManager:use-animations property
|
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
clutter_table_layout_get_use_animations (ClutterTableLayout *layout)
|
clutter_table_layout_get_use_animations (ClutterTableLayout *layout)
|
||||||
{
|
{
|
||||||
ClutterLayoutManager *manager;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout), FALSE);
|
g_return_val_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout), FALSE);
|
||||||
|
|
||||||
manager = CLUTTER_LAYOUT_MANAGER (layout);
|
return layout->priv->use_animations;
|
||||||
|
|
||||||
return clutter_layout_manager_get_use_animations (manager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2359,17 +2452,25 @@ clutter_table_layout_get_use_animations (ClutterTableLayout *layout)
|
|||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*
|
*
|
||||||
* Deprecated: 1.12: #ClutterTableLayout will honour the
|
* Deprecated: 1.12: #ClutterTableLayout will honour the easing state
|
||||||
* #ClutterLayoutManager:easing-mode property
|
* of the children when allocating them
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clutter_table_layout_set_easing_mode (ClutterTableLayout *layout,
|
clutter_table_layout_set_easing_mode (ClutterTableLayout *layout,
|
||||||
gulong mode)
|
gulong mode)
|
||||||
{
|
{
|
||||||
|
ClutterTableLayoutPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout));
|
g_return_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout));
|
||||||
|
|
||||||
clutter_layout_manager_set_easing_mode (CLUTTER_LAYOUT_MANAGER (layout),
|
priv = layout->priv;
|
||||||
mode);
|
|
||||||
|
if (priv->easing_mode != mode)
|
||||||
|
{
|
||||||
|
priv->easing_mode = mode;
|
||||||
|
|
||||||
|
g_object_notify (G_OBJECT (layout), "easing-mode");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2382,20 +2483,16 @@ clutter_table_layout_set_easing_mode (ClutterTableLayout *layout,
|
|||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*
|
*
|
||||||
* Deprecated: 1.12: #ClutterTableLayout will honour the
|
* Deprecated: 1.12: #ClutterTableLayout will honour the easing state
|
||||||
* #ClutterLayoutManager:easing-mode property
|
* of the children when allocating them
|
||||||
*/
|
*/
|
||||||
gulong
|
gulong
|
||||||
clutter_table_layout_get_easing_mode (ClutterTableLayout *layout)
|
clutter_table_layout_get_easing_mode (ClutterTableLayout *layout)
|
||||||
{
|
{
|
||||||
ClutterLayoutManager *manager;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout),
|
g_return_val_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout),
|
||||||
CLUTTER_EASE_OUT_CUBIC);
|
CLUTTER_EASE_OUT_CUBIC);
|
||||||
|
|
||||||
manager = CLUTTER_LAYOUT_MANAGER (layout);
|
return layout->priv->easing_mode;
|
||||||
|
|
||||||
return clutter_layout_manager_get_easing_mode (manager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2411,17 +2508,25 @@ clutter_table_layout_get_easing_mode (ClutterTableLayout *layout)
|
|||||||
*
|
*
|
||||||
* Since: 1.4
|
* Since: 1.4
|
||||||
*
|
*
|
||||||
* Deprecated: 1.12: #ClutterTableLayout will honour the
|
* Deprecated: 1.12: #ClutterTableLayout will honour the easing state
|
||||||
* #ClutterLayoutManager:easing-duration property
|
* of the children when allocating them
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clutter_table_layout_set_easing_duration (ClutterTableLayout *layout,
|
clutter_table_layout_set_easing_duration (ClutterTableLayout *layout,
|
||||||
guint msecs)
|
guint msecs)
|
||||||
{
|
{
|
||||||
|
ClutterTableLayoutPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout));
|
g_return_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout));
|
||||||
|
|
||||||
clutter_layout_manager_set_easing_duration (CLUTTER_LAYOUT_MANAGER (layout),
|
priv = layout->priv;
|
||||||
msecs);
|
|
||||||
|
if (priv->easing_duration != msecs)
|
||||||
|
{
|
||||||
|
priv->easing_duration = msecs;
|
||||||
|
|
||||||
|
g_object_notify (G_OBJECT (layout), "easing-duration");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2439,13 +2544,9 @@ clutter_table_layout_set_easing_duration (ClutterTableLayout *layout,
|
|||||||
guint
|
guint
|
||||||
clutter_table_layout_get_easing_duration (ClutterTableLayout *layout)
|
clutter_table_layout_get_easing_duration (ClutterTableLayout *layout)
|
||||||
{
|
{
|
||||||
ClutterLayoutManager *manager;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout), 500);
|
g_return_val_if_fail (CLUTTER_IS_TABLE_LAYOUT (layout), 500);
|
||||||
|
|
||||||
manager = CLUTTER_LAYOUT_MANAGER (layout);
|
return layout->priv->easing_duration;
|
||||||
|
|
||||||
return clutter_layout_manager_get_easing_duration (manager);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user