@@ -1021,6 +1021,25 @@ FocusScope {
1021 onWindowReadyChanged: {
1021 onWindowReadyChanged: {
1022 if (windowReady) {
1022 if (windowReady) {
1023 var loadedMirState = WindowStateStorage.toMirState(windowStateSaver.loadedState);
1023 var loadedMirState = WindowStateStorage.toMirState(windowStateSaver.loadedState);
1024+ var state = loadedMirState;
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;
1024 // need to apply the shell chrome policy on top the saved window state
1043 // need to apply the shell chrome policy on top the saved window state
1025 var policy;
1044 var policy;
1026 if (root.mode == "windowed") {
1045 if (root.mode == "windowed") {
@@ -1028,7 +1047,7 @@ FocusScope {
1028 } else {
1047 } else {
1029 policy = stagedFullscreenPolicy
1048 policy = stagedFullscreenPolicy
1031− window.requestState(policy.applyPolicy(loadedMirState, surface.shellChrome));
1050+ window.requestState(policy.applyPolicy(state, surface.shellChrome));