@@ -27,65 +27,92 @@ Item {
27 property real topMarginProgress
27 property real topMarginProgress
28 property bool interactive: true
28 property bool interactive: true
29 property real maximizedAppTopMargin
29 property real maximizedAppTopMargin
30− property var application: ApplicationManager.get(index)
31 property bool dropShadow: true
30 property bool dropShadow: true
33 // FIXME: This really should be invisible to QML code.
32 // FIXME: This really should be invisible to QML code.
34 // e.g. Create a SurfaceItem {} in C++ which we just use without any imperative hacks.
33 // e.g. Create a SurfaceItem {} in C++ which we just use without any imperative hacks.
35− property var surface: application ? application.surface : null
34+ readonly property var surface: model.surface
36− onSurfaceChanged: {
35+ onSurfaceChanged: { print("SURFACE!!", model.surface)
37 if (surface) {
36 if (surface) {
37+ if (!priv.appHasCreatedASurface) {
38+ surface.visible = false; // hide until splash screen removed
39+ priv.appHasCreatedASurface = true;
38 surface.parent = root;
42 surface.parent = root;
43+ surface.anchors.fill = root;
44+ priv.checkFullscreen(surface);
39 surface.z = 1;
45 surface.z = 1;
51+ property bool appHasCreatedASurface: false
53+ function checkFullscreen(surface) {
54+ if (surface.state === MirSurfaceItem.Fullscreen) {
55+ surface.anchors.topMargin = 0;
57+ surface.anchors.topMargin = maximizedAppTopMargin;
61+ function revealSurface() {
62+ surface.visible = true;
63+ splashLoader.source = "";
67+ Timer { //FIXME - need to delay removing splash screen to allow surface resize to complete
68+ id: surfaceRevealDelay
70+ onTriggered: priv.revealSurface()
44 target: surface
74 target: surface
45 property: "enabled"
75 property: "enabled"
46 value: root.interactive
76 value: root.interactive
49− state: {
79+ Connections {
50− if (surface) {
80+ target: surface
51− if (surface.state === MirSurfaceItem.Fullscreen) {
81+ onStateChanged: priv.checkFullscreen(surface);
60− states: [
86+ states: [
62− name: "fullscreen"
88+ name: "noSurfaceYet"
63− PropertyChanges {
89+ when: !priv.appHasCreatedASurface
64− target: surface
90+ StateChangeScript {
65− x: 0
91+ script: {splashLoader.setSource("Splash.qml", { "name": model.name, "image": model.icon }); }
72− name: "maximized"
95+ name: "hasSurface"
73− PropertyChanges {
96+ when: priv.appHasCreatedASurface && (root.surface !== null)
74− target: surface
97+ StateChangeScript { script: { surfaceRevealDelay.start(); } }
76− y: maximizedAppTopMargin
99+ State {
77− width: root.width
100+ name: "surfaceLostButAppStillAlive"
78− height: root.height - y
101+ when: priv.appHasCreatedASurface && (root.surface === null)
102+ // TODO - use app snapshot
81− State {
105+ state: "noSurfaceYet"
110+ anchors.fill: parent
86 BorderImage {
113 BorderImage {
87 id: dropShadowImage
114 id: dropShadowImage
88− anchors.fill: surface
115+ anchors.fill: parent
89 anchors.margins: -units.gu(2)
116 anchors.margins: -units.gu(2)
90 source: "graphics/dropshadow.png"
117 source: "graphics/dropshadow.png"
91 border { left: 50; right: 50; top: 50; bottom: 50 }
118 border { left: 50; right: 50; top: 50; bottom: 50 }