[gnome-shell/wip/exalm/gestures: 2/6] disallow dragging outside overview



commit b0d9735f196d615b638e0c019249096873461cfe
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Fri Jun 28 17:30:18 2019 +0500

    disallow dragging outside overview

 js/ui/swipeTracker.js  | 14 ++++++++------
 js/ui/windowManager.js |  2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/swipeTracker.js b/js/ui/swipeTracker.js
index eae8e052b..c509cb407 100644
--- a/js/ui/swipeTracker.js
+++ b/js/ui/swipeTracker.js
@@ -140,7 +140,7 @@ var TouchSwipeGesture = GObject.registerClass({
 //   This property can be used to enable or disable the swipe tracker temporarily.
 
 var SwipeTracker = class {
-    constructor(actor, allowedModes) {
+    constructor(actor, allowedModes, allowDrag = true) {
         this.actor = actor;
         this._allowedModes = allowedModes;
         this._enabled = true;
@@ -164,11 +164,13 @@ var SwipeTracker = class {
         touchGesture.connect('cancel', this._cancelGesture.bind(this));
         global.stage.add_action(touchGesture);
 
-        let dragGesture = new TouchSwipeGesture(actor, shouldSkip, 1, Clutter.TriggerEdge.AFTER);
-        dragGesture.connect('update', this._updateGesture.bind(this));
-        dragGesture.connect('end', this._endGesture.bind(this));
-        dragGesture.connect('cancel', this._cancelGesture.bind(this));
-        actor.add_action(dragGesture);
+        if (allowDrag) {
+            let dragGesture = new TouchSwipeGesture(actor, shouldSkip, 1, Clutter.TriggerEdge.AFTER);
+            dragGesture.connect('update', this._updateGesture.bind(this));
+            dragGesture.connect('end', this._endGesture.bind(this));
+            dragGesture.connect('cancel', this._cancelGesture.bind(this));
+            actor.add_action(dragGesture);
+        }
     }
 
     get enabled() {
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 6c5b39323..4d44a65e8 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -926,7 +926,7 @@ var WindowManager = class {
                                                            false, -1, 1);
 
         let allowedModes = Shell.ActionMode.NORMAL;
-        let gesture = new SwipeTracker.SwipeTracker(global.stage, allowedModes);
+        let gesture = new SwipeTracker.SwipeTracker(global.stage, allowedModes, false);
         gesture.connect('begin', this._switchWorkspaceBegin.bind(this));
         gesture.connect('update', this._switchWorkspaceUpdate.bind(this));
         gesture.connect('end', this._switchWorkspaceEnd.bind(this));


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