environment: Support slow down factor when easing

Being able to slow down animations is a helpful debugging tool; to not
lose it when starting to use Clutter's implicit animations, monkey-patch
the appropriate methods to support our global slow down factor.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/22
This commit is contained in:
Florian Müllner 2014-06-05 00:13:14 +02:00
parent b197a1affb
commit 94f12fa764

View File

@ -57,6 +57,10 @@ function _patchLayoutClass(layoutClass, styleProps) {
};
}
function _adjustEasingTime(msecs) {
return St.get_slow_down_factor() * msecs;
}
function _loggingFunc() {
let fields = {'MESSAGE': [].join.call(arguments, ', ')};
let domain = "GNOME Shell";
@ -93,6 +97,15 @@ function init() {
column_spacing: 'spacing-columns' });
_patchLayoutClass(Clutter.BoxLayout, { spacing: 'spacing' });
let origSetEasingDuration = Clutter.Actor.prototype.set_easing_duration;
Clutter.Actor.prototype.set_easing_duration = function(msecs) {
origSetEasingDuration.call(this, _adjustEasingTime(msecs));
};
let origSetEasingDelay = Clutter.Actor.prototype.set_easing_delay;
Clutter.Actor.prototype.set_easing_delay = function(msecs) {
origSetEasingDelay.call(this, _adjustEasingTime(msecs));
};
Clutter.Actor.prototype.toString = function() {
return St.describe_actor(this);
};