[gnome-shell] Don't rearrange dragged window when repositioning windows



commit 57432248179146955957ff35c2c2964141ebe671
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Mar 8 14:46:34 2011 +0100

    Don't rearrange dragged window when repositioning windows
    
    If we're dragging a window around and we need to reposition the windows,
    due to e.g. the sliding in of the thumbnails or some other reason, then we
    need to consider the original position of the dragged window, rather than
    the currend drag position. Otherwise we will unnecessarily rearrange the
    other windows for instance on snap-back if you moved the dragged window
    past some other window.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=643786

 js/ui/workspace.js |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index a6798ce..a2c7172 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -289,6 +289,8 @@ WindowClone.prototype = {
     },
 
     _onDragBegin : function (draggable, time) {
+        [this.dragOrigX, this.dragOrigY] = this.actor.get_position();
+        this.dragOrigScale = this.actor.scale_x;
         this.inDrag = true;
         this.emit('drag-begin');
     },
@@ -695,10 +697,20 @@ Workspace.prototype = {
         let xDelta, yDelta, distanceSquared;
         let actorWidth, actorHeight;
 
-        actorWidth = actor.width * actor.scale_x;
-        actorHeight = actor.height * actor.scale_y;
-        xDelta = actor.x + actorWidth / 2.0 - xCenter * this._width - this._x;
-        yDelta = actor.y + actorHeight / 2.0 - yCenter * this._height - this._y;
+        let x = actor.x;
+        let y = actor.y;
+        let scale = actor.scale_x;
+
+        if (actor._delegate.inDrag) {
+            x = actor._delegate.dragOrigX;
+            y = actor._delegate.dragOrigY;
+            scale = actor._delegate.dragOrigScale;
+        }
+
+        actorWidth = actor.width * scale;
+        actorHeight = actor.height * scale;
+        xDelta = x + actorWidth / 2.0 - xCenter * this._width - this._x;
+        yDelta = y + actorHeight / 2.0 - yCenter * this._height - this._y;
         distanceSquared = xDelta * xDelta + yDelta * yDelta;
 
         return distanceSquared;



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