[gnome-shell/wip/exalm/swipes: 6/8] swipeTracker: Use unaccelerated deltas




commit f80df4c2e7b91acef0c18d39342a67270ab863f4
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Sun Feb 28 18:59:31 2021 +0500

    swipeTracker: Use unaccelerated deltas
    
    Unaccelerated deltas make sure the gesture works the same regardless of how
    fast the fingers move; this is what we were already doing for scrolling.
    
    Remove the swipe multiplier, as unaccelerated deltas are already comparable
    to scroll other than the 1/10 multiplier Clutter applies to scroll deltas.
    
    Requires https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/586

 js/ui/swipeTracker.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js
index 1bd8a69c9d..5dc3c12b06 100644
--- a/js/ui/swipeTracker.js
+++ b/js/ui/swipeTracker.js
@@ -16,7 +16,6 @@ const TOUCHPAD_BASE_WIDTH = 400;
 const EVENT_HISTORY_THRESHOLD_MS = 150;
 
 const SCROLL_MULTIPLIER = 10;
-const SWIPE_MULTIPLIER = 0.5;
 
 const MIN_ANIMATION_DURATION = 100;
 const MAX_ANIMATION_DURATION = 400;
@@ -135,7 +134,7 @@ const TouchpadSwipeGesture = GObject.registerClass({
         let time = event.get_time();
 
         let [x, y] = event.get_coords();
-        let [dx, dy] = event.get_gesture_motion_delta();
+        const [dx, dy] = event.get_gesture_motion_delta_unaccelerated();
 
         if (this._state === TouchpadState.NONE && dx === 0 && dy === 0)
             return Clutter.EVENT_PROPAGATE;
@@ -155,7 +154,7 @@ const TouchpadSwipeGesture = GObject.registerClass({
         }
 
         const vertical = this.orientation === Clutter.Orientation.VERTICAL;
-        let delta = (vertical ? dy : dx) * SWIPE_MULTIPLIER;
+        let delta = vertical ? dy : dx;
         const distance = vertical ? TOUCHPAD_BASE_HEIGHT : TOUCHPAD_BASE_WIDTH;
 
         switch (event.get_gesture_phase()) {


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