From 99b4e047ddc836e715214201d14a65cafdb40e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Thu, 25 Jul 2019 12:24:50 +0200 Subject: [PATCH] tweener: Use new adjustAnimationTime() helper Now that we have a new helper function for adjusting animation times, make Tweener use it so that we keep the code in a single place. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/22 --- js/ui/tweener.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/js/ui/tweener.js b/js/ui/tweener.js index d9fab4f6a..221438c1b 100644 --- a/js/ui/tweener.js +++ b/js/ui/tweener.js @@ -3,10 +3,12 @@ pauseTweens, resumeTweens, registerSpecialProperty, registerSpecialPropertyModifier, registerSpecialPropertySplitter */ -const { Clutter, GLib, Shell, St } = imports.gi; +const { Clutter, GLib, Shell } = imports.gi; const Signals = imports.signals; const Tweener = imports.tweener.tweener; +const { adjustAnimationTime } = imports.ui.environment; + // This is a wrapper around imports.tweener.tweener that adds a bit of // Clutter integration. If the tweening target is a Clutter.Actor, then // the tweenings will automatically be removed if the actor is destroyed. @@ -50,10 +52,11 @@ function _wrapTweening(target, tweeningParameters) { } } - if (!St.Settings.get().enable_animations) { - tweeningParameters['time'] = 0.000001; - tweeningParameters['delay'] = 0.000001; - } + let { time, delay } = tweeningParameters; + if (!isNaN(time)) + tweeningParameters['time'] = adjustAnimationTime(1000 * time) / 1000; + if (!isNaN(delay)) + tweeningParameters['delay'] = adjustAnimationTime(1000 * delay) / 1000; _addHandler(target, tweeningParameters, 'onComplete', _tweenCompleted); } @@ -211,9 +214,6 @@ var ClutterFrameTicker = class { } start() { - let settings = St.Settings.get(); - if (settings.slow_down_factor > 0) - Tweener.setTimeScale(1 / settings.slow_down_factor); this._timeline.start(); global.begin_work(); }