diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index ab77fa37e..ecdfaf711 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -16356,13 +16356,17 @@ clutter_actor_is_effectively_on_stage_view (ClutterActor *self, /** * clutter_actor_pick_frame_clock: (skip) * @self: a #ClutterActor + * @out_actor: (nullable): a pointer to an #ClutterActor * * Pick the most suitable frame clock for driving animations for this actor. * + * The #ClutterActor used for picking the frame clock is written @out_actor. + * * Returns: (transfer none): a #ClutterFrameClock */ ClutterFrameClock * -clutter_actor_pick_frame_clock (ClutterActor *self) +clutter_actor_pick_frame_clock (ClutterActor *self, + ClutterActor **out_actor) { ClutterActorPrivate *priv = self->priv; float max_refresh_rate = 0.0; @@ -16372,7 +16376,7 @@ clutter_actor_pick_frame_clock (ClutterActor *self) if (!priv->stage_views) { if (priv->parent) - return clutter_actor_pick_frame_clock (priv->parent); + return clutter_actor_pick_frame_clock (priv->parent, out_actor); else return NULL; } @@ -16391,9 +16395,15 @@ clutter_actor_pick_frame_clock (ClutterActor *self) } if (best_view) - return clutter_stage_view_get_frame_clock (best_view); + { + if (out_actor) + *out_actor = self; + return clutter_stage_view_get_frame_clock (best_view); + } else - return NULL; + { + return NULL; + } } /** diff --git a/clutter/clutter/clutter-mutter.h b/clutter/clutter/clutter-mutter.h index 126aabf76..654c6dac0 100644 --- a/clutter/clutter/clutter-mutter.h +++ b/clutter/clutter/clutter-mutter.h @@ -69,7 +69,8 @@ CLUTTER_EXPORT gboolean clutter_actor_has_transitions (ClutterActor *actor); CLUTTER_EXPORT -ClutterFrameClock * clutter_actor_pick_frame_clock (ClutterActor *self); +ClutterFrameClock * clutter_actor_pick_frame_clock (ClutterActor *self, + ClutterActor **out_actor); #undef __CLUTTER_H_INSIDE__ diff --git a/clutter/clutter/clutter-timeline.c b/clutter/clutter/clutter-timeline.c index 6750072a1..4a36da435 100644 --- a/clutter/clutter/clutter-timeline.c +++ b/clutter/clutter/clutter-timeline.c @@ -393,7 +393,7 @@ update_frame_clock (ClutterTimeline *timeline) if (!priv->actor) goto out; - frame_clock = clutter_actor_pick_frame_clock (priv->actor); + frame_clock = clutter_actor_pick_frame_clock (priv->actor, NULL); if (frame_clock) { g_clear_signal_handler (&priv->stage_stage_views_handler_id, priv->stage); diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c index 9ea907b3c..a1b419bbe 100644 --- a/src/compositor/meta-window-actor-x11.c +++ b/src/compositor/meta-window-actor-x11.c @@ -1237,7 +1237,7 @@ handle_stage_views_changed (MetaWindowActorX11 *actor_x11) { ClutterActor *actor = CLUTTER_ACTOR (actor_x11); - actor_x11->frame_clock = clutter_actor_pick_frame_clock (actor); + actor_x11->frame_clock = clutter_actor_pick_frame_clock (actor, NULL); if (actor_x11->frame_clock && actor_x11->pending_schedule_update_now) { clutter_frame_clock_schedule_update_now (actor_x11->frame_clock); diff --git a/src/tests/stage-view-tests.c b/src/tests/stage-view-tests.c index f298b8ba8..684319d41 100644 --- a/src/tests/stage-view-tests.c +++ b/src/tests/stage-view-tests.c @@ -652,15 +652,15 @@ meta_test_actor_stage_views_frame_clock (void) stage_views->data, stage_views->next->data); - frame_clock = clutter_actor_pick_frame_clock (actor_1); + frame_clock = clutter_actor_pick_frame_clock (actor_1, NULL); g_assert_cmpfloat (clutter_frame_clock_get_refresh_rate (frame_clock), ==, 60.0); - frame_clock = clutter_actor_pick_frame_clock (actor_2); + frame_clock = clutter_actor_pick_frame_clock (actor_2, NULL); g_assert_cmpfloat (clutter_frame_clock_get_refresh_rate (frame_clock), ==, 30.0); - frame_clock = clutter_actor_pick_frame_clock (actor_3); + frame_clock = clutter_actor_pick_frame_clock (actor_3, NULL); g_assert_cmpfloat (clutter_frame_clock_get_refresh_rate (frame_clock), ==, 60.0);