mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 01:50:42 -05:00
gdk: master-clock: force scheduling new frames for timelines alive
As long as we have timelines alive, we need to keep asking the GdkFrameClock for new frames. Otherwise animations might stall. https://bugzilla.gnome.org/show_bug.cgi?id=744684
This commit is contained in:
parent
018cd7bb5c
commit
a4d0b157b6
@ -99,20 +99,21 @@ G_DEFINE_TYPE_WITH_CODE (ClutterMasterClockGdk,
|
|||||||
clutter_master_clock_iface_init));
|
clutter_master_clock_iface_init));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
master_clock_schedule_stages_updates (ClutterMasterClockGdk *master_clock)
|
master_clock_schedule_forced_stages_updates (ClutterMasterClockGdk *master_clock)
|
||||||
{
|
{
|
||||||
ClutterStageManager *stage_manager = clutter_stage_manager_get_default ();
|
GHashTableIter iter;
|
||||||
const GSList *stages, *l;
|
gpointer stage, frame_clock;
|
||||||
|
|
||||||
stages = clutter_stage_manager_peek_stages (stage_manager);
|
g_hash_table_iter_init (&iter, master_clock->stage_to_clock);
|
||||||
|
while (g_hash_table_iter_next (&iter, &stage, &frame_clock))
|
||||||
for (l = stages; l != NULL; l = l->next)
|
gdk_frame_clock_request_phase (GDK_FRAME_CLOCK (frame_clock),
|
||||||
_clutter_stage_schedule_update (l->data);
|
GDK_FRAME_CLOCK_PHASE_UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
master_clock_reschedule_stage_update (ClutterMasterClockGdk *master_clock,
|
master_clock_schedule_stage_update (ClutterMasterClockGdk *master_clock,
|
||||||
ClutterStage *stage)
|
ClutterStage *stage,
|
||||||
|
GdkFrameClock *frame_clock)
|
||||||
{
|
{
|
||||||
/* Clear the old update time */
|
/* Clear the old update time */
|
||||||
_clutter_stage_clear_update_time (stage);
|
_clutter_stage_clear_update_time (stage);
|
||||||
@ -121,6 +122,13 @@ master_clock_reschedule_stage_update (ClutterMasterClockGdk *master_clock,
|
|||||||
if (_clutter_stage_has_queued_events (stage) ||
|
if (_clutter_stage_has_queued_events (stage) ||
|
||||||
_clutter_stage_needs_update (stage))
|
_clutter_stage_needs_update (stage))
|
||||||
_clutter_stage_schedule_update (stage);
|
_clutter_stage_schedule_update (stage);
|
||||||
|
|
||||||
|
/* We can avoid to schedule a new frame if the stage doesn't need
|
||||||
|
* anymore redrawing. But in the case we still have timelines alive,
|
||||||
|
* we have no choice, we need to advance the timelines for the next
|
||||||
|
* frame. */
|
||||||
|
if (master_clock->timelines != NULL)
|
||||||
|
gdk_frame_clock_request_phase (frame_clock, GDK_FRAME_CLOCK_PHASE_UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -287,7 +295,7 @@ clutter_master_clock_gdk_update (GdkFrameClock *frame_clock,
|
|||||||
if (g_hash_table_lookup (master_clock->clock_to_stage, frame_clock) != NULL)
|
if (g_hash_table_lookup (master_clock->clock_to_stage, frame_clock) != NULL)
|
||||||
{
|
{
|
||||||
master_clock_update_stage (master_clock, stage);
|
master_clock_update_stage (master_clock, stage);
|
||||||
master_clock_reschedule_stage_update (master_clock, stage);
|
master_clock_schedule_stage_update (master_clock, stage, frame_clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
master_clock->prev_tick = master_clock->cur_tick;
|
master_clock->prev_tick = master_clock->cur_tick;
|
||||||
@ -326,6 +334,9 @@ clutter_master_clock_gdk_add_stage_clock (ClutterMasterClockGdk *master_clock,
|
|||||||
g_signal_connect (frame_clock, "update",
|
g_signal_connect (frame_clock, "update",
|
||||||
G_CALLBACK (clutter_master_clock_gdk_update),
|
G_CALLBACK (clutter_master_clock_gdk_update),
|
||||||
master_clock);
|
master_clock);
|
||||||
|
|
||||||
|
if (master_clock->timelines != NULL)
|
||||||
|
_clutter_master_clock_start_running ((ClutterMasterClock *) clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -474,10 +485,7 @@ clutter_master_clock_gdk_add_timeline (ClutterMasterClock *clock,
|
|||||||
timeline);
|
timeline);
|
||||||
|
|
||||||
if (is_first)
|
if (is_first)
|
||||||
{
|
|
||||||
master_clock_schedule_stages_updates (master_clock);
|
|
||||||
_clutter_master_clock_start_running (clock);
|
_clutter_master_clock_start_running (clock);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -493,13 +501,13 @@ clutter_master_clock_gdk_remove_timeline (ClutterMasterClock *clock,
|
|||||||
static void
|
static void
|
||||||
clutter_master_clock_gdk_start_running (ClutterMasterClock *clock)
|
clutter_master_clock_gdk_start_running (ClutterMasterClock *clock)
|
||||||
{
|
{
|
||||||
master_clock_schedule_stages_updates ((ClutterMasterClockGdk *) clock);
|
master_clock_schedule_forced_stages_updates ((ClutterMasterClockGdk *) clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_master_clock_gdk_ensure_next_iteration (ClutterMasterClock *clock)
|
clutter_master_clock_gdk_ensure_next_iteration (ClutterMasterClock *clock)
|
||||||
{
|
{
|
||||||
master_clock_schedule_stages_updates ((ClutterMasterClockGdk *) clock);
|
master_clock_schedule_forced_stages_updates ((ClutterMasterClockGdk *) clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user