@@ -254,8 +254,8 @@ AbstractStage {
254 focus: appId === priv.focusedAppId
254 focus: appId === priv.focusedAppId
255 width: decoratedWindow.width
255 width: decoratedWindow.width
256 height: decoratedWindow.height
256 height: decoratedWindow.height
257− property alias requestedWidth: decoratedWindow.requestedWidth
257+ property int requestedWidth: -1
258− property alias requestedHeight: decoratedWindow.requestedHeight
258+ property int requestedHeight: -1
259 property alias minimumWidth: decoratedWindow.minimumWidth
259 property alias minimumWidth: decoratedWindow.minimumWidth
260 property alias minimumHeight: decoratedWindow.minimumHeight
260 property alias minimumHeight: decoratedWindow.minimumHeight
261 property alias maximumWidth: decoratedWindow.maximumWidth
261 property alias maximumWidth: decoratedWindow.maximumWidth
@@ -372,20 +372,40 @@ AbstractStage {
372 PropertyChanges {
372 PropertyChanges {
373 target: appDelegate;
373 target: appDelegate;
374 x: 0; y: 0;
374 x: 0; y: 0;
375− requestedWidth: root.width; requestedHeight: root.height;
376 visuallyMinimized: false;
375 visuallyMinimized: false;
377 visuallyMaximized: true
376 visuallyMaximized: true
379+ target: decoratedWindow
380+ requestedWidth: root.width;
381+ requestedHeight: root.height;
381 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
385 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
387+ target: appDelegate;
382− PropertyChanges { target: appDelegate; x: 0; y: PanelState.panelHeight;
389+ y: PanelState.panelHeight;
392+ target: decoratedWindow
393+ requestedWidth: root.width/2
383− requestedWidth: root.width/2; requestedHeight: root.height - PanelState.panelHeight }
394+ requestedHeight: root.height - PanelState.panelHeight
386 name: "maximizedRight"; when: appDelegate.maximizedRight && !appDelegate.minimized
398 name: "maximizedRight"; when: appDelegate.maximizedRight && !appDelegate.minimized
400+ target: appDelegate;
387− PropertyChanges { target: appDelegate; x: root.width/2; y: PanelState.panelHeight;
402+ y: PanelState.panelHeight
405+ target: decoratedWindow
406+ requestedWidth: root.width/2;
388− requestedWidth: root.width/2; requestedHeight: root.height - PanelState.panelHeight }
407+ requestedHeight: root.height - PanelState.panelHeight
391 name: "minimized"; when: appDelegate.minimized
411 name: "minimized"; when: appDelegate.minimized
@@ -405,13 +425,17 @@ AbstractStage {
405 enabled: appDelegate.animationsEnabled
425 enabled: appDelegate.animationsEnabled
406 PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
426 PropertyAction { target: appDelegate; properties: "visuallyMinimized,visuallyMaximized" }
407 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
427 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
428+ UbuntuNumberAnimation { target: decoratedWindow; properties: "requestedWidth,requestedHeight"; duration: UbuntuAnimation.FastDuration }
409 Transition {
430 Transition {
410 to: "minimized"
431 to: "minimized"
411 enabled: appDelegate.animationsEnabled
432 enabled: appDelegate.animationsEnabled
412 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
433 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
413 SequentialAnimation {
434 SequentialAnimation {
436+ UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,scale"; duration: UbuntuAnimation.FastDuration }
414− UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: UbuntuAnimation.FastDuration }
437+ UbuntuNumberAnimation { target: decoratedWindow; properties: "requestedWidth,requestedHeight"; duration: UbuntuAnimation.FastDuration }
415 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
439 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
416 ScriptAction {
440 ScriptAction {
417 script: {
441 script: {
@@ -427,7 +451,10 @@ AbstractStage {
427 enabled: appDelegate.animationsEnabled
451 enabled: appDelegate.animationsEnabled
428 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
452 PropertyAction { target: appDelegate; property: "visuallyMinimized" }
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: "visuallyMaximized" }
458 PropertyAction { target: appDelegate; property: "visuallyMaximized" }
@@ -448,6 +475,7 @@ AbstractStage {
450 WindowResizeArea {
477 WindowResizeArea {
451 objectName: "windowResizeArea"
479 objectName: "windowResizeArea"
452 target: appDelegate
480 target: appDelegate
453 minWidth: units.gu(10)
481 minWidth: units.gu(10)
@@ -458,6 +486,20 @@ AbstractStage {
458 screenHeight: root.height
486 screenHeight: root.height
460 onPressed: { ApplicationManager.focusApplication(model.appId) }
488 onPressed: { ApplicationManager.focusApplication(model.appId) }
490+ property bool saveStateOnDestruction: true
493+ onSaveWindowState: {
494+ resizeArea.saveWindowState();
495+ resizeArea.saveStateOnDestruction = false;
498+ Component.onDestruction: {
499+ if (saveStateOnDestruction) {
463 DecoratedWindow {
505 DecoratedWindow {
@@ -470,6 +512,9 @@ AbstractStage {
470 focus: true
512 focus: true
471 fullscreen: application.fullscreen
513 fullscreen: application.fullscreen
515+ requestedWidth: appDelegate.requestedWidth
516+ requestedHeight: appDelegate.requestedHeight
473 onClose: ApplicationManager.stopApplication(model.appId)
518 onClose: ApplicationManager.stopApplication(model.appId)
474 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
519 onMaximize: appDelegate.maximized || appDelegate.maximizedLeft || appDelegate.maximizedRight
475 ? appDelegate.restoreFromMaximized() : appDelegate.maximize()
520 ? appDelegate.restoreFromMaximized() : appDelegate.maximize()
@@ -485,8 +530,6 @@ AbstractStage {
485 if (!firstTimeSurface) return;
530 if (!firstTimeSurface) return;
486 firstTimeSurface = false;
531 firstTimeSurface = false;
488− console.log("FULLSCREEN CHECK", lastSurface.state, lastSurface.shellChrome)
490 if (lastSurface.state === Mir.FullscreenState &&
533 if (lastSurface.state === Mir.FullscreenState &&
491 lastSurface.shellChrome === Mir.LowChrome) {
534 lastSurface.shellChrome === Mir.LowChrome) {
492 lastSurface.state = Mir.RestoredState;
535 lastSurface.state = Mir.RestoredState;