@@ -39,6 +39,9 @@ Item {
3939 readonly property int applicationState: root.application ? root.application.state : -1
4040 readonly property var promptSurfaces: root.application ? root.application.promptSurfaces : null
4141
42+ // Whether the Application had a surface before but lost it.
43+ property bool hadSurface: false
44+
4245 property bool needToTakeScreenshot:
4346 d.surface && d.surfaceInitialized && screenshotImage.status === Image.Null
4447 && d.applicationState === ApplicationInfo.Stopped
@@ -56,6 +59,7 @@ Item {
5659 if (surface) {
5760 surfaceInitTimer.start();
5861 } else {
62+ hadSurface = true;
5963 surfaceInitialized = false;
6064 }
6165 }
@@ -147,10 +151,17 @@ Item {
147151 StateGroup {
148152 objectName: "applicationWindowStateGroup"
149153 states: [
154+ State {
155+ name: "void"
156+ when:
157+ d.hadSurface && (!d.surface || !d.surfaceInitialized)
158+ &&
159+ screenshotImage.status !== Image.Ready
160+ },
150161 State {
151162 name: "splashScreen"
152163 when:
153− (!d.surface || !d.surfaceInitialized)
164+ !d.hadSurface && (!d.surface || !d.surfaceInitialized)
154165 &&
155166 screenshotImage.status !== Image.Ready
156167 },
@@ -225,6 +236,23 @@ Item {
225236 PropertyAction { target: screenshotImage; property: "visible"; value: false }
226237 PropertyAction { target: screenshotImage; property: "source"; value: "" }
227238 }
239+ },
240+ Transition {
241+ from: "surface"; to: "void"
242+ SequentialAnimation {
243+ PropertyAction { target: surfaceContainer; property: "visible"; value: false }
244+ ScriptAction { script: { if (d.surface) { d.surface.release(); } } }
245+ }
246+ },
247+ Transition {
248+ from: "void"; to: "surface"
249+ SequentialAnimation {
250+ PropertyAction { target: surfaceContainer; property: "opacity"; value: 0.0 }
251+ PropertyAction { target: surfaceContainer; property: "visible"; value: true }
252+ UbuntuNumberAnimation { target: surfaceContainer; property: "opacity";
253+ from: 0.0; to: 1.0
254+ duration: UbuntuAnimation.BriskDuration }
255+ }
228256 }
229257 ]
230258 }