@@ -255,8 +255,8 @@ AbstractStage {
255 focus: appId === priv.focusedAppId
255 focus: appId === priv.focusedAppId
256 width: decoratedWindow.width
256 width: decoratedWindow.width
257 height: decoratedWindow.height
257 height: decoratedWindow.height
258− property alias requestedWidth: decoratedWindow.requestedWidth
258+ property int requestedWidth: -1
259− property alias requestedHeight: decoratedWindow.requestedHeight
259+ property int requestedHeight: -1
260 property alias minimumWidth: decoratedWindow.minimumWidth
260 property alias minimumWidth: decoratedWindow.minimumWidth
261 property alias minimumHeight: decoratedWindow.minimumHeight
261 property alias minimumHeight: decoratedWindow.minimumHeight
262 property alias maximumWidth: decoratedWindow.maximumWidth
262 property alias maximumWidth: decoratedWindow.maximumWidth
@@ -369,8 +369,10 @@ AbstractStage {
369 name: "fullscreen"; when: decoratedWindow.fullscreen
369 name: "fullscreen"; when: decoratedWindow.fullscreen
370 PropertyChanges {
370 PropertyChanges {
371 target: appDelegate;
371 target: appDelegate;
372− x: 0; y: -PanelState.panelHeight
373+ y: -PanelState.panelHeight
374+ requestedWidth: appContainer.width;
373− requestedWidth: appContainer.width; requestedHeight: appContainer.height;
375+ requestedHeight: appContainer.height;
@@ -387,21 +389,42 @@ AbstractStage {
387 name: "maximized"; when: appDelegate.maximized && !appDelegate.minimized
389 name: "maximized"; when: appDelegate.maximized && !appDelegate.minimized
388 PropertyChanges {
390 PropertyChanges {
389 target: appDelegate;
391 target: appDelegate;
390− x: root.leftMargin; y: 0;
392+ x: root.leftMargin;
391− requestedWidth: appContainer.width - root.leftMargin; requestedHeight: appContainer.height;
393+ y: 0;
392 visuallyMinimized: false;
394 visuallyMinimized: false;
393 visuallyMaximized: true
395 visuallyMaximized: true
398+ target: decoratedWindow
399+ requestedWidth: appContainer.width - root.leftMargin;
400+ requestedHeight: appContainer.height;
397 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
404 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
398− PropertyChanges { target: appDelegate; x: root.leftMargin; y: PanelState.panelHeight;
408+ y: PanelState.panelHeight
411+ target: decoratedWindow
412+ requestedWidth: (appContainer.width - root.leftMargin)/2
399− requestedWidth: (appContainer.width - root.leftMargin)/2; requestedHeight: appContainer.height - PanelState.panelHeight }
413+ requestedHeight: appContainer.height - PanelState.panelHeight
402 name: "maximizedRight"; when: appDelegate.maximizedRight && !appDelegate.minimized
417 name: "maximizedRight"; when: appDelegate.maximizedRight && !appDelegate.minimized
419+ target: appDelegate;
403− PropertyChanges { target: appDelegate; x: (appContainer.width + root.leftMargin)/2; y: PanelState.panelHeight;
420+ x: (appContainer.width + root.leftMargin)/2
421+ y: PanelState.panelHeight
424+ target: decoratedWindow
425+ requestedWidth: (appContainer.width - root.leftMargin)/2
404− requestedWidth: (appContainer.width - root.leftMargin)/2; requestedHeight: appContainer.height - PanelState.panelHeight }
426+ requestedHeight: appContainer.height - PanelState.panelHeight
407 name: "minimized"; when: appDelegate.minimized
430 name: "minimized"; when: appDelegate.minimized
@@ -421,13 +444,17 @@ AbstractStage {
421 enabled: appDelegate.animationsEnabled
444 enabled: appDelegate.animationsEnabled
422 PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
445 PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
423 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
446 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
447+ UbuntuNumberAnimation { target: decoratedWindow; properties: "requestedWidth,requestedHeight"; duration: UbuntuAnimation.FastDuration }
425 Transition {
449 Transition {
426 to: "minimized"
450 to: "minimized"
427 enabled: appDelegate.animationsEnabled
451 enabled: appDelegate.animationsEnabled
428 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
452 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
429 SequentialAnimation {
453 SequentialAnimation {
455+ UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,scale"; duration: UbuntuAnimation.FastDuration }
430− UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
456+ UbuntuNumberAnimation { target: decoratedWindow; properties: "requestedWidth,requestedHeight"; duration: UbuntuAnimation.FastDuration }
431 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
458 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
432 ScriptAction {
459 ScriptAction {
433 script: {
460 script: {
@@ -443,7 +470,10 @@ AbstractStage {
443 enabled: appDelegate.animationsEnabled
470 enabled: appDelegate.animationsEnabled
444 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
471 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
445 SequentialAnimation {
472 SequentialAnimation {
474+ UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,scale"; duration: UbuntuAnimation.FastDuration }
446− UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
475+ UbuntuNumberAnimation { target: decoratedWindow; properties: "requestedWidth,requestedHeight"; duration: UbuntuAnimation.FastDuration }
447 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
477 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
@@ -458,6 +488,7 @@ AbstractStage {
460 WindowResizeArea {
490 WindowResizeArea {
461 objectName: "windowResizeArea"
492 objectName: "windowResizeArea"
462 target: appDelegate
493 target: appDelegate
463 minWidth: units.gu(10)
494 minWidth: units.gu(10)
@@ -469,6 +500,25 @@ AbstractStage {
469 leftMargin: root.leftMargin
500 leftMargin: root.leftMargin
471 onPressed: { ApplicationManager.focusApplication(model.appId) }
502 onPressed: { ApplicationManager.focusApplication(model.appId) }
504+ Component.onCompleted: {
508+ property bool saveStateOnDestruction: true
511+ onStageAboutToBeUnloaded: {
512+ resizeArea.saveWindowState();
513+ resizeArea.saveStateOnDestruction = false;
514+ fullscreenPolicy.active = false;
517+ Component.onDestruction: {
518+ if (saveStateOnDestruction) {
474 DecoratedWindow {
524 DecoratedWindow {
@@ -480,12 +530,21 @@ AbstractStage {
480 active: ApplicationManager.focusedApplicationId === model.appId
530 active: ApplicationManager.focusedApplicationId === model.appId
481 focus: true
531 focus: true
533+ requestedWidth: appDelegate.requestedWidth
534+ requestedHeight: appDelegate.requestedHeight
483 onClose: ApplicationManager.stopApplication(model.appId)
536 onClose: ApplicationManager.stopApplication(model.appId)
484 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
537 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
485 ? appDelegate.restoreFromMaximized() : appDelegate.maximize()
538 ? appDelegate.restoreFromMaximized() : appDelegate.maximize()
486 onMinimize: appDelegate.minimize()
539 onMinimize: appDelegate.minimize()
487 onDecorationPressed: { ApplicationManager.focusApplication(model.appId) }
540 onDecorationPressed: { ApplicationManager.focusApplication(model.appId) }
543+ WindowedFullscreenPolicy {
544+ id: fullscreenPolicy
546+ application: decoratedWindow.application