[gnome-shell/wip/exalm/gestures: 38/38] tmp: Throttle SwipeTracker updates
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/exalm/gestures: 38/38] tmp: Throttle SwipeTracker updates
- Date: Fri, 12 Jul 2019 23:44:16 +0000 (UTC)
commit e7ceffffc440f9926574c7fea67a6b766a7e4870
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 | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js
index c876fd2f5..cd127ebe9 100644
--- a/js/ui/swipeTracker.js
+++ b/js/ui/swipeTracker.js
@@ -266,6 +266,8 @@ var SwipeTracker = class {
scrollGesture.connect('update', this._updateGesture.bind(this));
scrollGesture.connect('end', this._endGesture.bind(this));
}
+
+ this._prevUpdate = 0;
}
get enabled() {
@@ -334,7 +336,13 @@ var SwipeTracker = class {
// Clamp progress to [0,1]
let progress = this._progress / (1 + (this._progress > 0 ? this._backExtent : this._forwardExtent) /
this._distance);
- this.emit('update', progress);
+
+ if (this._prevUpdate != 0)
+ Meta.later_remove(this._prevUpdate);
+ this._prevUpdate = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
+ this.emit('update', progress);
+ this._prevUpdate = 0;
+ });
this._prevTime = time;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]