@@ -15,7 +15,7 @@ Item {
15 property bool moving: false
15 property bool moving: false
17 // State information propagated to the outside
17 // State information propagated to the outside
18− readonly property bool painting: mainScreenshotImage.visible || fadeInScreenshotImage.visible
18+ readonly property bool painting: mainScreenshotImage.visible || fadeInScreenshotImage.visible || appSplash.visible
20 onMovingChanged: {
20 onMovingChanged: {
21 if (moving) {
21 if (moving) {
@@ -34,18 +34,24 @@ Item {
35 onFocusedApplicationIdChanged: {
35 onFocusedApplicationIdChanged: {
36 if (ApplicationManager.focusedApplicationId.length > 0) {
36 if (ApplicationManager.focusedApplicationId.length > 0) {
37− priv.applicationStarting = false;
37+ if (priv.secondApplicationStarting || priv.applicationStarting) {
38− priv.secondApplicationStarting = false;
38+ appSplashTimer.start();
40+ mainScreenshotImage.src = ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).screenshot
42 onApplicationAdded: {
45 onApplicationAdded: {
43 if (!priv.focusedApplication) {
46 if (!priv.focusedApplication) {
44− print("*** applicationStarting")
47+ mainScreenshotImage.src = "";
48+ mainScreenshotImage.visible = false;
45 priv.applicationStarting = true;
49 priv.applicationStarting = true;
47− print("*** SECONDapplicationStarting")
51+ mainScreenshotImage.src = "foobar";
52+ priv.newFocusedAppId = appId;
48 priv.secondApplicationStarting = true;
53 priv.secondApplicationStarting = true;
54+ priv.requestNewScreenshot();
@@ -65,12 +71,14 @@ Item {
65 property string newFocusedAppId
71 property string newFocusedAppId
67 onFocusedScreenshotChanged: {
73 onFocusedScreenshotChanged: {
68− waitingForScreenshot = false;
69− if (root.moving) {
74+ if (root.moving && priv.waitingForScreenshot) {
70 mainScreenshotImage.anchors.leftMargin = 0;
75 mainScreenshotImage.anchors.leftMargin = 0;
71 mainScreenshotImage.src = ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).screenshot;
76 mainScreenshotImage.src = ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).screenshot;
72 mainScreenshotImage.visible = true;
77 mainScreenshotImage.visible = true;
78+ } else if (priv.secondApplicationStarting && priv.waitingForScreenshot) {
79+ applicationSwitchingAnimation.start();
81+ waitingForScreenshot = false;
76 function requestNewScreenshot() {
84 function requestNewScreenshot() {
@@ -98,11 +106,26 @@ Item {
111+ // This is to show the splash screen a bit longer.
112+ // Mir signals us that the newly started app has gotten focus before it paints something on the screen
113+ // This would result in the old app surface becoming visible for a bit.
114+ // FIXME: change appManager to only change the focusedApplicationId when the surface is ready to be shown.
118+ priv.applicationStarting = false;
119+ priv.secondApplicationStarting = false;
101 SequentialAnimation {
123 SequentialAnimation {
102 id: applicationSwitchingAnimation
124 id: applicationSwitchingAnimation
104 PropertyAction { target: mainScreenshotImage; property: "anchors.leftMargin"; value: 0 }
126 PropertyAction { target: mainScreenshotImage; property: "anchors.leftMargin"; value: 0 }
127+ // PropertyAction seems to fail when secondApplicationStarting and we didn't have another screenshot before
105− PropertyAction { target: mainScreenshotImage; property: "src"; value: priv.focusedScreenshot }
128+ ScriptAction { script: mainScreenshotImage.src = priv.focusedScreenshot }
106 PropertyAction { target: mainScreenshotImage; property: "visible"; value: true }
129 PropertyAction { target: mainScreenshotImage; property: "visible"; value: true }
107 PropertyAction { target: fadeInScreenshotImage; property: "source"; value: ApplicationManager.findApplication(priv.newFocusedAppId).screenshot }
130 PropertyAction { target: fadeInScreenshotImage; property: "source"; value: ApplicationManager.findApplication(priv.newFocusedAppId).screenshot }
108 PropertyAction { target: fadeInScreenshotImage; property: "visible"; value: true }
131 PropertyAction { target: fadeInScreenshotImage; property: "visible"; value: true }
@@ -124,7 +147,7 @@ Item {
125 // FIXME: Drop this and make the imageprovider show a splashscreen instead
148 // FIXME: Drop this and make the imageprovider show a splashscreen instead
126 Rectangle {
149 Rectangle {
127− id: appSplash
150+ id: appSplash2
128 anchors.fill: parent
151 anchors.fill: parent
129 color: "white"
152 color: "white"
130 visible: priv.secondApplicationStarting
153 visible: priv.secondApplicationStarting
@@ -138,9 +161,9 @@ Item {
140 Rectangle {
163 Rectangle {
141− id: appSplash2
164+ id: appSplash
142 anchors.fill: parent
165 anchors.fill: parent
143− color: "red"
166+ color: "white"
144 visible: priv.applicationStarting
167 visible: priv.applicationStarting