[gnome-shell/wip/exalm/gestures: 6/21] c



commit 090bfe153a8b6be1ff25604c4cdddd2511df03a0
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Sat Jun 22 20:50:31 2019 +0500

    c

 js/ui/swipeTracker.js  | 10 ++--------
 js/ui/windowManager.js | 32 +++++++++++++++-----------------
 2 files changed, 17 insertions(+), 25 deletions(-)
---
diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js
index 250b833d2..078065cc3 100644
--- a/js/ui/swipeTracker.js
+++ b/js/ui/swipeTracker.js
@@ -7,7 +7,7 @@ const Signals = imports.signals;
 const Main = imports.ui.main;
 
 const TOUCHPAD_BASE_DISTANCE = 400;
-const SCROLL_MULTIPLIER = 10;
+const SCROLL_MULTIPLIER = 1;
 
 const MIN_ANIMATION_DURATION = 0.1;
 const MAX_ANIMATION_DURATION = 0.4;
@@ -65,9 +65,6 @@ var SwipeTracker = class {
     }
 
     set can_swipe_back(can_swipe_back) {
-        if (this._can_swipe_back == can_swipe_back)
-            return;
-
         this._can_swipe_back = can_swipe_back;
         if (!can_swipe_back && this._progress > 0)
             this._cancel();
@@ -78,9 +75,6 @@ var SwipeTracker = class {
     }
 
     set can_swipe_forward(can_swipe_forward) {
-        if (this._can_swipe_forward == can_swipe_forward)
-            return;
-
         this._can_swipe_forward = can_swipe_forward;
         if (!can_swipe_forward && this._progress < 0)
             this._cancel();
@@ -202,7 +196,7 @@ var SwipeTracker = class {
         }
 
         this.emit('end', cancelled, duration);
-        this.reset();
+        this._reset();
     }
 };
 Signals.addSignalMethods(SwipeTracker.prototype);
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index af3a9e2d8..79a8ee03b 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -1078,6 +1078,7 @@ var WindowManager = class {
         gesture.connect('begin', this._switchWorkspaceBegin.bind(this));
         gesture.connect('update', this._switchWorkspaceUpdate.bind(this));
         gesture.connect('end', this._switchWorkspaceEnd.bind(this));
+        this._swipeTracker = gesture;
 
         gesture = new AppSwitchAction();
         global.stage.add_action(gesture);
@@ -1118,31 +1119,26 @@ var WindowManager = class {
         return this._currentPadOsd.actor;
     }
 
-    _switchWorkspaceBegin() {
+    _switchWorkspaceBegin(tracker) {
         let workspaceManager = global.workspace_manager;
         let activeWorkspace = workspaceManager.get_active_workspace();
 
         if (!this._switchData)
             this._prepareWorkspaceSwitch(activeWorkspace.index(), -1);
+
+        // TODO: horizontal
+        this._swipeTracker.can_swipe_forward = this._switchData.surroundings[Meta.MotionDirection.UP];
+        this._swipeTracker.can_swipe_back = this._switchData.surroundings[Meta.MotionDirection.DOWN];
     }
 
-    _switchWorkspaceUpdate(progress) {
+    _switchWorkspaceUpdate(tracker, progress) {
         if (!this._switchData)
             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;
-
-        this._switchData.container.set_position(xRel, yRel);
+        this._switchData.container.set_position(0, -progress * 1080);
     }
 
-    _switchWorkspaceEnd(cancelled, duration) {
+    _switchWorkspaceEnd(tracker, cancelled, duration) {
         if (!this._switchData)
             return;
 
@@ -1161,7 +1157,7 @@ var WindowManager = class {
             this.actionMoveWorkspace(newWs);
         }
     }
-
+/*
     _switchWorkspaceMotion(action, xRel, yRel) {
         let workspaceManager = global.workspace_manager;
         let activeWorkspace = workspaceManager.get_active_workspace();
@@ -1180,7 +1176,7 @@ var WindowManager = class {
 
         this._switchData.container.set_position(xRel, yRel);
     }
-
+*/
     _switchWorkspaceCancel() {
         if (!this._switchData || this._switchData.inProgress)
             return;
@@ -1196,7 +1192,7 @@ var WindowManager = class {
                            onCompleteParams: [switchData],
                          });
     }
-
+/*
     _actionSwitchWorkspace(action, direction) {
         let workspaceManager = global.workspace_manager;
         let activeWorkspace = workspaceManager.get_active_workspace();
@@ -1209,7 +1205,7 @@ var WindowManager = class {
             this.actionMoveWorkspace(newWs);
         }
     }
-
+*/
     insertWorkspace(pos) {
         let workspaceManager = global.workspace_manager;
 
@@ -1930,6 +1926,8 @@ var WindowManager = class {
         switchData.surroundings = {};
         switchData.gestureActivated = false;
         switchData.inProgress = false;
+        switchData.xPos = 0;
+        switchData.yPos = 0;
 
         switchData.container = new Clutter.Actor();
         switchData.container.add_actor(switchData.curGroup);


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