@@ -946,19 +946,20 @@ FocusScope {
949− // queue the requests to change the window/surface state
949+ readonly property bool windowReady: clientAreaItem.surfaceInitialized
950− Timer {
950+ onWindowReadyChanged: {
951− id: delayedStateTimer
951+ if (windowReady) {
952− property int windowState: -1 // Mir::State
952+ // First, cascade the newly created window, relative to the currently/old focused window.
953− interval: 1000
953+ windowedX = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedX + units.gu(3) : (normalZ - 1) * units.gu(3)
954− onTriggered: {
954+ windowedY = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedY + units.gu(3) : normalZ * units.gu(3)
955− if (delayedStateTimer.windowState != -1) {
955+
956+ // Now load any saved state. This needs to happen *after* the cascading!
957+ var ws = WindowStateStorage.toMirState(windowStateSaver.load());
958+ if (root.mode == "windowed") {
956− if (windowedFullscreenPolicy.active) { // need to apply the windowed shell chrome policy on top the saved window state
959+ // need to apply the windowed shell chrome policy on top the saved window state
957− delayedStateTimer.windowState = windowedFullscreenPolicy.applyPolicy(delayedStateTimer.windowState, appDelegate.surface.shellChrome);
960+ ws = windowedFullscreenPolicy.applyPolicy(ws, surface.shellChrome);
959− appDelegate.window.requestState(delayedStateTimer.windowState);
960− delayedStateTimer.windowState = -1;
962+ window.requestState(ws);
@@ -969,19 +970,6 @@ FocusScope {
969 decoratedWindow.surfaceOrientationAngle = 0;
970 decoratedWindow.surfaceOrientationAngle = 0;
972− // First, cascade the newly created window, relative to the currently/old focused window.
973− windowedX = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedX + units.gu(3) : (normalZ - 1) * units.gu(3)
974− windowedY = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedY + units.gu(3) : normalZ * units.gu(3)
976− if (root.mode == "windowed") {
977− // Now load any saved state. This needs to happen *after* the cascading!
978− delayedStateTimer.windowState = WindowStateStorage.toMirState(windowStateSaver.load());
979− delayedStateTimer.restart();
981− // just load and init the windowedX/Y/Width/Height values
982− windowStateSaver.load();
985 updateQmlFocusFromMirSurfaceFocus();
973 updateQmlFocusFromMirSurfaceFocus();
987 refreshStage();
975 refreshStage();
@@ -1015,6 +1003,7 @@ FocusScope {
1015 !visuallyMinimized
1003 !visuallyMinimized
1016 && !greeter.fullyShown
1004 && !greeter.fullyShown
1017 && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
1005 && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
1019 || appDelegate.fullscreen
1008 || appDelegate.fullscreen
1020 || focusAnimation.running || rightEdgeFocusAnimation.running || hidingAnimation.running
1009 || focusAnimation.running || rightEdgeFocusAnimation.running || hidingAnimation.running
@@ -1683,16 +1672,11 @@ FocusScope {
1684 WindowedFullscreenPolicy {
1673 WindowedFullscreenPolicy {
1685 id: windowedFullscreenPolicy
1674 id: windowedFullscreenPolicy
1686− active: root.mode == "windowed"
1688 StagedFullscreenPolicy {
1676 StagedFullscreenPolicy {
1689 id: stagedFullscreenPolicy
1677 id: stagedFullscreenPolicy
1690 active: root.mode == "staged" || root.mode == "stagedWithSideStage"
1678 active: root.mode == "staged" || root.mode == "stagedWithSideStage"
1691 surface: model.window.surface
1679 surface: model.window.surface
1692− onStateRequested: {
1693− delayedStateTimer.windowState = requestedState;
1694− delayedStateTimer.restart();
1698 SpreadDelegateInputArea {
1682 SpreadDelegateInputArea {