[gnome-shell/gbsneto/40-stuff: 18/68] workspacesView: Snap horizontally when dragging windows




commit b9ac7d32694ec1551fbfdaed1e2c1cc54cb677a4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Dec 29 18:51:03 2020 -0300

    workspacesView: Snap horizontally when dragging windows
    
    So that all workspaces are visible simultaneously, which allows
    moving application windows between workspaces.

 js/ui/workspacesView.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index e9493da315..131d8553fd 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -565,11 +565,30 @@ class WorkspacesDisplay extends St.Widget {
 
     _windowDragBegin() {
         this._inWindowDrag = true;
+
+        const snapTransition = this._snapAdjustment.get_transition('value');
+        this._previousSnapAxis = snapTransition
+            ? snapTransition.get_interval().peek_final_value()
+            : this._snapAdjustment.value;
+        this._snapAdjustment.ease(Clutter.Orientation.HORIZONTAL, {
+            duration: ANIMATION_TIME,
+            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+        });
+
         this._updateSwipeTracker();
     }
 
     _windowDragEnd() {
         this._inWindowDrag = false;
+
+        const snapAxis = this._previousSnapAxis;
+        delete this._previousSnapAxis;
+
+        this._snapAdjustment.ease(snapAxis, {
+            duration: ANIMATION_TIME,
+            mode: Clutter.AnimationMode.EASE_OUT_QUAD,
+        });
+
         this._updateSwipeTracker();
     }
 


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