@@ -947,19 +947,17 @@ FocusScope {
949 readonly property bool windowReady: clientAreaItem.surfaceInitialized
949 readonly property bool windowReady: clientAreaItem.surfaceInitialized
950+ property int requestedWindowState: Mir.RestoredState
950 onWindowReadyChanged: {
951 onWindowReadyChanged: {
951 if (windowReady) {
952 if (windowReady) {
952− // First, cascade the newly created window, relative to the currently/old focused window.
953− windowedX = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedX + units.gu(3) : (normalZ - 1) * units.gu(3)
954− windowedY = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedY + units.gu(3) : normalZ * units.gu(3)
956 // Now load any saved state. This needs to happen *after* the cascading!
953 // Now load any saved state. This needs to happen *after* the cascading!
957− var ws = WindowStateStorage.toMirState(windowStateSaver.load());
958 if (root.mode == "windowed") {
954 if (root.mode == "windowed") {
955+ var ws = requestedWindowState;
959 // need to apply the windowed shell chrome policy on top the saved window state
957 // need to apply the windowed shell chrome policy on top the saved window state
960 ws = windowedFullscreenPolicy.applyPolicy(ws, surface.shellChrome);
958 ws = windowedFullscreenPolicy.applyPolicy(ws, surface.shellChrome);
959+ window.requestState(ws);
962− window.requestState(ws);
@@ -970,6 +968,12 @@ FocusScope {
970 decoratedWindow.surfaceOrientationAngle = 0;
968 decoratedWindow.surfaceOrientationAngle = 0;
971+ // First, cascade the newly created window, relative to the currently/old focused window.
972+ windowedX = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedX + units.gu(3) : (normalZ - 1) * units.gu(3)
973+ windowedY = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedY + units.gu(3) : normalZ * units.gu(3)
975+ requestedWindowState = WindowStateStorage.toMirState(windowStateSaver.load());
973 updateQmlFocusFromMirSurfaceFocus();
977 updateQmlFocusFromMirSurfaceFocus();
975 refreshStage();
979 refreshStage();
@@ -1003,7 +1007,6 @@ FocusScope {
1003 !visuallyMinimized
1007 !visuallyMinimized
1004 && !greeter.fullyShown
1008 && !greeter.fullyShown
1005 && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
1009 && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
1008 || appDelegate.fullscreen
1011 || appDelegate.fullscreen
1009 || focusAnimation.running || rightEdgeFocusAnimation.running || hidingAnimation.running
1012 || focusAnimation.running || rightEdgeFocusAnimation.running || hidingAnimation.running