on xenial help sign in
cascade, then onWindowReady load and apply the state
08f58a4Lukáš Tinkl
qml/Stage/ApplicationWindow.qml+1
@@ -125,6 +125,7 @@ FocusScope {
125 target: root.application
125 target: root.application
126 property: "initialSurfaceSize"
126 property: "initialSurfaceSize"
127 value: Qt.size(root.requestedWidth, root.requestedHeight)
127 value: Qt.size(root.requestedWidth, root.requestedHeight)
128+ when: d.surfaceInitialized
128 }
129 }
129
130
130 Timer {
131 Timer {
qml/Stage/Stage.qml+10−7
@@ -947,19 +947,17 @@ FocusScope {
947 }
947 }
948
948
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)
955−
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;
956+
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);
961 }
960 }
962− window.requestState(ws);
963 }
961 }
964 }
962 }
965
963
@@ -970,6 +968,12 @@ FocusScope {
970 decoratedWindow.surfaceOrientationAngle = 0;
968 decoratedWindow.surfaceOrientationAngle = 0;
971 }
969 }
972
970
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+
973 updateQmlFocusFromMirSurfaceFocus();
977 updateQmlFocusFromMirSurfaceFocus();
974
978
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)
1006− //&& windowReady
1007 )
1010 )
1008 || appDelegate.fullscreen
1011 || appDelegate.fullscreen
1009 || focusAnimation.running || rightEdgeFocusAnimation.running || hidingAnimation.running
1012 || focusAnimation.running || rightEdgeFocusAnimation.running || hidingAnimation.running
qml/Stage/WindowStateSaver.qml+1−3
@@ -41,15 +41,13 @@ QtObject {
41 (target.fullscreen ? 0 : root.leftMargin)); });
41 (target.fullscreen ? 0 : root.leftMargin)); });
42 target.windowedY = Qt.binding(function() { return Math.max(Math.min(windowGeometry.y, screenHeight - target.windowedHeight), minimumY); });
42 target.windowedY = Qt.binding(function() { return Math.max(Math.min(windowGeometry.y, screenHeight - target.windowedHeight), minimumY); });
43
43
44− var windowState = WindowStateStorage.getState(target.appId, WindowStateStorage.WindowStateNormal)
45−
46 target.updateNormalGeometry();
44 target.updateNormalGeometry();
47
45
48 // initialize the x/y to restore to
46 // initialize the x/y to restore to
49 target.restoredX = target.normalX;
47 target.restoredX = target.normalX;
50 target.restoredY = target.normalY;
48 target.restoredY = target.normalY;
51
49
52− return windowState;
50+ return WindowStateStorage.getState(target.appId, WindowStateStorage.WindowStateNormal);
53 }
51 }
54
52
55 function save() {
53 function save() {