[gnome-shell/wip/exalm/gestures] A



commit 076b558b2e61e5de5db08c58b7ad1c10a010ca54
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Mon Apr 22 22:08:24 2019 +0500

    A

 js/js-resources.gresource.xml |   1 +
 js/ui/swipeTracker.js         | 310 ++++++++++++++++++++++++++++++++++++++++++
 js/ui/windowManager.js        | 271 ++++++++++++++----------------------
 js/ui/workspacesView.js       |   7 +-
 4 files changed, 413 insertions(+), 176 deletions(-)
---
diff --git a/js/js-resources.gresource.xml b/js/js-resources.gresource.xml
index b5348ddcb..aec3427e0 100644
--- a/js/js-resources.gresource.xml
+++ b/js/js-resources.gresource.xml
@@ -98,6 +98,7 @@
     <file>ui/shellEntry.js</file>
     <file>ui/shellMountOperation.js</file>
     <file>ui/slider.js</file>
+    <file>ui/swipeTracker.js</file>
     <file>ui/switcherPopup.js</file>
     <file>ui/switchMonitor.js</file>
     <file>ui/tweener.js</file>
diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js
new file mode 100644
index 000000000..7ef1e8ef3
--- /dev/null
+++ b/js/ui/swipeTracker.js
@@ -0,0 +1,310 @@
+// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
+
+const { Clutter, Gio, GObject, Shell } = imports.gi;
+
+const Signals = imports.signals;
+
+const Main = imports.ui.main;
+
+const TOUCHPAD_BASE_DISTANCE = 400;
+const SCROLL_MULTIPLIER = 10;
+
+const MIN_ANIMATION_DURATION = 0.1;
+const MAX_ANIMATION_DURATION = 0.4;
+const CANCEL_AREA = 0.5;
+const VELOCITY_THRESHOLD = 0.001;
+const DURATION_MULTIPLIER = 3;
+const ANIMATION_BASE_VELOCITY = 0.002;
+
+var State = {
+    NONE: 0,
+    SCROLLING: 1,
+};
+
+function clamp(value, min, max) {
+    return Math.max(min, Math.min(max, value));
+}
+
+// TODO: support scrolling
+// TODO: support dragging
+// TODO: support horizontal
+
+var TouchpadSwipeGesture = class TouchpadSwipeGesture {
+    constructor(actor) {
+        this._touchpadSettings = new Gio.Settings({schema_id: 'org.gnome.desktop.peripherals.touchpad'});
+
+        actor.connect('captured-event', this._handleEvent.bind(this));
+    }
+
+    _handleEvent(actor, event) {
+        if (event.type() != Clutter.EventType.TOUCHPAD_SWIPE)
+            return Clutter.EVENT_PROPAGATE;
+
+        if (event.get_touchpad_gesture_finger_count() != 4)
+            return Clutter.EVENT_PROPAGATE;
+
+//        if ((this._allowedModes & Main.actionMode) == 0 || !this._enabled)
+//            return Clutter.EVENT_PROPAGATE;
+
+        let time = event.get_time();
+        let [dx, dy] = event.get_gesture_motion_delta();
+
+        if (event.get_gesture_phase() == Clutter.TouchpadGesturePhase.UPDATE) {
+            if(!(this._touchpadSettings.get_boolean('natural-scroll'))) {
+                dx = -dx;
+                dy = -dy;
+            }
+            this.emit('update', time, -dy / TOUCHPAD_BASE_DISTANCE);
+        } else if (event.get_gesture_phase() == Clutter.TouchpadGesturePhase.END ||
+                   event.get_gesture_phase() == Clutter.TouchpadGesturePhase.CANCEL)
+            this.emit('end', time);
+
+        return Clutter.EVENT_STOP;
+    }
+};
+Signals.addSignalMethods(TouchpadSwipeGesture.prototype);
+
+var TouchSwipeGesture = GObject.registerClass({
+    Signals: { 'update': { param_types: [GObject.TYPE_UINT, GObject.TYPE_DOUBLE] },
+               'end':    { param_types: [GObject.TYPE_UINT] },
+               'cancel': { param_types: [GObject.TYPE_UINT] }},
+}, class TouchSwipeGesture extends Clutter.GestureAction {
+    _init(actor) {
+        super._init();
+        this.set_n_touch_points(4);
+
+        this._actor = actor;
+    }
+
+    vfunc_gesture_begin(actor, point) {
+        if (!super.vfunc_gesture_begin(actor, point))
+            return false;
+
+        return true; //(this._allowedModes & Main.actionMode) != 0 && this._enabled;
+    }
+
+    // TODO: track center of the fingers instead of the first one
+    vfunc_gesture_progress(actor, point) {
+        if (point != 0)
+            return;
+
+        let [distance, dx, dy] = this.get_motion_delta(0);
+        let time = this.get_last_event(point).get_time();
+
+        this.emit('update', time, -dy / (global.screen_height - Main.panel.height)); // TODO: the height 
isn't always equal to the actor height
+    }
+
+    vfunc_gesture_end(actor, point) {
+        let time = this.get_last_event(point).get_time();
+
+        this.emit('end', time);
+    }
+
+    vfunc_gesture_cancel(actor) {
+        let time = Clutter.get_current_event_time();
+
+        this.emit('cancel', time);
+    }
+});
+
+// USAGE:
+//
+// To correctly implement the gesture, the implementer must implement handlers for the
+// following four signals with the following behavior:
+//
+// begin(tracker)
+//   The handler should check whether a deceleration animation is currently
+//   running. If it is, it should stop the animation (without resetting progress)
+//   and call tracker.continueFrom(progress). Otherwise it should initialize the gesture.
+//
+// update(tracker, progress)
+//   The handler should set the progress to the given value.
+//
+// end(tracker, duration, isBack)
+//   The handler should animate the progress to 1 if isBack is true, or to -1 otherwise.
+//   When the animation ends, it should change the state, e.g. change the current page
+//   or switch workspace.
+//
+// cancel(tracker, duration)
+//   The tracker should animate the progress back to 0 and forget about the gesture
+//   NOTE: duration can be 0 in some cases, in this case it should reset instantly.
+//
+// ======================================================================================
+//
+// 'can_swipe_back' and 'can_swipe_forward'
+//   These properties can be used to disable swiping back from the first page or forward from the last page.
+//
+// 'enabled'
+//   This property can be used to enable or disable the swipe tracker temporarily.
+
+var SwipeTracker = class {
+    constructor(actor, allowedModes) {
+        this.actor = actor;
+        this._allowedModes = allowedModes;
+        this._enabled = true;
+
+        this._reset();
+
+        this._can_swipe_back = true;
+        this._can_swipe_forward = true;
+
+        let gesture = new TouchpadSwipeGesture(actor);
+        gesture.connect('update', this._updateGesture.bind(this));
+        gesture.connect('end', this._endGesture.bind(this));
+//        gesture.connect('cancel', this._cancelGesture.bind(this)); // End the gesture normally for 
touchpads
+
+        gesture = new TouchSwipeGesture(actor);
+        gesture.connect('update', this._updateGesture.bind(this));
+        gesture.connect('end', this._endGesture.bind(this));
+        gesture.connect('cancel', this._cancelGesture.bind(this));
+        actor.add_action(gesture);
+    }
+
+    get enabled() {
+        return this._enabled;
+    }
+
+    set enabled(enabled) {
+        if (this._enabled == enabled)
+            return;
+
+        this._enabled = enabled;
+        if (!enabled && this._state == State.SCROLLING)
+            this._cancel();
+    }
+
+    get can_swipe_back() {
+        return this._can_swipe_back;
+    }
+
+    set can_swipe_back(can_swipe_back) {
+        this._can_swipe_back = can_swipe_back;
+        if (!can_swipe_back && this._progress > 0)
+            this._cancel();
+    }
+
+    get can_swipe_forward() {
+        return this._can_swipe_forward;
+    }
+
+    set can_swipe_forward(can_swipe_forward) {
+        this._can_swipe_forward = can_swipe_forward;
+        if (!can_swipe_forward && this._progress < 0)
+            this._cancel();
+    }
+
+    _reset() {
+        this._state = State.NONE;
+
+        this._prevOffset = 0;
+
+        this._progress = 0;
+
+        this._prevTime = 0;
+        this._velocity = 0;
+
+        this._cancelled = false;
+    }
+
+    _cancel() {
+        this.emit('cancel', 0);
+        this._reset();
+    }
+
+    _beginGesture(gesture, time) {
+        if (this._state == State.SCROLLING)
+            return;
+
+        this._prevTime = time;
+        this.emit('begin');
+        this._state = State.SCROLLING;
+    }
+
+    _updateGesture(gesture, time, delta) {
+        if ((this._allowedModes & Main.actionMode) == 0 || !this._enabled)
+            return;
+
+        if (this._state != State.SCROLLING)
+            this._beginGesture(gesture, time);
+
+        this._progress += delta;
+
+        if (time != this._prevTime)
+            this._velocity = delta / (time - this._prevTime);
+
+        if (this._progress > 0 && !this.can_swipe_back)
+            this._progress = 0;
+        if (this._progress < 0 && !this.can_swipe_forward)
+            this._progress = 0;
+
+        let maxProgress = (this._progress > 0) ? 1 : 0;
+        let minProgress = (this._progress < 0) ? -1 : 0;
+        this._progress = clamp(this._progress, minProgress, maxProgress);
+
+        this.emit('update', this._progress);
+
+        this._prevTime = time;
+    }
+
+    _shouldCancel() {
+        if (this._cancelled)
+            return true;
+
+        if (this._progress == 0)
+            return true;
+
+        if (this._progress > 0 && !this.can_swipe_back)
+            return true;
+
+        if (this._progress < 0 && !this.can_swipe_forward)
+            return true;
+
+        if (Math.abs(this._velocity) < VELOCITY_THRESHOLD)
+            return Math.abs(this._progress) < CANCEL_AREA;
+
+        return (this._velocity * this._progress < 0);
+    }
+
+    _endGesture(gesture, time) {
+        if ((this._allowedModes & Main.actionMode) == 0 || !this._enabled)
+            return;
+
+        if (this._state != State.SCROLLING)
+            return;
+
+        let cancelled = this._shouldCancel();
+
+        let endProgress = 0;
+        if (!cancelled)
+            endProgress = (this._progress > 0) ? 1 : -1;
+
+        let velocity = ANIMATION_BASE_VELOCITY;
+        if ((endProgress - this._progress) * this._velocity > 0)
+            velocity = this._velocity;
+
+        let duration = Math.abs((this._progress - endProgress) / velocity * DURATION_MULTIPLIER) / 1000;
+        duration = clamp(duration, MIN_ANIMATION_DURATION, MAX_ANIMATION_DURATION);
+
+        if (cancelled)
+            this.emit('cancel', duration);
+        else
+            this.emit('end', duration, this._progress > 0);
+        this._reset();
+    }
+
+    _cancelGesture(gesture, time) {
+        if (this._state != State.SCROLLING)
+            return;
+
+        this._cancelled = true;
+        this._endGesture(gesture, time);
+    }
+
+    continueFrom(progress) {
+        this._progress = progress;
+        this._velocity = 0;
+        this._state = State.SCROLLING;
+    }
+
+};
+Signals.addSignalMethods(SwipeTracker.prototype);
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index fa7e08fd3..b6c168d56 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -17,6 +17,7 @@ const PadOsd = imports.ui.padOsd;
 const EdgeDragAction = imports.ui.edgeDragAction;
 const CloseDialog = imports.ui.closeDialog;
 const SwitchMonitor = imports.ui.switchMonitor;
