[gnome-builder/gnome-builder-3-24] egg: always use current monotonic time for animation start
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-24] egg: always use current monotonic time for animation start
- Date: Sun, 16 Apr 2017 02:25:50 +0000 (UTC)
commit 7cfe02ec920f0a90f4d2b71cd4dd58e6d70c9782
Author: Christian Hergert <chergert redhat com>
Date: Sat Apr 15 19:25:09 2017 -0700
egg: always use current monotonic time for animation start
The time coming from the frame clock could be a bit outdated, so we want
to ensure we get the current time for the animation start.
This was causing some animations to complete in one frame if the clock was
frozen when we started.
contrib/egg/egg-animation.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/contrib/egg/egg-animation.c b/contrib/egg/egg-animation.c
index 295d086..8b9f7f7 100644
--- a/contrib/egg/egg-animation.c
+++ b/contrib/egg/egg-animation.c
@@ -613,9 +613,14 @@ egg_animation_start (EggAnimation *animation)
g_object_ref_sink (animation);
egg_animation_load_begin_values (animation);
+ /*
+ * We want the real current time instead of the GdkFrameClocks current time
+ * because if the clock was asleep, it could be innaccurate.
+ */
+ animation->begin_msec = g_get_monotonic_time () / 1000UL;
+
if (animation->frame_clock)
{
- animation->begin_msec = gdk_frame_clock_get_frame_time (animation->frame_clock) / 1000UL;
animation->tween_handler =
g_signal_connect (animation->frame_clock,
"update",
@@ -630,7 +635,6 @@ egg_animation_start (EggAnimation *animation)
}
else
{
- animation->begin_msec = g_get_monotonic_time () / 1000UL;
animation->tween_handler = egg_frame_source_add (FALLBACK_FRAME_RATE,
egg_animation_timeout_cb,
animation);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]