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
This commit is contained in:
Florian Müllner 2019-07-25 12:24:50 +02:00
parent ae2af34453
commit 99b4e047dd

View File

@ -3,10 +3,12 @@
pauseTweens, resumeTweens, registerSpecialProperty, pauseTweens, resumeTweens, registerSpecialProperty,
registerSpecialPropertyModifier, registerSpecialPropertySplitter */ registerSpecialPropertyModifier, registerSpecialPropertySplitter */
const { Clutter, GLib, Shell, St } = imports.gi; const { Clutter, GLib, Shell } = imports.gi;
const Signals = imports.signals; const Signals = imports.signals;
const Tweener = imports.tweener.tweener; const Tweener = imports.tweener.tweener;
const { adjustAnimationTime } = imports.ui.environment;
// This is a wrapper around imports.tweener.tweener that adds a bit of // This is a wrapper around imports.tweener.tweener that adds a bit of
// Clutter integration. If the tweening target is a Clutter.Actor, then // Clutter integration. If the tweening target is a Clutter.Actor, then
// the tweenings will automatically be removed if the actor is destroyed. // 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) { let { time, delay } = tweeningParameters;
tweeningParameters['time'] = 0.000001; if (!isNaN(time))
tweeningParameters['delay'] = 0.000001; tweeningParameters['time'] = adjustAnimationTime(1000 * time) / 1000;
} if (!isNaN(delay))
tweeningParameters['delay'] = adjustAnimationTime(1000 * delay) / 1000;
_addHandler(target, tweeningParameters, 'onComplete', _tweenCompleted); _addHandler(target, tweeningParameters, 'onComplete', _tweenCompleted);
} }
@ -211,9 +214,6 @@ var ClutterFrameTicker = class {
} }
start() { start() {
let settings = St.Settings.get();
if (settings.slow_down_factor > 0)
Tweener.setTimeScale(1 / settings.slow_down_factor);
this._timeline.start(); this._timeline.start();
global.begin_work(); global.begin_work();
} }