[gnome-builder] egg: always use current monotonic time for animation start



commit a054e31dccb10219e3cddb2fab58123db6f7d457
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 ad01b16..fa8aacf 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]