[gnome-shell/wip/exalm/2151: 2/2] workspacesView: Disable swipe tracker during window dragging



commit 2490a2ffda3035f344fd4fa434594f504b13423f
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Wed Jan 29 00:08:32 2020 +0500

    workspacesView: Disable swipe tracker during window dragging
    
    Since a11f417cd0f9876b6e00731a6e39665d0103336f, both drag and scroll
    gestures are added to Main.layoutManager.overviewGroup actor, while
    previously drag gesture was added to Main.overview._backgroundGroup
    instead. Since we cannot use 2 different actors for dragging and scrolling
    anymore. just disable the swipe tracker while dragging a window.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/2151

 js/ui/workspacesView.js | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 2dd1ae4909..52ea5fdbf5 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -426,7 +426,14 @@ class WorkspacesDisplay extends St.Widget {
         this._swipeTracker.connect('begin', this._switchWorkspaceBegin.bind(this));
         this._swipeTracker.connect('update', this._switchWorkspaceUpdate.bind(this));
         this._swipeTracker.connect('end', this._switchWorkspaceEnd.bind(this));
-        this.bind_property('mapped', this._swipeTracker, 'enabled', GObject.BindingFlags.SYNC_CREATE);
+        this.connect('notify::mapped', this._updateSwipeTracker.bind(this));
+
+        this._windowDragBeginId =
+            Main.overview.connect('window-drag-begin',
+                this._windowDragBegin.bind(this));
+        this._windowDragEndId =
+            Main.overview.connect('window-drag-begin',
+                this._windowDragEnd.bind(this));
 
         this._primaryIndex = Main.layoutManager.primaryIndex;
         this._workspacesViews = [];
@@ -443,6 +450,7 @@ class WorkspacesDisplay extends St.Widget {
         this._scrollTimeoutId = 0;
 
         this._fullGeometry = null;
+        this._inWindowDrag = false;
 
         this._gestureActive = false; // touch(pad) gestures
         this._canScroll = true; // limiting scrolling speed
@@ -470,6 +478,22 @@ class WorkspacesDisplay extends St.Widget {
 
         global.window_manager.disconnect(this._switchWorkspaceId);
         global.workspace_manager.disconnect(this._reorderWorkspacesdId);
+        Main.overview.disconnect(this._windowDragBeginId);
+        Main.overview.disconnect(this._windowDragEndId);
+    }
+
+    _windowDragBegin() {
+        this._inWindowDrag = true;
+        this._updateSwipeTracker();
+    }
+
+    _windowDragEnd() {
+        this._inWindowDrag = false;
+        this._updateSwipeTracker();
+    }
+
+    _updateSwipeTracker() {
+        this._swipeTracker.enabled = this.mapped && !this._inWindowDrag;
     }
 
     _workspacesReordered() {


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