1
0
Fork 0

clutter-master-clock: Don't wait for a frame if time goes backwards

If we aren't syncing to vblank or if the last dispatch didn't cause a
redraw then the master clock will try to wait at least a small amount
of time before dispatching again. However if time goes backwards then
it would not do a dispatch until time catches up again. To fix this it
know just runs a dispatch immediately if time goes backwards.

This is related to Moblin bug #3839. There was a similar fix for this
in 9dc012c07, however that only fixed the case where timelines
wouldn't update. If there are no animations running then the master
clock won't even try updating timelines until time catches up.

http://bugzilla.o-hand.com/show_bug.cgi?id=1974
This commit is contained in:
Neil Roberts 2010-02-05 21:56:31 +00:00
parent 8ac27e6070
commit 24338a7511

View file

@ -179,6 +179,17 @@ master_clock_next_frame_delay (ClutterMasterClock *master_clock)
g_source_get_current_time (master_clock->source, &now);
next = master_clock->prev_tick;
/* If time has gone backwards then there's no way of knowing how
long we should wait so let's just dispatch immediately */
if (now.tv_sec < next.tv_sec ||
(now.tv_sec == next.tv_sec && now.tv_usec <= next.tv_usec))
{
CLUTTER_NOTE (SCHEDULER, "Time has gone backwards");
return 0;
}
g_time_val_add (&next, 1000000L / (gulong) clutter_get_default_frame_rate ());
if (next.tv_sec < now.tv_sec ||