@@ -32,9 +32,21 @@ Item {
32 // e.g. Create a SurfaceItem {} in C++ which we just use without any imperative hacks.
32 // e.g. Create a SurfaceItem {} in C++ which we just use without any imperative hacks.
33 property var surface: application ? application.surface : null
33 property var surface: application ? application.surface : null
34 onSurfaceChanged: {
34 onSurfaceChanged: {
35− if (surface) {
35+ if (surface && !priv.appHasCreatedASurface) {
36− surface.parent = root;
36+ priv.appHasCreatedASurface = true;
42+ property bool appHasCreatedASurface: false
44+ function checkFullscreen(surface) {
45+ if (surface.state === MirSurfaceItem.Fullscreen) {
46+ surface.anchors.topMargin = 0;
48+ surface.anchors.topMargin = maximizedAppTopMargin;
@@ -44,42 +56,42 @@ Item {
44 value: root.interactive
56 value: root.interactive
47− state: {
59+ Connections {
48− if (surface) {
60+ target: surface
49− if (surface.state === MirSurfaceItem.Fullscreen) {
61+ onStateChanged: priv.checkFullScreen(surface);
58− states: [
66+ states: [
60− name: "fullscreen"
68+ name: "noSurfaceYet"
61− PropertyChanges {
69+ when: !priv.appHasCreatedASurface
62− target: surface
70+ StateChangeScript {
63− x: 0
71+ script: {splashLoader.setSource("Splash.qml", { "name": application.name, "image": application.icon }); print("SPLASH!!")}
70− name: "maximized"
75+ name: "hasSurface"
71− PropertyChanges {
76+ when: priv.appHasCreatedASurface && (root.surface !== null)
72− target: surface
77+ PropertyChanges { target: root.surface; parent: root; anchors.fill: parent; z: 1 }
73− x: 0
78+ StateChangeScript { script: priv.checkFullscreen(root.surface); }
74− y: maximizedAppTopMargin
79+ PropertyChanges { target: splashLoader; source: "" }
75− width: root.width
80+ },
76− height: root.height - y
81+ State {
82+ name: "surfaceLostButAppStillAlive"
83+ when: priv.appHasCreatedASurface && (root.surface === null)
84+ // TODO - use app snapshot
87+ state: "noSurfaceYet"
93+ onLoaded: print("Splash loaded!!")
84 BorderImage {
96 BorderImage {
85 id: dropShadow
97 id: dropShadow
@@ -100,4 +112,7 @@ Item {
100 root.clicked()
112 root.clicked()
116+ Component.onCompleted: print("SpreadDelegate created", root, application)
117+ Component.onDestruction: print("SpreadDelegate destroyed", root, application)