[gnome-shell/wip/fmuellner/ease-actors: 1/6] environment: Support slow down factor when easing



commit d019c26a6f505035cfc34baed54df49d90631454
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Jun 5 00:13:14 2014 +0200

    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.

 js/ui/environment.js | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/js/ui/environment.js b/js/ui/environment.js
index 2c2966f31..3f56aeeff 100644
--- a/js/ui/environment.js
+++ b/js/ui/environment.js
@@ -63,6 +63,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";
@@ -99,6 +103,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);
     };


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]