diff options
author | Matt Watson <mattdangerw@gmail.com> | 2016-03-14 03:38:23 -0700 |
---|---|---|
committer | Matt Watson <mattdangerw@gmail.com> | 2016-04-08 16:09:29 -0700 |
commit | f2979323bfea80f57fa66264fcfd757e828f083b (patch) | |
tree | 2534cffd2afd4092d8b43fdc3fcd912417009c91 /gtk/gtkprogresstracker.c | |
parent | e71d09e9cb37a60a026bc39048d0e6ea14394f90 (diff) | |
download | gtk+-f2979323bfea80f57fa66264fcfd757e828f083b.tar.gz |
progresstracker: add GTK_SLOWDOWN environment variable
As we consolidate widgets to use progress tracker, this will allow
us to control the speed of all animations in a centralized place
Diffstat (limited to 'gtk/gtkprogresstracker.c')
-rw-r--r-- | gtk/gtkprogresstracker.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gtk/gtkprogresstracker.c b/gtk/gtkprogresstracker.c index 277fd9a9de..c1d3f44215 100644 --- a/gtk/gtkprogresstracker.c +++ b/gtk/gtkprogresstracker.c @@ -18,6 +18,7 @@ */ #include "gtkprogresstrackerprivate.h" +#include "gtkprivate.h" #include "gtkcsseasevalueprivate.h" #include <math.h> @@ -30,8 +31,25 @@ * * Progress tracker will handle translating frame clock timestamps to a * fractional progress value for interpolating between animation targets. + * + * Progress tracker will use the GTK_SLOWDOWN environment variable to control + * the speed of animations. This can be useful for debugging. */ +static gdouble gtk_slowdown = 1.0; + +void +_gtk_set_slowdown (gdouble factor) +{ + gtk_slowdown = factor; +} + +gdouble +_gtk_get_slowdown (gdouble factor) +{ + return gtk_slowdown; +} + /** * gtk_progress_tracker_init_copy: * @source: The source progress tracker @@ -109,7 +127,7 @@ gtk_progress_tracker_advance_frame (GtkProgressTracker *tracker, return; } - delta = (frame_time - tracker->last_frame_time) / (gdouble) tracker->duration; + delta = (frame_time - tracker->last_frame_time) / gtk_slowdown / tracker->duration; tracker->last_frame_time = frame_time; tracker->iteration += delta; } |