on xenial help sign in
w/o timer
01bfeffLukáš Tinkl
qml/Stage/ApplicationWindow.qml+1
@@ -28,6 +28,7 @@ FocusScope {
28 property bool orientationChangesEnabled: d.supportsSurfaceResize ? d.surfaceOldEnoughToBeResized : true
28 property bool orientationChangesEnabled: d.supportsSurfaceResize ? d.surfaceOldEnoughToBeResized : true
29 readonly property string title: surface && surface.name !== "" ? surface.name : d.name
29 readonly property string title: surface && surface.name !== "" ? surface.name : d.name
30 readonly property QtObject focusedSurface: d.focusedSurface.surface
30 readonly property QtObject focusedSurface: d.focusedSurface.surface
31+ readonly property alias surfaceInitialized: d.surfaceInitialized
31
32
32 // to be set from outside
33 // to be set from outside
33 property QtObject surface
34 property QtObject surface
qml/Stage/Stage.qml+14−30
@@ -946,19 +946,20 @@ FocusScope {
946 }
946 }
947 }
947 }
948
948
949− // queue the requests to change the window/surface state
949+ readonly property bool windowReady: clientAreaItem.surfaceInitialized
950− Timer {
950+ onWindowReadyChanged: {
951− id: delayedStateTimer
951+ if (windowReady) {
952− property int windowState: -1 // Mir::State
952+ // First, cascade the newly created window, relative to the currently/old focused window.
953− interval: 1000
953+ windowedX = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedX + units.gu(3) : (normalZ - 1) * units.gu(3)
954− onTriggered: {
954+ windowedY = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedY + units.gu(3) : normalZ * units.gu(3)
955− if (delayedStateTimer.windowState != -1) {
955+
956+ // Now load any saved state. This needs to happen *after* the cascading!
957+ var ws = WindowStateStorage.toMirState(windowStateSaver.load());
958+ if (root.mode == "windowed") {
956− if (windowedFullscreenPolicy.active) { // need to apply the windowed shell chrome policy on top the saved window state
959+ // need to apply the windowed shell chrome policy on top the saved window state
957− delayedStateTimer.windowState = windowedFullscreenPolicy.applyPolicy(delayedStateTimer.windowState, appDelegate.surface.shellChrome);
960+ ws = windowedFullscreenPolicy.applyPolicy(ws, surface.shellChrome);
958− }
959− appDelegate.window.requestState(delayedStateTimer.windowState);
960− delayedStateTimer.windowState = -1;
961 }
961 }
962+ window.requestState(ws);
962 }
963 }
963 }
964 }
964
965
@@ -969,19 +970,6 @@ FocusScope {
969 decoratedWindow.surfaceOrientationAngle = 0;
970 decoratedWindow.surfaceOrientationAngle = 0;
970 }
971 }
971
972
972− // First, cascade the newly created window, relative to the currently/old focused window.
973− windowedX = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedX + units.gu(3) : (normalZ - 1) * units.gu(3)
974− windowedY = priv.focusedAppDelegate ? priv.focusedAppDelegate.windowedY + units.gu(3) : normalZ * units.gu(3)
975−
976− if (root.mode == "windowed") {
977− // Now load any saved state. This needs to happen *after* the cascading!
978− delayedStateTimer.windowState = WindowStateStorage.toMirState(windowStateSaver.load());
979− delayedStateTimer.restart();
980− } else {
981− // just load and init the windowedX/Y/Width/Height values
982− windowStateSaver.load();
983− }
984−
985 updateQmlFocusFromMirSurfaceFocus();
973 updateQmlFocusFromMirSurfaceFocus();
986
974
987 refreshStage();
975 refreshStage();
@@ -1015,6 +1003,7 @@ FocusScope {
1015 !visuallyMinimized
1003 !visuallyMinimized
1016 && !greeter.fullyShown
1004 && !greeter.fullyShown
1017 && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
1005 && (priv.foregroundMaximizedAppDelegate === null || priv.foregroundMaximizedAppDelegate.normalZ <= z)
1006+ //&& windowReady
1018 )
1007 )
1019 || appDelegate.fullscreen
1008 || appDelegate.fullscreen
1020 || focusAnimation.running || rightEdgeFocusAnimation.running || hidingAnimation.running
1009 || focusAnimation.running || rightEdgeFocusAnimation.running || hidingAnimation.running
@@ -1683,16 +1672,11 @@ FocusScope {
1683
1672
1684 WindowedFullscreenPolicy {
1673 WindowedFullscreenPolicy {
1685 id: windowedFullscreenPolicy
1674 id: windowedFullscreenPolicy
1686− active: root.mode == "windowed"
1687 }
1675 }
1688 StagedFullscreenPolicy {
1676 StagedFullscreenPolicy {
1689 id: stagedFullscreenPolicy
1677 id: stagedFullscreenPolicy
1690 active: root.mode == "staged" || root.mode == "stagedWithSideStage"
1678 active: root.mode == "staged" || root.mode == "stagedWithSideStage"
1691 surface: model.window.surface
1679 surface: model.window.surface
1692− onStateRequested: {
1693− delayedStateTimer.windowState = requestedState;
1694− delayedStateTimer.restart();
1695− }
1696 }
1680 }
1697
1681
1698 SpreadDelegateInputArea {
1682 SpreadDelegateInputArea {
qml/Stage/StagedFullscreenPolicy.qml+4−6
@@ -28,13 +28,11 @@ import Unity.Application 0.1
28QtObject {
28QtObject {
29 property bool active: true
29 property bool active: true
30
30
31− signal stateRequested(int requestedState)
32−
33 property var surface: null
31 property var surface: null
34 onSurfaceChanged: {
32 onSurfaceChanged: {
35 if (!active || !surface) return;
33 if (!active || !surface) return;
36 if (surface.shellChrome === Mir.LowChrome) {
34 if (surface.shellChrome === Mir.LowChrome) {
37− stateRequested(Mir.FullscreenState);
35+ surface.requestState(Mir.FullscreenState);
38 }
36 }
39 }
37 }
40
38
@@ -43,15 +41,15 @@ QtObject {
43 onShellChromeChanged: {
41 onShellChromeChanged: {
44 if (!active || !surface) return;
42 if (!active || !surface) return;
45 if (surface.shellChrome === Mir.LowChrome) {
43 if (surface.shellChrome === Mir.LowChrome) {
46− stateRequested(Mir.FullscreenState);
44+ urface.requestState(Mir.FullscreenState);
47 } else {
45 } else {
48− stateRequested(Mir.RestoredState);
46+ surface.requestState(Mir.RestoredState);
49 }
47 }
50 }
48 }
51 onStateChanged: {
49 onStateChanged: {
52 if (!active || !surface) return;
50 if (!active || !surface) return;
53 if (surface.state === Mir.RestoredState && surface.shellChrome === Mir.LowChrome) {
51 if (surface.state === Mir.RestoredState && surface.shellChrome === Mir.LowChrome) {
54− stateRequested(Mir.FullscreenState);
52+ surface.requestState(Mir.FullscreenState);
55 }
53 }
56 }
54 }
57 }
55 }
qml/Stage/WindowedFullscreenPolicy.qml−2
@@ -22,8 +22,6 @@ import Unity.Application 0.1
22// On first surface load; if the surface is set to low chrome & fullscreen, the
22// On first surface load; if the surface is set to low chrome & fullscreen, the
23// state of the window is returned to restored.
23// state of the window is returned to restored.
24QtObject {
24QtObject {
25− property bool active: true
26−
27 function applyPolicy(surfaceState, surfaceChrome) {
25 function applyPolicy(surfaceState, surfaceChrome) {
28 if (surfaceState === Mir.FullscreenState && surfaceChrome === Mir.LowChrome) {
26 if (surfaceState === Mir.FullscreenState && surfaceChrome === Mir.LowChrome) {
29 return Mir.RestoredState;
27 return Mir.RestoredState;