@@ -467,12 +467,6 @@ AbstractStage {
467 value: ApplicationManager.count + 1
467 value: ApplicationManager.count + 1
468 when: index == spread.highlightedIndex && blurLayer.ready
468 when: index == spread.highlightedIndex && blurLayer.ready
473− property: "mainAppWindowIsFullscreen"
474− value: decoratedWindow.fullscreen
477 WindowResizeArea {
471 WindowResizeArea {
478 id: resizeArea
472 id: resizeArea
@@ -490,9 +484,10 @@ AbstractStage {
490 property bool saveStateOnDestruction: true
484 property bool saveStateOnDestruction: true
491 Connections {
485 Connections {
492 target: root
486 target: root
493− onSaveWindowState: {
487+ onStageUnloaded: {
494 resizeArea.saveWindowState();
488 resizeArea.saveWindowState();
495 resizeArea.saveStateOnDestruction = false;
489 resizeArea.saveStateOnDestruction = false;
490+ fullscreenPolicy.active = false;
498 Component.onDestruction: {
493 Component.onDestruction: {
@@ -510,7 +505,6 @@ AbstractStage {
510 application: ApplicationManager.get(index)
505 application: ApplicationManager.get(index)
511 active: ApplicationManager.focusedApplicationId === model.appId
506 active: ApplicationManager.focusedApplicationId === model.appId
512 focus: true
507 focus: true
513− fullscreen: application.fullscreen
515 requestedWidth: appDelegate.requestedWidth
509 requestedWidth: appDelegate.requestedWidth
516 requestedHeight: appDelegate.requestedHeight
510 requestedHeight: appDelegate.requestedHeight
@@ -522,18 +516,10 @@ AbstractStage {
522 onDecorationPressed: { ApplicationManager.focusApplication(model.appId) }
516 onDecorationPressed: { ApplicationManager.focusApplication(model.appId) }
525− property bool firstTimeSurface: true
519+ DesktopFullscreenPolicy {
526− property var lastSurface: decoratedWindow.application && decoratedWindow.application.session ?
520+ id: fullscreenPolicy
527− decoratedWindow.application.session.lastSurface : null
522+ application: decoratedWindow.application
528− onLastSurfaceChanged: {
529− if (!lastSurface) return;
530− if (!firstTimeSurface) return;
531− firstTimeSurface = false;
533− if (lastSurface.state === Mir.FullscreenState &&
534− lastSurface.shellChrome === Mir.LowChrome) {
535− lastSurface.state = Mir.RestoredState;