@@ -947,19 +947,17 @@ FocusScope {
947947 }
948948
949949 readonly property bool windowReady: clientAreaItem.surfaceInitialized
950+ property int requestedWindowState: Mir.RestoredState
950951 onWindowReadyChanged: {
951952 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)
955−
956953 // Now load any saved state. This needs to happen *after* the cascading!
957− var ws = WindowStateStorage.toMirState(windowStateSaver.load());
958954 if (root.mode == "windowed") {
955+ var ws = requestedWindowState;
956+
959957 // need to apply the windowed shell chrome policy on top the saved window state
960958 ws = windowedFullscreenPolicy.applyPolicy(ws, surface.shellChrome);
959+ window.requestState(ws);
961960 }
962− window.requestState(ws);
963961 }
964962 }
965963
@@ -970,6 +968,12 @@ FocusScope {
970968 decoratedWindow.surfaceOrientationAngle = 0;
971969 }
972970
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)
974+
975+ requestedWindowState = WindowStateStorage.toMirState(windowStateSaver.load());
976+
973977 updateQmlFocusFromMirSurfaceFocus();
974978
975979 refreshStage();
@@ -1003,7 +1007,6 @@ FocusScope {
10031007 !visuallyMinimized
10041008 && !greeter.fullyShown
10051009 && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
1006− //&& windowReady
10071010 )
10081011 || appDelegate.fullscreen
10091012 || focusAnimation.running || rightEdgeFocusAnimation.running || hidingAnimation.running