@@ -26,6 +26,7 @@ import WindowManager 1.0
26import ".."
26import ".."
27import "../../../qml/Stage"
27import "../../../qml/Stage"
28import "../../../qml/Components"
28import "../../../qml/Components"
29+import "../../../qml/Components/PanelState"
30Rectangle {
31Rectangle {
@@ -35,10 +36,10 @@ Rectangle {
36 property var greeter: { fullyShown: true }
37 property var greeter: { fullyShown: true }
38− SurfaceManager { id: sMgr }
39+ readonly property var topLevelSurfaceList: WorkspaceManager.activeWorkspace.windowModel
39 ApplicationMenuDataLoader {
41 ApplicationMenuDataLoader {
40 id: appMenuData
42 id: appMenuData
@@ -56,17 +57,16 @@ Rectangle {
56 focus: true
57 focus: true
57 mode: "stagedWithSideStage"
58 mode: "stagedWithSideStage"
58 applicationManager: ApplicationManager
59 applicationManager: ApplicationManager
59− topLevelSurfaceList: TopLevelWindowModel {
60+ topLevelSurfaceList: root.topLevelSurfaceList
60− id: topLevelSurfaceList
61+ panelState: PanelState {}
61− applicationManager: ApplicationManager
64 availableDesktopArea: availableDesktopAreaItem
62 availableDesktopArea: availableDesktopAreaItem
66 id: availableDesktopAreaItem
64 id: availableDesktopAreaItem
67 anchors.fill: parent
65 anchors.fill: parent
69 Component.onCompleted: {
68 Component.onCompleted: {
69+ print("starting dash")
70 ApplicationManager.startApplication("unity8-dash");
70 ApplicationManager.startApplication("unity8-dash");
@@ -138,21 +138,21 @@ Rectangle {
138 name: "TabletStage"
138 name: "TabletStage"
139 when: windowShown
139 when: windowShown
141− readonly property alias topSurfaceList: stage.topLevelSurfaceList
141+ readonly property alias topLevelSurfaceList: root.topLevelSurfaceList
142 property Item sideStage: stage ? findChild(stage, "sideStage") : null
142 property Item sideStage: stage ? findChild(stage, "sideStage") : null
144 function init() {
144 function init() {
145 stageSaver.clear();
145 stageSaver.clear();
147 ApplicationManager.startApplication("unity8-dash");
147 ApplicationManager.startApplication("unity8-dash");
148− tryCompare(topSurfaceList, "count", 1);
148+ tryCompare(topLevelSurfaceList, "count", 1);
149− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
149+ compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
151 // this is very strange, but sometimes the test starts without
151 // this is very strange, but sometimes the test starts without
152 // Stage components having finished loading themselves
152 // Stage components having finished loading themselves
153 var appWindow = null
153 var appWindow = null
154 while (!appWindow) {
154 while (!appWindow) {
155− appWindow = findAppWindowForSurfaceId(topSurfaceList.idAt(0));
155+ appWindow = findAppWindowForSurfaceId(topLevelSurfaceList.idAt(0));
156 if (!appWindow) {
156 if (!appWindow) {
157 console.log("didn't find unity8-dash appWindow in Stage. Trying again...");
157 console.log("didn't find unity8-dash appWindow in Stage. Trying again...");
158 wait(50);
158 wait(50);
@@ -164,7 +164,7 @@ Rectangle {
164 tryCompare(appRepeater, "count", 1);
164 tryCompare(appRepeater, "count", 1);
165 tryCompare(appRepeater.itemAt(0), "x", 0);
165 tryCompare(appRepeater.itemAt(0), "x", 0);
167− waitUntilAppSurfaceShowsUp(topSurfaceList.idAt(0));
167+ waitUntilAppSurfaceShowsUp(topLevelSurfaceList.idAt(0));
168 sideStage.hideNow()
168 sideStage.hideNow()
169 tryCompare(sideStage, "x", stage.width)
169 tryCompare(sideStage, "x", stage.width)
@@ -279,7 +279,7 @@ Rectangle {
279 function test_tappingSwitchesFocusBetweenStages() {
279 function test_tappingSwitchesFocusBetweenStages() {
280 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
280 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
282− var webbrowserSurfaceId = topSurfaceList.nextId;
282+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
283 webbrowserCheckBox.checked = true;
283 webbrowserCheckBox.checked = true;
284 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
284 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
285 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
285 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
@@ -290,7 +290,7 @@ Rectangle {
291 tryCompare(webbrowserWindow.surface, "activeFocus", true);
291 tryCompare(webbrowserWindow.surface, "activeFocus", true);
293− var dialerSurfaceId = topSurfaceList.nextId;
293+ var dialerSurfaceId = topLevelSurfaceList.nextId;
294 dialerCheckBox.checked = true;
294 dialerCheckBox.checked = true;
295 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
295 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
@@ -322,7 +322,7 @@ Rectangle {
322 function test_closeAppInSideStage() {
322 function test_closeAppInSideStage() {
323 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
323 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
325− var dialerSurfaceId = topSurfaceList.nextId;
325+ var dialerSurfaceId = topLevelSurfaceList.nextId;
326 dialerCheckBox.checked = true;
326 dialerCheckBox.checked = true;
327 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
327 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
@@ -348,7 +348,7 @@ Rectangle {
350 function test_suspendsAndResumesAppsInMainStage() {
350 function test_suspendsAndResumesAppsInMainStage() {
351− var webbrowserSurfaceId = topSurfaceList.nextId;
351+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
352 webbrowserCheckBox.checked = true;
352 webbrowserCheckBox.checked = true;
353 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
353 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
354 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
354 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
@@ -357,7 +357,7 @@ Rectangle {
358 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
358 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
360− var gallerySurfaceId = topSurfaceList.nextId;
360+ var gallerySurfaceId = topLevelSurfaceList.nextId;
361 galleryCheckBox.checked = true;
361 galleryCheckBox.checked = true;
362 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
362 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
363 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
363 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
@@ -388,7 +388,7 @@ Rectangle {
388 // launch two main stage apps
388 // launch two main stage apps
389 // gallery will be on foreground and webbrowser on background
389 // gallery will be on foreground and webbrowser on background
391− var webbrowserSurfaceId = topSurfaceList.nextId;
391+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
392 webbrowserCheckBox.checked = true;
392 webbrowserCheckBox.checked = true;
393 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
393 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
394 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
394 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
@@ -396,7 +396,7 @@ Rectangle {
396 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
396 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
397 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
397 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
399− var gallerySurfaceId = topSurfaceList.nextId;
399+ var gallerySurfaceId = topLevelSurfaceList.nextId;
400 galleryCheckBox.checked = true;
400 galleryCheckBox.checked = true;
401 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
401 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
402 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
402 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
@@ -408,14 +408,14 @@ Rectangle {
408 // then launch two side stage apps
408 // then launch two side stage apps
409 // facebook will be on foreground and dialer on background
409 // facebook will be on foreground and dialer on background
411− var dialerSurfaceId = topSurfaceList.nextId;
411+ var dialerSurfaceId = topLevelSurfaceList.nextId;
412 dialerCheckBox.checked = true;
412 dialerCheckBox.checked = true;
413 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
413 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
414 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
414 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
415 var dialerDelegate = findChild(stage, "appDelegate_" + dialerSurfaceId);
415 var dialerDelegate = findChild(stage, "appDelegate_" + dialerSurfaceId);
416 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
416 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
418− var facebookSurfaceId = topSurfaceList.nextId;
418+ var facebookSurfaceId = topLevelSurfaceList.nextId;
419 facebookCheckBox.checked = true;
419 facebookCheckBox.checked = true;
420 waitUntilAppSurfaceShowsUp(facebookSurfaceId);
420 waitUntilAppSurfaceShowsUp(facebookSurfaceId);
421 var facebookApp = ApplicationManager.findApplication(facebookCheckBox.appId);
421 var facebookApp = ApplicationManager.findApplication(facebookCheckBox.appId);
@@ -450,14 +450,14 @@ Rectangle {
450 function test_foregroundAppsAreSuspendedWhenStageIsSuspended() {
450 function test_foregroundAppsAreSuspendedWhenStageIsSuspended() {
451 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
451 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
453− var webbrowserSurfaceId = topSurfaceList.nextId;
453+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
454 webbrowserCheckBox.checked = true;
454 webbrowserCheckBox.checked = true;
455 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
455 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
456 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
456 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
457 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
457 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
458 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
458 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
460− var dialerSurfaceId = topSurfaceList.nextId;
460+ var dialerSurfaceId = topLevelSurfaceList.nextId;
461 dialerCheckBox.checked = true;
461 dialerCheckBox.checked = true;
462 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
462 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
463 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
463 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
@@ -531,7 +531,7 @@ Rectangle {
531 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
531 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
532 tryCompare(stagesPriv, "sideStageAppId", "");
532 tryCompare(stagesPriv, "sideStageAppId", "");
534− var appSurfaceId = topSurfaceList.nextId;
534+ var appSurfaceId = topLevelSurfaceList.nextId;
535 var app = ApplicationManager.startApplication(data.appId);
535 var app = ApplicationManager.startApplication(data.appId);
536 waitUntilAppSurfaceShowsUp(appSurfaceId);
536 waitUntilAppSurfaceShowsUp(appSurfaceId);
@@ -555,7 +555,7 @@ Rectangle {
555 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
555 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
556 tryCompare(stagesPriv, "sideStageAppId", "");
556 tryCompare(stagesPriv, "sideStageAppId", "");
558− var webbrowserSurfaceId = topSurfaceList.nextId;
558+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
559 webbrowserCheckBox.checked = true;
559 webbrowserCheckBox.checked = true;
560 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
560 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -580,7 +580,7 @@ Rectangle {
580 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
580 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
581 tryCompare(stagesPriv, "sideStageAppId", "");
581 tryCompare(stagesPriv, "sideStageAppId", "");
583− var webbrowserSurfaceId = topSurfaceList.nextId;
583+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
584 webbrowserCheckBox.checked = true;
584 webbrowserCheckBox.checked = true;
585 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
585 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -598,7 +598,7 @@ Rectangle {
598 function test_loadSideStageByDraggingFromMainStage() {
598 function test_loadSideStageByDraggingFromMainStage() {
599 sideStage.showNow();
599 sideStage.showNow();
600 print("sidestage now shown. launching browser")
600 print("sidestage now shown. launching browser")
601− var webbrowserSurfaceId = topSurfaceList.nextId;
601+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
602 webbrowserCheckBox.checked = true;
602 webbrowserCheckBox.checked = true;
603 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
603 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -619,7 +619,7 @@ Rectangle {
619 tryCompareFunction(function() {
619 tryCompareFunction(function() {
620 return WindowStateStorage.getStage(webbrowserCheckBox.appId, ApplicationInfoInterface.MainStage) === ApplicationInfoInterface.SideStage
620 return WindowStateStorage.getStage(webbrowserCheckBox.appId, ApplicationInfoInterface.MainStage) === ApplicationInfoInterface.SideStage
621 }, true);
621 }, true);
622− var webbrowserSurfaceId = topSurfaceList.nextId;
622+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
623 webbrowserCheckBox.checked = true;
623 webbrowserCheckBox.checked = true;
624 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
624 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -635,7 +635,7 @@ Rectangle {
637 1- Suspended app gets killed behind the scenes, causing its surface to go zombie.
637 1- Suspended app gets killed behind the scenes, causing its surface to go zombie.
638− 2- Surface gets screenshotted and removed. Its slot in the topSurfaceList remains,
638+ 2- Surface gets screenshotted and removed. Its slot in the topLevelSurfaceList remains,
639 though (so ApplicationWindow can display the screenshot in its place).
639 though (so ApplicationWindow can display the screenshot in its place).
640 3- User taps on the screenshot of the long-gone surface.
640 3- User taps on the screenshot of the long-gone surface.
@@ -643,11 +643,11 @@ Rectangle {
643 Application gets relaunched. Its new surface will seamlessly replace the screenshot.
643 Application gets relaunched. Its new surface will seamlessly replace the screenshot.
645 function test_selectSuspendedAppWithoutSurface() {
645 function test_selectSuspendedAppWithoutSurface() {
646− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
646+ compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
647− var dashSurfaceId = topSurfaceList.idAt(0);
647+ var dashSurfaceId = topLevelSurfaceList.idAt(0);
648− var dashWindow = topSurfaceList.windowAt(0);
648+ var dashWindow = topLevelSurfaceList.windowAt(0);
650− var webbrowserSurfaceId = topSurfaceList.nextId;
650+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
651 webbrowserCheckBox.checked = true;
651 webbrowserCheckBox.checked = true;
652 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
652 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
653 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
653 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
@@ -664,22 +664,22 @@ Rectangle {
665 // wait until the surface is gone
665 // wait until the surface is gone
666 tryCompare(webbrowserApp.surfaceList, "count", 0);
666 tryCompare(webbrowserApp.surfaceList, "count", 0);
667− compare(topSurfaceList.surfaceAt(topSurfaceList.indexForId(webbrowserSurfaceId)), null);
667+ compare(topLevelSurfaceList.surfaceAt(topLevelSurfaceList.indexForId(webbrowserSurfaceId)), null);
669 switchToSurface(webbrowserSurfaceId);
669 switchToSurface(webbrowserSurfaceId);
671 // webbrowser should have been brought to front
671 // webbrowser should have been brought to front
672− tryCompareFunction(function(){return topSurfaceList.idAt(0);}, webbrowserSurfaceId);
672+ tryCompareFunction(function(){return topLevelSurfaceList.idAt(0);}, webbrowserSurfaceId);
674 // and it should eventually get a new surface and get resumed
674 // and it should eventually get a new surface and get resumed
675− tryCompareFunction(function(){return topSurfaceList.surfaceAt(0) !== null;}, true);
675+ tryCompareFunction(function(){return topLevelSurfaceList.surfaceAt(0) !== null;}, true);
676− compare(topSurfaceList.count, 2); // still two top-level items
676+ compare(topLevelSurfaceList.count, 2); // still two top-level items
677 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
677 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
678 compare(webbrowserApp.surfaceList.count, 1);
678 compare(webbrowserApp.surfaceList.count, 1);
681 function test_draggingSurfaceKeepsSurfaceFocus() {
681 function test_draggingSurfaceKeepsSurfaceFocus() {
682− var webbrowserSurfaceId = topSurfaceList.nextId;
682+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
683 webbrowserCheckBox.checked = true;
683 webbrowserCheckBox.checked = true;
684 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
684 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -697,8 +697,8 @@ Rectangle {
698 function test_dashDoesNotDragToSidestage() {
698 function test_dashDoesNotDragToSidestage() {
699 sideStage.showNow();
699 sideStage.showNow();
700− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
700+ compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
701− var dashSurfaceId = topSurfaceList.idAt(0);
701+ var dashSurfaceId = topLevelSurfaceList.idAt(0);
703 var appDelegate = findChild(stage, "appDelegate_" + dashSurfaceId);
703 var appDelegate = findChild(stage, "appDelegate_" + dashSurfaceId);
704 verify(appDelegate);
704 verify(appDelegate);
@@ -720,7 +720,7 @@ Rectangle {
721 function test_switchRestoreStageOnRotation() {
721 function test_switchRestoreStageOnRotation() {
722 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
722 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
723− var webbrowserSurfaceId = topSurfaceList.nextId;
723+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
724 webbrowserCheckBox.checked = true;
724 webbrowserCheckBox.checked = true;
725 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
725 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -739,7 +739,7 @@ Rectangle {
741 function test_restoreSavedStageOnCloseReopen() {
741 function test_restoreSavedStageOnCloseReopen() {
742− var webbrowserSurfaceId = topSurfaceList.nextId;
742+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
743 webbrowserCheckBox.checked = true;
743 webbrowserCheckBox.checked = true;
744 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
744 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -757,7 +757,7 @@ Rectangle {
757 // back to landscape
757 // back to landscape
758 stage.shellOrientation = Qt.LandscapeOrientation;
758 stage.shellOrientation = Qt.LandscapeOrientation;
760− webbrowserSurfaceId = topSurfaceList.nextId;
760+ webbrowserSurfaceId = topLevelSurfaceList.nextId;
761 webbrowserCheckBox.checked = true;
761 webbrowserCheckBox.checked = true;
762 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
762 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);