on xenial help sign in
cascade, then onWindowReady load and apply the state
commit08f58a4e5eb70dc79e0cc525450d3ab00d479e15 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateFri 24 Feb 2017, 12:51 (10 years ago) parent01bfeff
3 files changed+12−10
qml/Stage/ApplicationWindow.qml+1 qml/Stage/Stage.qml+10−7 qml/Stage/WindowStateSaver.qml+1−3
qml/Stage/ApplicationWindow.qml+1
@@ -125,6 +125,7 @@ FocusScope {
125125 target: root.application
126126 property: "initialSurfaceSize"
127127 value: Qt.size(root.requestedWidth, root.requestedHeight)
128+ when: d.surfaceInitialized
128129 }
129130
130131 Timer {
qml/Stage/Stage.qml+10−7
@@ -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
qml/Stage/WindowStateSaver.qml+1−3
@@ -41,15 +41,13 @@ QtObject {
4141 (target.fullscreen ? 0 : root.leftMargin)); });
4242 target.windowedY = Qt.binding(function() { return Math.max(Math.min(windowGeometry.y, screenHeight - target.windowedHeight), minimumY); });
4343
44− var windowState = WindowStateStorage.getState(target.appId, WindowStateStorage.WindowStateNormal)
45−
4644 target.updateNormalGeometry();
4745
4846 // initialize the x/y to restore to
4947 target.restoredX = target.normalX;
5048 target.restoredY = target.normalY;
5149
52− return windowState;
50+ return WindowStateStorage.getState(target.appId, WindowStateStorage.WindowStateNormal);
5351 }
5452
5553 function save() {