@@ -1021,6 +1021,25 @@ FocusScope {
10211021 onWindowReadyChanged: {
10221022 if (windowReady) {
10231023 var loadedMirState = WindowStateStorage.toMirState(windowStateSaver.loadedState);
1024+ var state = loadedMirState;
1025+
1026+ if (window.state == Mir.FullscreenState) {
1027+ // If the app is fullscreen at startup, we should not use saved state
1028+ // Example of why: if you open game that only requests fullscreen at
1029+ // Statup, this will automaticly be set to "restored state" since
1030+ // thats the default value of stateStorage, this will result in the app
1031+ // having the "restored state" as it will not make a fullscreen
1032+ // call after the app has started.
1033+ console.log("Inital window state is fullscreen, not using saved state.");
1034+ state = window.state;
1035+ } else if (loadedMirState == Mir.FullscreenState) {
1036+ // If saved state is fullscreen, we should use app inital state
1037+ // Example of why: if you open browser with youtube video at fullscreen
1038+ // and close this app, it will be fullscreen next time you open the app.
1039+ console.log("Saved window state is fullscreen, using inital window state");
1040+ state = window.state;
1041+ }
1042+
10241043 // need to apply the shell chrome policy on top the saved window state
10251044 var policy;
10261045 if (root.mode == "windowed") {
@@ -1028,7 +1047,7 @@ FocusScope {
10281047 } else {
10291048 policy = stagedFullscreenPolicy
10301049 }
1031− window.requestState(policy.applyPolicy(loadedMirState, surface.shellChrome));
1050+ window.requestState(policy.applyPolicy(state, surface.shellChrome));
10321051 }
10331052 }
10341053