[gnome-shell/gnome-3-30] windowManager: make TouchpadWorkspaceSwitchAction respect natural-scroll



commit 9b9599515a814635bd9d697022e71d9498522525
Author: Erik Duxstad <eduxstad gmail com>
Date:   Mon Nov 5 23:13:26 2018 +0000

    windowManager: make TouchpadWorkspaceSwitchAction respect natural-scroll
    
    Instead of defaulting to a natural scroll behavior,
    have the workspace switch action use the natural-scroll setting
    in org.gnome.peripherals.touchpad to determine the correct
    direction of travel when swiping. 4 finger swipes will then
    match the behavior of the rest of the UI.
    
    Reference: https://gitlab.gnome.org/GNOME/gnome-shell/issues/516
    
    
    (cherry picked from commit 118cab176623ced5d169d8363d4f4c6433d8c21f)

 js/ui/windowManager.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index cfcfa3fcb..adfee93a9 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -478,6 +478,7 @@ var TouchpadWorkspaceSwitchAction = new Lang.Class({
         this._dx = 0;
         this._dy = 0;
         actor.connect('captured-event', this._handleEvent.bind(this));
+       this._touchpadSettings = new Gio.Settings({schema_id: 'org.gnome.desktop.peripherals.touchpad'});
     },
 
     _checkActivated() {
@@ -515,7 +516,11 @@ var TouchpadWorkspaceSwitchAction = new Lang.Class({
 
             // Scale deltas up a bit to make it feel snappier
             this._dx += dx * 2;
-            this._dy += dy * 2;
+           if(!(this._touchpadSettings.get_boolean('natural-scroll'))) 
+               this._dy -= dy * 2;
+           else
+               this._dy += dy * 2;
+           
             this.emit('motion', this._dx, this._dy);
         } else {
             if ((event.get_gesture_phase() == Clutter.TouchpadGesturePhase.END && ! this._checkActivated()) 
||


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