@@ -172,21 +172,23 @@ AbstractStage {
172 property string sideStageAppId: ""
172 property string sideStageAppId: ""
174 function updateMainAndSideStageIndexes() {
174 function updateMainAndSideStageIndexes() {
175+ print("updating stage indexes, sideStage shown:", sideStage.shown)
175 var choseMainStage = false;
176 var choseMainStage = false;
176 var choseSideStage = false;
177 var choseSideStage = false;
178 if (!root.topLevelSurfaceList)
179 if (!root.topLevelSurfaceList)
181− for (var i = 0; i < topLevelSurfaceRepeater.count && (!choseMainStage || !choseSideStage); ++i) {
182+ for (var i = 0; i < appRepeater.count && (!choseMainStage || !choseSideStage); ++i) {
182− var appDelegate = topLevelSurfaceRepeater.itemAt(i);
183+ var appDelegate = appRepeater.itemAt(i);
184+ print("have app on stage", appDelegate.applicationId, appDelegate.stage)
183− if (sideStage.shown && spreadDelegate.stage == ApplicationInfoInterface.SideStage
185+ if (sideStage.shown && appDelegate.stage == ApplicationInfoInterface.SideStage
184 && !choseSideStage) {
186 && !choseSideStage) {
185 priv.sideStageDelegate = appDelegate
187 priv.sideStageDelegate = appDelegate
186 priv.sideStageItemId = root.topLevelSurfaceList.idAt(i);
188 priv.sideStageItemId = root.topLevelSurfaceList.idAt(i);
187 priv.sideStageAppId = root.topLevelSurfaceList.applicationAt(i).appId;
189 priv.sideStageAppId = root.topLevelSurfaceList.applicationAt(i).appId;
188 choseSideStage = true;
190 choseSideStage = true;
189− } else if (!choseMainStage && spreadDelegate.stage == ApplicationInfoInterface.MainStage) {
191+ } else if (!choseMainStage && appDelegate.stage == ApplicationInfoInterface.MainStage) {
190 priv.mainStageDelegate = appDelegate;
192 priv.mainStageDelegate = appDelegate;
191 priv.mainStageItemId = root.topLevelSurfaceList.idAt(i);
193 priv.mainStageItemId = root.topLevelSurfaceList.idAt(i);
192 priv.mainStageAppId = root.topLevelSurfaceList.applicationAt(i).appId;
194 priv.mainStageAppId = root.topLevelSurfaceList.applicationAt(i).appId;
@@ -203,6 +205,8 @@ AbstractStage {
203 priv.sideStageItemId = 0;
205 priv.sideStageItemId = 0;
204 priv.sideStageAppId = "";
206 priv.sideStageAppId = "";
209+ print("*** updated! MainStage:", priv.mainStageAppId, "SideStage:", priv.sideStageAppId)
@@ -297,6 +301,7 @@ AbstractStage {
299 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
303 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
304+ PropertyChanges { target: triGestureArea; enabled: true }
302 name: "windowed"; when: root.mode === "windowed"
307 name: "windowed"; when: root.mode === "windowed"
@@ -304,6 +309,7 @@ AbstractStage {
305 onStateChanged: print("spread going to state:", state)
310 onStateChanged: print("spread going to state:", state)
307 FocusScope {
313 FocusScope {
308 id: appContainer
314 id: appContainer
309 objectName: "appContainer"
315 objectName: "appContainer"
@@ -318,6 +324,65 @@ AbstractStage {
318 fillMode: Image.PreserveAspectCrop
324 fillMode: Image.PreserveAspectCrop
328+ target: root.topLevelSurfaceList
329+ onListChanged: priv.updateMainAndSideStageIndexes()
334+ objectName: "MainStageDropArea"
338+ bottom: parent.bottom
340+ width: appContainer.width - sideStage.width
341+ enabled: sideStage.enabled
344+ print("dropped on main stage drop area")
345+ drop.source.appDelegate.saveStage(ApplicationInfoInterface.MainStage);
346+ drop.source.appDelegate.focus = true;
354+ height: appContainer.height
355+ x: appContainer.width - width
358+ id: sideStageDropArea
359+ objectName: "SideStageDropArea"
360+ anchors.fill: parent
362+ property bool dropAllowed: true
365+ dropAllowed = drag.keys != "Disabled";
371+ if (drop.keys == "MainStage") {
372+ drop.source.appDelegate.saveStage(ApplicationInfoInterface.SideStage);
373+ drop.source.appDelegate.focus = true;
378+ if (!sideStageDropArea.drag.source) {
321 TopLevelSurfaceRepeater {
386 TopLevelSurfaceRepeater {
322 id: appRepeater
387 id: appRepeater
323 model: topLevelSurfaceList
388 model: topLevelSurfaceList
@@ -404,6 +469,10 @@ AbstractStage {
404 property bool visuallyMinimized: false
469 property bool visuallyMinimized: false
406 property int stage: ApplicationInfoInterface.MainStage
471 property int stage: ApplicationInfoInterface.MainStage
472+ function saveStage(stage) {
473+ appDelegate.stage = stage;
474+ WindowStateStorage.saveStage(application.appId, newStage);
408 readonly property var surface: model.surface
477 readonly property var surface: model.surface
409 readonly property alias resizeArea: resizeArea
478 readonly property alias resizeArea: resizeArea
@@ -723,19 +792,13 @@ AbstractStage {
723 requestedWidth: appContainer.width;
792 requestedWidth: appContainer.width;
724 requestedHeight: appContainer.height;
793 requestedHeight: appContainer.height;
727− target: decoratedWindow
795+ PropertyChanges { target: decoratedWindow; hasDecoration: false }
728− hasDecoration: false
732 name: "normal";
798 name: "normal";
733 when: appDelegate.windowState == WindowStateStorage.WindowStateNormal
799 when: appDelegate.windowState == WindowStateStorage.WindowStateNormal
735− target: appDelegate;
736− visuallyMinimized: false;
800+ PropertyChanges { target: appDelegate; visuallyMinimized: false; visuallyMaximized: false; }
737− visuallyMaximized: false;
801+ PropertyChanges { target: touchControls; enabled: true }
741 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
804 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
@@ -842,8 +905,12 @@ AbstractStage {
842 to: "staged"
905 to: "staged"
843 UbuntuNumberAnimation { target: appDelegate; properties: "x,y"; duration: priv.animationDuration }
906 UbuntuNumberAnimation { target: appDelegate; properties: "x,y"; duration: priv.animationDuration }
844 UbuntuNumberAnimation { target: appDelegate; properties: "requestedWidth,requestedHeight"; duration: priv.animationDuration }
907 UbuntuNumberAnimation { target: appDelegate; properties: "requestedWidth,requestedHeight"; duration: priv.animationDuration }
910+ to: "stagedWithSideStage"
911+ UbuntuNumberAnimation { target: appDelegate; properties: "x,y"; duration: priv.animationDuration }
912+ UbuntuNumberAnimation { target: appDelegate; properties: "requestedWidth,requestedHeight"; duration: priv.animationDuration }
849// Binding {
916// Binding {
@@ -966,6 +1033,7 @@ AbstractStage {
966 id: touchControls
1033 id: touchControls
967 anchors.fill: appDelegate
1034 anchors.fill: appDelegate
968 target: appDelegate
1035 target: appDelegate
971 WindowedFullscreenPolicy {
1039 WindowedFullscreenPolicy {
@@ -1112,16 +1180,75 @@ AbstractStage {
1115−// DesktopSpread {
1183+ TabletSideStageTouchGesture {
1116−// id: spread
1184+ id: triGestureArea
1117−// objectName: "spread"
1118−// anchors.fill: appContainer
1185+ anchors.fill: parent
1119−// workspace: appContainer
1186+ enabled: false
1120−// focus: state == "altTab"
1187+ property Item appDelegate
1121−// altTabPressed: root.altTabPressed
1188+
1122−
1189+ dragComponent: dragComponent
1123−// onPlayFocusAnimation: {
1190+ dragComponentProperties: { "appDelegate": appDelegate }
1124−// appRepeater.itemAt(index).playFocusAnimation();
1191+
1193+ print("********* triGestureArea pressed!")
1194+ function matchDelegate(obj) { return String(obj.objectName).indexOf("appDelegate") >= 0; }
1196+ var delegateAtCenter = Functions.itemAt(appContainer, x, y, matchDelegate);
1197+ print("dragging delegate", delegateAtCenter)
1198+ if (!delegateAtCenter) return;
1200+ appDelegate = delegateAtCenter;
1204+ if (sideStage.shown) {
1212+ // If we're dragging to the sidestage.
1213+ if (!sideStage.shown) {
1221+ property Item appDelegate
1223+ surface: appDelegate ? appDelegate.surface : null
1225+ consumesInput: false
1227+// resizeSurface: false
1229+ requestedWidth: appDelegate.requestedWidth
1230+ requestedHeight: appDelegate.requestedHeight
1232+ width: units.gu(40)
1233+ height: units.gu(40)
1235+ Drag.hotSpot.x: width/2
1236+ Drag.hotSpot.y: height/2
1237+ // only accept opposite stage.
1239+ if (!surface) return "Disabled";
1240+ if (appDelegate.isDash) return "Disabled";
1242+ if (appDelegate.stage === ApplicationInfo.MainStage) {
1243+ if (appDelegate.application.supportedOrientations
1244+ & (Qt.PortraitOrientation|Qt.InvertedPortraitOrientation)) {
1245+ return "MainStage";
1249+ return "SideStage";