clutter/transition: Get timeline actor from animatable

Undeprecate the non-actor carrying transition constructor, and instead
rely on set_animatable() to give us a source for an actor to derive a
view and frame clock from.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
This commit is contained in:
Jonas Ådahl 2020-06-16 21:58:30 +02:00
parent aa34f6ad7c
commit 4b8bb4608c
6 changed files with 10 additions and 19 deletions

View File

@ -17916,7 +17916,7 @@ _clutter_actor_create_transition (ClutterActor *actor,
clos = g_hash_table_lookup (info->transitions, pspec->name);
if (clos == NULL)
{
res = clutter_property_transition_new_for_actor (actor, pspec->name);
res = clutter_property_transition_new (pspec->name);
clutter_transition_set_remove_on_complete (res, TRUE);

View File

@ -82,7 +82,7 @@ CLUTTER_EXPORT
ClutterTransition * clutter_property_transition_new_for_actor (ClutterActor *actor,
const char *property_name);
CLUTTER_DEPRECATED_FOR(clutter_transition_new_for_actor)
CLUTTER_EXPORT
ClutterTransition * clutter_property_transition_new (const char *property_name);
CLUTTER_EXPORT

View File

@ -369,9 +369,7 @@ clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
if (priv->transition == NULL)
{
priv->transition =
clutter_property_transition_new_for_actor (CLUTTER_ACTOR (actor),
"scroll-to");
priv->transition = clutter_property_transition_new ("scroll-to");
clutter_transition_set_animatable (priv->transition,
CLUTTER_ANIMATABLE (actor));
clutter_transition_set_remove_on_complete (priv->transition, TRUE);

View File

@ -3662,8 +3662,7 @@ clutter_text_set_color_animated (ClutterText *self,
if (transition == NULL)
{
transition = clutter_property_transition_new_for_actor (actor,
pspec->name);
transition = clutter_property_transition_new (pspec->name);
clutter_transition_set_animatable (transition,
CLUTTER_ANIMATABLE (self));
clutter_transition_set_remove_on_complete (transition, TRUE);

View File

@ -659,17 +659,6 @@ clutter_timeline_get_property (GObject *object,
}
}
static void
clutter_timeline_constructed (GObject *object)
{
ClutterTimeline *timeline = CLUTTER_TIMELINE (object);
ClutterTimelinePrivate *priv = timeline->priv;
g_warn_if_fail (priv->actor || priv->frame_clock);
G_OBJECT_CLASS (clutter_timeline_parent_class)->constructed (object);
}
static void
clutter_timeline_finalize (GObject *object)
{
@ -844,7 +833,6 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
object_class->dispose = clutter_timeline_dispose;
object_class->finalize = clutter_timeline_finalize;
object_class->constructed = clutter_timeline_constructed;
object_class->set_property = clutter_timeline_set_property;
object_class->get_property = clutter_timeline_get_property;
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
@ -1340,6 +1328,8 @@ clutter_timeline_start (ClutterTimeline *timeline)
if (priv->duration == 0)
return;
g_warn_if_fail (priv->actor || priv->frame_clock);
if (priv->delay)
priv->delay_id = clutter_threads_add_timeout (priv->delay,
delay_timeout_func,

View File

@ -364,6 +364,7 @@ clutter_transition_set_animatable (ClutterTransition *transition,
ClutterAnimatable *animatable)
{
ClutterTransitionPrivate *priv;
ClutterActor *actor;
g_return_if_fail (CLUTTER_IS_TRANSITION (transition));
g_return_if_fail (animatable == NULL || CLUTTER_IS_ANIMATABLE (animatable));
@ -383,6 +384,9 @@ clutter_transition_set_animatable (ClutterTransition *transition,
priv->animatable = g_object_ref (animatable);
clutter_transition_attach (transition, priv->animatable);
}
actor = clutter_animatable_get_actor (animatable);
clutter_timeline_set_actor (CLUTTER_TIMELINE (transition), actor);
}
/**