diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 3e954f4b3..e2e461d23 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -121,15 +121,33 @@ const WindowClone = new Lang.Class({ return this._slot; }, + // Find the actor just below us, respecting reparenting done + // by DND code + getActualStackAbove: function() { + if (this._stackAbove == null) + return null; + + if (this.inDrag || this._zooming) { + if (this._stackAbove._delegate) + return this._stackAbove._delegate.getActualStackAbove(); + else + return null; + } else { + return this._stackAbove; + } + }, + setStackAbove: function (actor) { this._stackAbove = actor; if (this.inDrag) // We'll fix up the stack after the drag return; - if (this._stackAbove == null) + + let actualAbove = this.getActualStackAbove(); + if (actualAbove == null) this.actor.lower_bottom(); else - this.actor.raise(this._stackAbove); + this.actor.raise(actualAbove); }, destroy: function () { diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index 540f3d30d..4537b92c6 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -62,12 +62,35 @@ const WindowClone = new Lang.Class({ this.inDrag = false; }, + // Find the actor just below us, respecting reparenting done + // by DND code + getActualStackAbove: function() { + if (this._stackAbove == null) + return null; + + if (this.inDrag) { + if (this._stackAbove._delegate) + return this._stackAbove._delegate.getActualStackAbove(); + else + return null; + } else { + return this._stackAbove; + } + }, + setStackAbove: function (actor) { this._stackAbove = actor; - if (this._stackAbove == null) + + // Don't apply the new stacking now, it will be applied + // when dragging ends and window are stacked again + if (actor.inDrag) + return; + + let actualAbove = this.getActualStackAbove(); + if (actualAbove == null) this.actor.lower_bottom(); else - this.actor.raise(this._stackAbove); + this.actor.raise(actualAbove); }, destroy: function () {