on xenial help sign in
Avoid creating yet another property in Stage.qml
416b894Daniel d'Andrada
qml/Stage/Stage.qml+6−5
@@ -947,16 +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
951 onWindowReadyChanged: {
950 onWindowReadyChanged: {
952 if (windowReady) {
951 if (windowReady) {
952+ var loadedMirState = WindowStateStorage.toMirState(windowStateSaver.loadedState);
953 // need to apply the shell chrome policy on top the saved window state
953 // need to apply the shell chrome policy on top the saved window state
954+ var policy;
954 if (root.mode == "windowed") {
955 if (root.mode == "windowed") {
955− requestedWindowState = windowedFullscreenPolicy.applyPolicy(requestedWindowState, surface.shellChrome);
956+ policy = windowedFullscreenPolicy;
956 } else {
957 } else {
957− requestedWindowState = stagedFullscreenPolicy.applyPolicy(requestedWindowState, surface.shellChrome);
958+ policy = stagedFullscreenPolicy
958 }
959 }
959− window.requestState(requestedWindowState);
960+ window.requestState(policy.applyPolicy(loadedMirState, surface.shellChrome));
960 }
961 }
961 }
962 }
962
963
@@ -971,7 +972,7 @@ FocusScope {
971 windowedX = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedX + units.gu(3) : (normalZ - 1) * units.gu(3)
972 windowedX = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedX + units.gu(3) : (normalZ - 1) * units.gu(3)
972 windowedY = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedY + units.gu(3) : normalZ * units.gu(3)
973 windowedY = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedY + units.gu(3) : normalZ * units.gu(3)
973 // Now load any saved state. This needs to happen *after* the cascading!
974 // Now load any saved state. This needs to happen *after* the cascading!
974− requestedWindowState = WindowStateStorage.toMirState(windowStateSaver.load());
975+ windowStateSaver.load();
975
976
976 updateQmlFocusFromMirSurfaceFocus();
977 updateQmlFocusFromMirSurfaceFocus();
977
978
qml/Stage/WindowStateSaver.qml+3−1
@@ -28,6 +28,8 @@ QtObject {
28 property int leftMargin: 0
28 property int leftMargin: 0
29 property int minimumY: 0
29 property int minimumY: 0
30
30
31+ property int loadedState
32+
31 function load() {
33 function load() {
32 var defaultWidth = units.gu(60);
34 var defaultWidth = units.gu(60);
33 var defaultHeight = units.gu(50);
35 var defaultHeight = units.gu(50);
@@ -47,7 +49,7 @@ QtObject {
47 target.restoredX = target.normalX;
49 target.restoredX = target.normalX;
48 target.restoredY = target.normalY;
50 target.restoredY = target.normalY;
49
51
50− return WindowStateStorage.getState(target.appId, WindowStateStorage.WindowStateNormal);
52+ loadedState = WindowStateStorage.getState(target.appId, WindowStateStorage.WindowStateNormal);
51 }
53 }
52
54
53 function save() {
55 function save() {