[gnome-shell/wip/exalm/gestures: 47/47] tmp: Throttle SwipeTracker updates



commit ff80b63371274ff05ef4115ef6e451d386b0e5bf
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Mon Jul 8 14:31:07 2019 +0500

    tmp: Throttle SwipeTracker updates
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/605

 js/ui/swipeTracker.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js
index a063f6434..dd753789c 100644
--- a/js/ui/swipeTracker.js
+++ b/js/ui/swipeTracker.js
@@ -264,6 +264,8 @@ var SwipeTracker = class {
             this._scrollGesture.connect('end', this._endGesture.bind(this));
         } else
             this._scrollGesture = null;
+
+        this._prevUpdate = 0;
     }
 
     get enabled() {
@@ -352,7 +354,12 @@ var SwipeTracker = class {
         this._progress = clamp(this._progress, firstPoint, lastPoint);
         this._progress = clamp(this._progress, this._initialProgress - 1, this._initialProgress + 1);
 
-        this.emit('update', this._progress);
+        if (this._prevUpdate != 0)
+            Meta.later_remove(this._prevUpdate);
+        this._prevUpdate = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
+            this.emit('update', this._progress);
+            this._prevUpdate = 0;
+        });
 
         this._prevTime = time;
     }


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