[gnome-shell/wip/exalm/gestures] need to confirm swipes now



commit a4b5e749d1c4c75c592d08407c7e9b6e3715eb40
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Sun Jun 30 13:50:30 2019 +0500

    need to confirm swipes now

 js/ui/appDisplay.js     |  4 ++--
 js/ui/swipeTracker.js   | 14 +++++++++-----
 js/ui/windowManager.js  |  4 ++--
 js/ui/workspacesView.js |  8 ++++++--
 4 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 2375567d4..24e247271 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -521,13 +521,13 @@ var AllView = class AllView extends BaseAppView {
             Tweener.removeTweens(adjustment);
 
             let progress = this._adjustment.value / adjustment.page_size - this._grid.currentPage;
-            tracker.continueFrom(progress);
+            tracker.continueSwipe(progress);
             return;
         }
 
         let canSwipeForward = this._grid.currentPage > 0;
         let canSwipeBack = this._grid.currentPage < this._grid.nPages() - 1;
-        tracker.startSwipe(canSwipeBack, canSwipeForward, this._scrollView.height, 0, 0);
+        tracker.confirmSwipe(canSwipeBack, canSwipeForward, this._scrollView.height, 0, 0);
 
         this._gestureActive = true;
     }
diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js
index 4261635b4..e36e608ca 100644
--- a/js/ui/swipeTracker.js
+++ b/js/ui/swipeTracker.js
@@ -153,8 +153,8 @@ Signals.addSignalMethods(ScrollGesture.prototype);
 // 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
-//   and call tracker.startSwipe(canSwipeBack, canSwipeForward, distance, backExtent, forwardExtent).
+//   and call tracker.continueSwipe(progress). Otherwise it should initialize the gesture
+//   and call tracker.confirmSwipe(canSwipeBack, canSwipeForward, distance, backExtent, forwardExtent).
 //   The parameters are:
 //    * canSwipeBack: whether the tracker should allow to swipe back;
 //    * canSwipeForward: whether the tracker should allow to swipe forward;
@@ -270,7 +270,6 @@ var SwipeTracker = class {
 
         this._prevTime = time;
         this.emit('begin');
-        this._state = State.SCROLLING;
     }
 
     _updateGesture(gesture, time, delta) {
@@ -280,6 +279,9 @@ var SwipeTracker = class {
         if (this._state != State.SCROLLING)
             this._beginGesture(gesture, time);
 
+        if (this._state != State.SCROLLING)
+            return;
+
         this._progress += delta;
 
         if (time != this._prevTime)
@@ -357,7 +359,7 @@ var SwipeTracker = class {
         this._endGesture(gesture, time);
     }
 
-    startSwipe(canSwipeBack, canSwipeForward, distance, backExtent, forwardExtent) {
+    confirmSwipe(canSwipeBack, canSwipeForward, distance, backExtent, forwardExtent) {
         this._canSwipeBack = canSwipeBack;
         this._canSwipeForward = canSwipeForward;
         this._distance = distance;
@@ -367,9 +369,11 @@ var SwipeTracker = class {
         this._touchGesture.setDistance(distance);
         if (this._dragGesture)
             this._dragGesture.setDistance(distance);
+
+        this._state = State.SCROLLING;
     }
 
-    continueFrom(progress) {
+    continueSwipe(progress) {
         this._progress = progress;
         this._velocity = 0;
         this._state = State.SCROLLING;
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index e3e4fcc47..589fb3d98 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -979,7 +979,7 @@ var WindowManager = class {
             Tweener.removeTweens(this._switchData);
             Tweener.removeTweens(this._switchData.container);
 
-            tracker.continueFrom(this._switchData.progress);
+            tracker.continueSwipe(this._switchData.progress);
             return;
         }
 
@@ -997,7 +997,7 @@ var WindowManager = class {
         let forwardInfo = this._switchData.surroundings[direction];
         let forwardExtent = forwardInfo ? (-forwardInfo.yDest - baseDistance) : 0;
 
-        tracker.startSwipe((backInfo != null), (forwardInfo != null), baseDistance, backExtent, 
forwardExtent);
+        tracker.confirmSwipe((backInfo != null), (forwardInfo != null), baseDistance, backExtent, 
forwardExtent);
     }
 
     _switchWorkspaceUpdate(tracker, progress) {
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 49a4b1624..81433fab4 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -454,6 +454,10 @@ var WorkspacesDisplay = class {
     }
 
     _switchWorkspaceBegin(tracker) {
+//        if (this._workspacesOnlyOnPrimary &&
+//            this._getMonitorIndexForEvent(event) != this._primaryIndex)
+//            return;
+
         if (this._gestureActive) {
             let workspaceManager = global.workspace_manager;
             let active = workspaceManager.get_active_workspace_index();
@@ -462,7 +466,7 @@ var WorkspacesDisplay = class {
             Tweener.removeTweens(adjustment);
 
             let progress = adjustment.value / adjustment.page_size - active;
-            tracker.continueFrom(progress);
+            tracker.continueSwipe(progress);
             return;
         }
 
@@ -474,7 +478,7 @@ var WorkspacesDisplay = class {
 
         let canSwipeBack = (activeWs.get_neighbor(Meta.MotionDirection.DOWN) != activeWs);
         let canSwipeForward = (activeWs.get_neighbor(Meta.MotionDirection.UP) != activeWs);
-        tracker.startSwipe(canSwipeBack, canSwipeForward, this.actor.height, 0, 0);
+        tracker.confirmSwipe(canSwipeBack, canSwipeForward, this.actor.height, 0, 0);
 
         this._gestureActive = true;
     }


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