@@ -105,15 +105,6 @@ AbstractStage {
105105 active: priv.focusedAppDelegate !== null
106106 }
107107
108− Connections {
109− target: root.topLevelSurfaceList
110− onCountChanged: {
111− if (root.state == "spread") {
112− priv.goneToSpread = false;
113− }
114− }
115− }
116−
117108 QtObject {
118109 id: priv
119110 objectName: "DesktopStagePrivate"
@@ -129,6 +120,7 @@ AbstractStage {
129120 property var foregroundMaximizedAppDelegate: null // for stuff like drop shadow and focusing maximized app by clicking panel
130121
131122 property bool goneToSpread: false
123+ property int closingIndex: -1
132124// property int animationDuration: 4000
133125 property int animationDuration: UbuntuAnimation.FastDuration
134126
@@ -446,13 +438,16 @@ AbstractStage {
446438 }
447439 z: normalZ
448440
441+ // Normally we want x/y where we request it to be. Width/height of our delegate will
442+ // match what the actual surface size is.
443+ // Don't write to those, they will be set by states
449444 x: requestedX
450445 y: requestedY
446+ width: decoratedWindow.implicitWidth
447+ height: decoratedWindow.implicitHeight
451448
452449 // requestedX/Y/width/height is what we ask the actual surface to be.
453450 // Do not write to those, they will be set by states
454− // Also do not write to the appWindow's actual x,y,width,height as they
455− // will be set by states too.
456451 property real requestedX: 0
457452 property real requestedY: 0
458453 property int requestedWidth: -1
@@ -478,8 +473,7 @@ AbstractStage {
478473
479474 }
480475
481− width: decoratedWindow.implicitWidth
482− height: decoratedWindow.implicitHeight
476+ Behavior on x { id: xBehavior; enabled: priv.closingIndex >= 0; UbuntuNumberAnimation { onRunningChanged: if (!running) priv.closingIndex = -1} }
483477
484478 Connections {
485479 target: root
@@ -1144,7 +1138,10 @@ AbstractStage {
11441138 onContainsMouseChanged: {
11451139 if (containsMouse) spreadItem.highlightedIndex = index
11461140 }
1147− onClose: model.surface.close()
1141+ onClose: {
1142+ priv.closingIndex = index
1143+ model.surface.close()
1144+ }
11481145 }
11491146
11501147// Rectangle { anchors.fill: parent; color: "blue"; opacity: .4 }