@@ -208,6 +208,8 @@ AbstractStage {
209 print("*** updated! MainStage:", priv.mainStageAppId, "SideStage:", priv.sideStageAppId)
209 print("*** updated! MainStage:", priv.mainStageAppId, "SideStage:", priv.sideStageAppId)
212+ property int nextInStack: 1
213 Connections {
215 Connections {
@@ -302,6 +304,7 @@ AbstractStage {
303 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
305 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
304 PropertyChanges { target: triGestureArea; enabled: true }
306 PropertyChanges { target: triGestureArea; enabled: true }
307+ PropertyChanges { target: priv; nextInStack: priv.sideStageDelegate ? 3 : 2 }
307 name: "windowed"; when: root.mode === "windowed"
310 name: "windowed"; when: root.mode === "windowed"
@@ -353,6 +356,21 @@ AbstractStage {
353 shown: false
356 shown: false
354 height: appContainer.height
357 height: appContainer.height
355 x: appContainer.width - width
358 x: appContainer.width - width
360+ if (!priv.mainStageItemId) return 0;
362+ if (priv.sideStageItemId && priv.nextInStack > 0) {
363+ var nextDelegateInStack = appRepeater.itemAt(priv.nextInStack);
365+ if (nextDelegateInStack.stage === ApplicationInfoInterface.MainStage) {
366+ // if the next app in stack is a main stage app, put the sidestage on top of it.
357 DropArea {
375 DropArea {
358 id: sideStageDropArea
376 id: sideStageDropArea
@@ -469,9 +487,10 @@ AbstractStage {
469 property bool visuallyMinimized: false
487 property bool visuallyMinimized: false
471 property int stage: ApplicationInfoInterface.MainStage
489 property int stage: ApplicationInfoInterface.MainStage
472− function saveStage(stage) {
490+ function saveStage(newStage) {
473− appDelegate.stage = stage;
491+ appDelegate.stage = newStage;
474 WindowStateStorage.saveStage(application.appId, newStage);
492 WindowStateStorage.saveStage(application.appId, newStage);
493+ priv.updateMainAndSideStageIndexes()
477 readonly property var surface: model.surface
496 readonly property var surface: model.surface
@@ -568,6 +587,12 @@ AbstractStage {
569 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
588 onVisuallyMaximizedChanged: priv.updateForegroundMaximizedApp()
591+ if (!_constructing) {
592+ priv.updateMainAndSideStageIndexes();
571// visible: (
596// visible: (
572// !visuallyMinimized
597// !visuallyMinimized
573// && !greeter.fullyShown
598// && !greeter.fullyShown
@@ -670,6 +695,8 @@ AbstractStage {
670 thisDelegate: appDelegate
695 thisDelegate: appDelegate
671 mainStageDelegate: priv.mainStageDelegate
696 mainStageDelegate: priv.mainStageDelegate
672 sideStageDelegate: priv.sideStageDelegate
697 sideStageDelegate: priv.sideStageDelegate
698+ sideStageWidth: sideStage.panelWidth
699+ sideStageX: sideStage.x
675 StagedRightEdgeMaths {
702 StagedRightEdgeMaths {
@@ -758,6 +785,7 @@ AbstractStage {
758 target: appDelegate
785 target: appDelegate
759 x: stageMaths.itemX
786 x: stageMaths.itemX
760 y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
787 y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
761 requestedWidth: stageMaths.itemWidth
789 requestedWidth: stageMaths.itemWidth
762 requestedHeight: appContainer.height - PanelState.panelHeight
790 requestedHeight: appContainer.height - PanelState.panelHeight
763 visuallyMaximized: true
791 visuallyMaximized: true
@@ -1251,4 +1279,9 @@ AbstractStage {
1284+ anchors { left: parent.left; top: parent.top; margins: units.gu(4) }
1285+ text: "sidestage z: " + sideStage.z