+const SwipeTracker = imports.ui.swipeTracker;
 
 const { loadInterfaceXML } = imports.misc.fileUtils;
 
@@ -456,142 +457,6 @@ var TilePreview = class {
     }
 };
 
-var TouchpadWorkspaceSwitchAction = class {
-    constructor(actor, allowedModes) {
-        this._allowedModes = allowedModes;
-        this._dx = 0;
-        this._dy = 0;
-        this._enabled = true;
-        actor.connect('captured-event', this._handleEvent.bind(this));
-       this._touchpadSettings = new Gio.Settings({schema_id: 'org.gnome.desktop.peripherals.touchpad'});
-    }
-
-    get enabled() {
-        return this._enabled;
-    }
-
-    set enabled(enabled) {
-        if (this._enabled == enabled)
-            return;
-
-        this._enabled = enabled;
-        if (!enabled)
-            this.emit('cancel');
-    }
-
-    _checkActivated() {
-        let dir;
-
-        if (this._dy < -MOTION_THRESHOLD)
-            dir = Meta.MotionDirection.DOWN;
-        else if (this._dy > MOTION_THRESHOLD)
-            dir = Meta.MotionDirection.UP;
-        else if (this._dx < -MOTION_THRESHOLD)
-            dir = Meta.MotionDirection.RIGHT;
-        else if (this._dx > MOTION_THRESHOLD)
-            dir = Meta.MotionDirection.LEFT;
-        else
-            return false;
-
-        this.emit('activated', dir);
-        return true;
-    }
-
-    _handleEvent(actor, event) {
-        if (event.type() != Clutter.EventType.TOUCHPAD_SWIPE)
-            return Clutter.EVENT_PROPAGATE;
-
-        if (event.get_touchpad_gesture_finger_count() != 4)
-            return Clutter.EVENT_PROPAGATE;
-
-        if ((this._allowedModes & Main.actionMode) == 0)
-            return Clutter.EVENT_PROPAGATE;
-
-        if (!this._enabled)
-            return Clutter.EVENT_PROPAGATE;
-
-        if (event.get_gesture_phase() == Clutter.TouchpadGesturePhase.UPDATE) {
-            let [dx, dy] = event.get_gesture_motion_delta();
-
-            // Scale deltas up a bit to make it feel snappier
-            this._dx += dx * 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()) 
||
-                event.get_gesture_phase() == Clutter.TouchpadGesturePhase.CANCEL)
-                this.emit('cancel');
-
-            this._dx = 0;
-            this._dy = 0;
-        }
-
-        return Clutter.EVENT_STOP;
-    }
-};
-Signals.addSignalMethods(TouchpadWorkspaceSwitchAction.prototype);
-
-var WorkspaceSwitchAction = GObject.registerClass({
-    Signals: { 'activated': { param_types: [Meta.MotionDirection.$gtype] },
-               'motion':    { param_types: [GObject.TYPE_DOUBLE, GObject.TYPE_DOUBLE] },
-               'cancel':    { param_types: [] }},
-}, class WorkspaceSwitchAction extends Clutter.SwipeAction {
-    _init(allowedModes) {
-        super._init();
-        this.set_n_touch_points(4);
-        this._swept = false;
-        this._allowedModes = allowedModes;
-    }
-
-    vfunc_gesture_begin(actor, point) {
-        this._swept = false;
-
-        if (!super.vfunc_gesture_begin(actor, point))
-            return false;
-
-        return (this._allowedModes & Main.actionMode);
-    }
-
-    vfunc_gesture_progress(actor, point) {
-        let [x, y] = this.get_motion_coords(0);
-        let [xPress, yPress] = this.get_press_coords(0);
-        this.emit('motion', x - xPress, y - yPress);
-    }
-
-    vfunc_gesture_cancel(actor) {
-        if (!this._swept)
-            this.emit('cancel');
-    }
-
-    vfunc_swipe(actor, direction) {
-        let [x, y] = this.get_motion_coords(0);
-        let [xPress, yPress] = this.get_press_coords(0);
-        if (Math.abs(x - xPress) < MOTION_THRESHOLD &&
-            Math.abs(y - yPress) < MOTION_THRESHOLD) {
-            this.emit('cancel');
-            return;
-        }
-
-        let dir;
-
-        if (direction & Clutter.SwipeDirection.UP)
-            dir = Meta.MotionDirection.DOWN;
-        else if (direction & Clutter.SwipeDirection.DOWN)
-            dir = Meta.MotionDirection.UP;
-        else if (direction & Clutter.SwipeDirection.LEFT)
-            dir = Meta.MotionDirection.RIGHT;
-        else if (direction & Clutter.SwipeDirection.RIGHT)
-            dir = Meta.MotionDirection.LEFT;
-
-        this._swept = true;
-        this.emit('activated', dir);
-    }
-});
-
 var AppSwitchAction = GObject.registerClass(
 class AppSwitchAction extends Clutter.GestureAction {
     _init() {
@@ -1061,16 +926,10 @@ var WindowManager = class {
                                                            false, -1, 1);
 
         let allowedModes = Shell.ActionMode.NORMAL;
-        let gesture = new WorkspaceSwitchAction(allowedModes);
-        gesture.connect('motion', this._switchWorkspaceMotion.bind(this));
-        gesture.connect('activated', this._actionSwitchWorkspace.bind(this));
-        gesture.connect('cancel', this._switchWorkspaceCancel.bind(this));
-        global.stage.add_action(gesture);
-
-        // This is not a normal Clutter.GestureAction, doesn't need add_action()
-        gesture = new TouchpadWorkspaceSwitchAction(global.stage, allowedModes);
-        gesture.connect('motion', this._switchWorkspaceMotion.bind(this));
-        gesture.connect('activated', this._actionSwitchWorkspace.bind(this));
+        let gesture = new SwipeTracker.SwipeTracker(global.stage, allowedModes);
+        gesture.connect('begin', this._switchWorkspaceBegin.bind(this));
+        gesture.connect('update', this._switchWorkspaceUpdate.bind(this));
+        gesture.connect('end', this._switchWorkspaceEnd.bind(this));
         gesture.connect('cancel', this._switchWorkspaceCancel.bind(this));
 
         gesture = new AppSwitchAction();
@@ -1112,52 +971,113 @@ var WindowManager = class {
         return this._currentPadOsd.actor;
     }
 
-    _switchWorkspaceMotion(action, xRel, yRel) {
+    _switchWorkspaceBegin(tracker) {
         let workspaceManager = global.workspace_manager;
         let activeWorkspace = workspaceManager.get_active_workspace();
 
+        if (this._switchData && this._switchData.gestureActivated) {
+            Tweener.removeTweens(this._switchData);
+            Tweener.removeTweens(this._switchData.container);
+
+            tracker.continueFrom(this._switchData.progress);
+            return;
+        }
+
+        this._prepareWorkspaceSwitch(activeWorkspace.index(), -1);
+
+        // TODO: horizontal
+        tracker.can_swipe_forward = this._switchData.surroundings[Meta.MotionDirection.UP];
+        tracker.can_swipe_back = this._switchData.surroundings[Meta.MotionDirection.DOWN];
+    }
+
+    _switchWorkspaceUpdate(tracker, progress) {
+        if (!this._switchData)
+            return;
+
+        this._switchData.progress = progress;
+        this._switchData.container.set_position(0, Math.round(-progress * (global.screen_height - 
Main.panel.height)));
+    }
+
+    _switchWorkspaceEnd(tracker, duration, isBack) {
         if (!this._switchData)
-            this._prepareWorkspaceSwitch(activeWorkspace.index(), -1);
+            return;
 
-        if (yRel < 0 && !this._switchData.surroundings[Meta.MotionDirection.DOWN])
-            yRel = 0;
-        if (yRel > 0 && !this._switchData.surroundings[Meta.MotionDirection.UP])
-            yRel = 0;
-        if (xRel < 0 && !this._switchData.surroundings[Meta.MotionDirection.RIGHT])
-            xRel = 0;
-        if (xRel > 0 && !this._switchData.surroundings[Meta.MotionDirection.LEFT])
-            xRel = 0;
+        let direction = isBack ? Meta.MotionDirection.DOWN : Meta.MotionDirection.UP;
 
-        this._switchData.container.set_position(xRel, yRel);
+        let workspaceManager = global.workspace_manager;
+        let activeWorkspace = workspaceManager.get_active_workspace();
+        let newWs = activeWorkspace.get_neighbor(direction);
+
+        if (newWs == activeWorkspace) {
+            // FIXME: throw an error
+            log('this should never happen')
+        } else {
+            this._switchData.gestureActivated = true;
+            this._switchWorkspaceAnimate(direction, duration, newWs);
+        }
     }
 
-    _switchWorkspaceCancel() {
+    _switchWorkspaceCancel(tracker, duration) {
         if (!this._switchData || this._switchData.inProgress)
             return;
+
+        if (duration == 0) {
+            this._switchData.progress = 0;
+            this._switchData.container.x = 0;
+            this._switchData.container.y = 0;
+            this._finishWorkspaceSwitch(this._switchData);
+            return;
+        }
+
         let switchData = this._switchData;
-        this._switchData = null;
+        Tweener.addTween(switchData,
+                         { progress: 0,
+                           time: duration,
+                           transition: 'easeOutCubic'
+                         });
         Tweener.addTween(switchData.container,
                          { x: 0,
                            y: 0,
-                           time: WINDOW_ANIMATION_TIME,
-                           transition: 'easeOutQuad',
+                           time: duration,
+                           transition: 'easeOutCubic',
                            onComplete: this._finishWorkspaceSwitch,
                            onCompleteScope: this,
                            onCompleteParams: [switchData],
                          });
     }
 
-    _actionSwitchWorkspace(action, direction) {
-        let workspaceManager = global.workspace_manager;
-        let activeWorkspace = workspaceManager.get_active_workspace();
-        let newWs = activeWorkspace.get_neighbor(direction);
+    _switchWorkspaceAnimate(direction, duration, newWs) {
+        let switchData = this._switchData;
 
-        if (newWs == activeWorkspace) {
-            this._switchWorkspaceCancel();
-        } else {
-            this._switchData.gestureActivated = true;
-            this.actionMoveWorkspace(newWs);
-        }
+        let oldWs = global.workspace_manager.get_active_workspace();
+        let [xDest, yDest] = this._getPositionForDirection(direction, oldWs, newWs);
+
+        xDest = -xDest;
+        yDest = -yDest;
+
+        Tweener.addTween(switchData,
+                         { progress: direction == Meta.MotionDirection.DOWN ? 1 : -1,
+                           time: duration,
+                           transition: 'easeOutCubic'
+                         });
+        Tweener.addTween(switchData.container,
+                         { x: xDest,
+                           y: yDest,
+                           time: duration,
+                           transition: 'easeOutCubic',
+                           onComplete: this._switchAndFinishWorkspaceSwitch,
+                           onCompleteScope: this,
+                           onCompleteParams: [newWs, switchData],
+                         });
+    }
+
+    _switchAndFinishWorkspaceSwitch(newWs, switchData) {
+        // We've already animated the transition, don't animate it again
+        this._blockAnimations = true;
+        this.actionMoveWorkspace(newWs);
+        this._blockAnimations = false;
+
+        this._finishWorkspaceSwitch(switchData);
     }
 
     insertWorkspace(pos) {
@@ -1880,6 +1800,7 @@ var WindowManager = class {
         switchData.surroundings = {};
         switchData.gestureActivated = false;
         switchData.inProgress = false;
+        switchData.progress = 0;
 
         switchData.container = new Clutter.Actor();
         switchData.container.add_actor(switchData.curGroup);
@@ -1975,6 +1896,7 @@ var WindowManager = class {
                 global.workspace_manager.get_active_workspace())
                 w.window.hide();
         }
+        Tweener.removeTweens(switchData);
         Tweener.removeTweens(switchData.container);
         switchData.container.destroy();
         switchData.movingWindowBin.destroy();
@@ -2008,11 +1930,16 @@ var WindowManager = class {
         xDest = -xDest;
         yDest = -yDest;
 
+        Tweener.addTween(this._switchData,
+                         { progress: direction == Meta.MotionDirection.DOWN ? 1 : -1,
+                           time: WINDOW_ANIMATION_TIME,
+                           transition: 'easeOutCubic'
+                         });
         Tweener.addTween(this._switchData.container,
                          { x: xDest,
                            y: yDest,
                            time: WINDOW_ANIMATION_TIME,
-                           transition: 'easeOutQuad',
+                           transition: 'easeOutCubic',
                            onComplete: this._switchWorkspaceDone,
                            onCompleteScope: this,
                            onCompleteParams: [shellwm]
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 53dd1dce1..f5bd44699 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -5,7 +5,6 @@ const Signals = imports.signals;
 
 const Main = imports.ui.main;
 const Tweener = imports.ui.tweener;
-const WindowManager = imports.ui.windowManager;
 const Workspace = imports.ui.workspace;
 
 var WORKSPACE_SWITCH_TIME = 0.25;
@@ -465,7 +464,7 @@ var WorkspacesDisplay = class {
         this.actor.bind_property('mapped', panAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
 
         let allowedModes = Shell.ActionMode.OVERVIEW;
-        let switchGesture = new WindowManager.WorkspaceSwitchAction(allowedModes);
+/*        let switchGesture = new WindowManager.WorkspaceSwitchAction(allowedModes);
         switchGesture.connect('motion', this._onSwitchWorkspaceMotion.bind(this));
         switchGesture.connect('activated', this._onSwitchWorkspaceActivated.bind(this));
         switchGesture.connect('cancel', this._endTouchGesture.bind(this));
@@ -478,12 +477,12 @@ var WorkspacesDisplay = class {
         switchGesture.connect('cancel', this._endTouchGesture.bind(this));
         this.actor.connect('notify::mapped', () => {
             switchGesture.enabled = this.actor.mapped;
-        });
+        });*/
 
         this._primaryIndex = Main.layoutManager.primaryIndex;
 
         this._workspacesViews = [];
-        switchGesture.enabled = this.actor.mapped;
+//        switchGesture.enabled = this.actor.mapped;
 
         this._settings = new Gio.Settings({ schema_id: MUTTER_SCHEMA });
         this._settings.connect('changed::workspaces-only-on-primary',


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