@@ -374,7 +374,7 @@ FocusScope {
376 readonly property real virtualKeyboardHeight: root.inputMethodRect.height
376 readonly property real virtualKeyboardHeight: root.inputMethodRect.height
377− property bool anyWindowAnimating: false
377+
378 readonly property real windowDecorationHeight: units.gu(3)
378 readonly property real windowDecorationHeight: units.gu(3)
@@ -1045,7 +1045,6 @@ FocusScope {
1046 || appDelegate.fullscreen
1046 || appDelegate.fullscreen
1047 || focusAnimation.running || rightEdgeFocusAnimation.running || hidingAnimation.running
1047 || focusAnimation.running || rightEdgeFocusAnimation.running || hidingAnimation.running
1048− || priv.anyWindowAnimating // bug #1666363
1050 function close() {
1049 function close() {
1051 model.window.close();
1050 model.window.close();
@@ -1381,7 +1380,6 @@ FocusScope {
1381 requestedX: root.availableDesktopArea.x;
1380 requestedX: root.availableDesktopArea.x;
1382 requestedY: 0;
1381 requestedY: 0;
1383 visuallyMinimized: false;
1382 visuallyMinimized: false;
1384− visuallyMaximized: true
1385 requestedWidth: root.availableDesktopArea.width;
1383 requestedWidth: root.availableDesktopArea.width;
1386 requestedHeight: appContainer.height;
1384 requestedHeight: appContainer.height;
@@ -1404,7 +1402,6 @@ FocusScope {
1404 PropertyChanges {
1402 PropertyChanges {
1405 target: appDelegate
1403 target: appDelegate
1406 visuallyMinimized: false
1404 visuallyMinimized: false
1407− visuallyMaximized: false
1409 PropertyChanges { target: touchControls; enabled: true }
1406 PropertyChanges { target: touchControls; enabled: true }
1410 PropertyChanges { target: resizeArea; enabled: true }
1407 PropertyChanges { target: resizeArea; enabled: true }
@@ -1597,12 +1594,18 @@ FocusScope {
1597 to: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1594 to: ",normal,restored,maximized,maximizedLeft,maximizedRight,maximizedTopLeft,maximizedTopRight,maximizedBottomLeft,maximizedBottomRight,maximizedHorizontally,maximizedVertically,fullscreen"
1598 enabled: appDelegate.animationsEnabled
1595 enabled: appDelegate.animationsEnabled
1599 SequentialAnimation {
1596 SequentialAnimation {
1600− ScriptAction { script: { priv.anyWindowAnimating = true; } }
1597+ ScriptAction { script: {
1598+ if (appDelegate.visuallyMaximized) visuallyMaximized = false; // maximized before -> going to restored
1601 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1601 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
1602 UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,windowedX,windowedY,opacity,scale,requestedWidth,requestedHeight,windowedWidth,windowedHeight";
1602 UbuntuNumberAnimation { target: appDelegate; properties: "requestedX,requestedY,windowedX,windowedY,opacity,scale,requestedWidth,requestedHeight,windowedWidth,windowedHeight";
1603 duration: priv.animationDuration }
1603 duration: priv.animationDuration }
1604− PropertyAction { target: appDelegate; property: "visuallyMaximized" }
1605− ScriptAction { script: { fakeRectangle.stop(); priv.anyWindowAnimating = false; } }
1604+ ScriptAction { script: {
1605+ fakeRectangle.stop();
1606+ appDelegate.visuallyMaximized = appDelegate.maximized; // reflect the target state