@@ -163,6 +163,47 @@ AbstractStage {
163163 }
164164 }
165165 }
166+
167+ property var mainStageDelegate: null
168+ property var sideStageDelegate: null
169+ property int mainStageItemId: 0
170+ property int sideStageItemId: 0
171+ property string mainStageAppId: ""
172+ property string sideStageAppId: ""
173+
174+ function updateMainAndSideStageIndexes() {
175+ var choseMainStage = false;
176+ var choseSideStage = false;
177+
178+ if (!root.topLevelSurfaceList)
179+ return;
180+
181+ for (var i = 0; i < topLevelSurfaceRepeater.count && (!choseMainStage || !choseSideStage); ++i) {
182+ var appDelegate = topLevelSurfaceRepeater.itemAt(i);
183+ if (sideStage.shown && spreadDelegate.stage == ApplicationInfoInterface.SideStage
184+ && !choseSideStage) {
185+ priv.sideStageDelegate = appDelegate
186+ priv.sideStageItemId = root.topLevelSurfaceList.idAt(i);
187+ priv.sideStageAppId = root.topLevelSurfaceList.applicationAt(i).appId;
188+ choseSideStage = true;
189+ } else if (!choseMainStage && spreadDelegate.stage == ApplicationInfoInterface.MainStage) {
190+ priv.mainStageDelegate = appDelegate;
191+ priv.mainStageItemId = root.topLevelSurfaceList.idAt(i);
192+ priv.mainStageAppId = root.topLevelSurfaceList.applicationAt(i).appId;
193+ choseMainStage = true;
194+ }
195+ }
196+ if (!choseMainStage) {
197+ priv.mainStageDelegate = null;
198+ priv.mainStageItemId = 0;
199+ priv.mainStageAppId = "";
200+ }
201+ if (!choseSideStage) {
202+ priv.sideStageDelegate = null;
203+ priv.sideStageItemId = 0;
204+ priv.sideStageAppId = "";
205+ }
206+ }
166207 }
167208
168209 Connections {
@@ -254,6 +295,9 @@ AbstractStage {
254295 State {
255296 name: "staged"; when: root.mode === "staged"
256297 },
298+ State {
299+ name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
300+ },
257301 State {
258302 name: "windowed"; when: root.mode === "windowed"
259303 }
@@ -359,6 +403,8 @@ AbstractStage {
359403 property bool visuallyMaximized: false
360404 property bool visuallyMinimized: false
361405
406+ property int stage: ApplicationInfoInterface.MainStage
407+
362408 readonly property var surface: model.surface
363409 readonly property alias resizeArea: resizeArea
364410
@@ -548,6 +594,15 @@ AbstractStage {
548594 totalItems: appRepeater.count
549595 flickable: floatingFlickable
550596 }
597+ StageMaths {
598+ id: stageMaths
599+ sceneWidth: root.width
600+ stage: appDelegate.stage
601+ thisDelegate: appDelegate
602+ mainStageDelegate: priv.mainStageDelegate
603+ sideStageDelegate: priv.sideStageDelegate
604+ }
605+
551606 StagedRightEdgeMaths {
552607 id: stagedRightEdgeMaths
553608 itemIndex: index
@@ -597,7 +652,7 @@ AbstractStage {
597652 }
598653 PropertyChanges {
599654 target: decoratedWindow;
600− showDecoration: false
655+ hasDecoration: false
601656 requestedWidth: stagedRightEdgeMaths.animatedWidth
602657 requestedHeight: stagedRightEdgeMaths.animatedHeight - PanelState.panelHeight
603658// width: appContainer.width - root.leftMargin
@@ -624,6 +679,29 @@ AbstractStage {
624679 enabled: false
625680 }
626681 },
682+ State {
683+ name: "stagedWithSideStage"; when: root.state == "stagedWithSideStage"
684+ PropertyChanges {
685+ target: stageMaths
686+ itemIndex: index
687+ }
688+ PropertyChanges {
689+ target: appDelegate
690+ x: stageMaths.itemX
691+ y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
692+ requestedWidth: stageMaths.itemWidth
693+ requestedHeight: appContainer.height - PanelState.panelHeight
694+ visuallyMaximized: true
695+ }
696+ PropertyChanges {
697+ target: decoratedWindow
698+ hasDecoration: false
699+ }
700+ PropertyChanges {
701+ target: resizeArea
702+ enabled: false
703+ }
704+ },
627705 State {
628706 name: "maximized"; when: root.state === "windowed" && appDelegate.maximized && !appDelegate.minimized
629707 PropertyChanges {