@@ -18,15 +18,15 @@ import QtQuick 2.0
1818import Ubuntu.Components 1.1
1919import Unity.Application 0.1
2020
21−SessionContainer {
21+Item {
2222 id: root
2323
2424 // to be read from outside
2525 readonly property bool fullscreen: application ? application.fullscreen : false
26+ property alias interactive: sessionContainer.interactive
2627
2728 // to be set from outside
2829 property QtObject application
29− session: application ? application.session : null
3030
3131 QtObject {
3232 id: d
@@ -41,7 +41,7 @@ SessionContainer {
4141 property bool hadSurface: false
4242
4343 property bool needToTakeScreenshot:
44− root.surface && d.surfaceInitialized && screenshotImage.status === Image.Null
44+ sessionContainer.surface && d.surfaceInitialized && screenshotImage.status === Image.Null
4545 && d.applicationState === ApplicationInfoInterface.Stopped
4646 onNeedToTakeScreenshotChanged: {
4747 if (needToTakeScreenshot) {
@@ -54,31 +54,23 @@ SessionContainer {
5454 // Remove this when possible
5555 property bool surfaceInitialized: false
5656 }
57− onSurfaceChanged: {
58− if (root.surface) {
59− surfaceInitTimer.start();
60− } else {
61− d.hadSurface = true;
62− d.surfaceInitialized = false;
63− }
64− }
6557
6658 Timer {
6759 id: surfaceInitTimer
6860 interval: 100
69− onTriggered: { if (root.surface) {d.surfaceInitialized = true;} }
61+ onTriggered: { if (sessionContainer.surface) {d.surfaceInitialized = true;} }
7062 }
7163
7264 Connections {
73− target: root.surface
65+ target: sessionContainer.surface
7466 // FIXME: I would rather not need to do this, but currently it doesn't get
7567 // active focus without it and I don't know why.
7668 onFocusChanged: forceSurfaceActiveFocusIfReady();
7769 onParentChanged: forceSurfaceActiveFocusIfReady();
7870 onEnabledChanged: forceSurfaceActiveFocusIfReady();
7971 function forceSurfaceActiveFocusIfReady() {
80− if (root.surface.focus && root.surface.parent === surfaceContainer && root.surface.enabled) {
81− root.surface.forceActiveFocus();
72+ if (sessionContainer.surface.focus && sessionContainer.surface.parent === sessionContainer.surfaceContainer && sessionContainer.surface.enabled) {
73+ sessionContainer.surface.forceActiveFocus();
8274 }
8375 }
8476 }
@@ -111,27 +103,42 @@ SessionContainer {
111103 }
112104 }
113105
106+ SessionContainer {
107+ id: sessionContainer
108+ session: application ? application.session : null
109+ anchors.fill: parent
110+
111+ onSurfaceChanged: {
112+ if (sessionContainer.surface) {
113+ surfaceInitTimer.start();
114+ } else {
115+ d.hadSurface = true;
116+ d.surfaceInitialized = false;
117+ }
118+ }
119+ }
120+
114121 StateGroup {
115122 objectName: "applicationWindowStateGroup"
116123 states: [
117124 State {
118125 name: "void"
119126 when:
120− d.hadSurface && (!root.surface || !d.surfaceInitialized)
127+ d.hadSurface && (!sessionContainer.surface || !d.surfaceInitialized)
121128 &&
122129 screenshotImage.status !== Image.Ready
123130 },
124131 State {
125132 name: "splashScreen"
126133 when:
127− !d.hadSurface && (!root.surface || !d.surfaceInitialized)
134+ !d.hadSurface && (!sessionContainer.surface || !d.surfaceInitialized)
128135 &&
129136 screenshotImage.status !== Image.Ready
130137 },
131138 State {
132139 name: "surface"
133140 when:
134− (root.surface && d.surfaceInitialized)
141+ (sessionContainer.surface && d.surfaceInitialized)
135142 &&
136143 (d.applicationState !== ApplicationInfoInterface.Stopped
137144 || screenshotImage.status !== Image.Ready)
@@ -142,7 +149,7 @@ SessionContainer {
142149 screenshotImage.status === Image.Ready
143150 &&
144151 (d.applicationState === ApplicationInfoInterface.Stopped
145− || !root.surface || !d.surfaceInitialized)
152+ || !sessionContainer.surface || !d.surfaceInitialized)
146153 }
147154 ]
148155
@@ -150,14 +157,18 @@ SessionContainer {
150157 Transition {
151158 from: ""; to: "splashScreen"
152159 PropertyAction { target: splashLoader; property: "active"; value: true }
160+ PropertyAction { target: sessionContainer.surfaceContainer
161+ property: "visible"; value: false }
153162 },
154163 Transition {
155164 from: "splashScreen"; to: "surface"
156165 SequentialAnimation {
157− PropertyAction { target: surfaceContainer
166+ PropertyAction { target: sessionContainer.surfaceContainer
167+ property: "opacity"; value: 0.0 }
168+ PropertyAction { target: sessionContainer.surfaceContainer
158169 property: "visible"; value: true }
159− UbuntuNumberAnimation { target: splashLoader; property: "opacity";
160− from: 1.0; to: 0.0
170+ UbuntuNumberAnimation { target: sessionContainer.surfaceContainer; property: "opacity";
171+ from: 0.0; to: 1.0
161172 duration: UbuntuAnimation.BriskDuration }
162173 PropertyAction { target: splashLoader; property: "active"; value: false }
163174 }
@@ -166,11 +177,13 @@ SessionContainer {
166177 from: "surface"; to: "splashScreen"
167178 SequentialAnimation {
168179 PropertyAction { target: splashLoader; property: "active"; value: true }
169− PropertyAction { target: surfaceContainer
180+ PropertyAction { target: sessionContainer.surfaceContainer
170181 property: "visible"; value: true }
171182 UbuntuNumberAnimation { target: splashLoader; property: "opacity";
172183 from: 0.0; to: 1.0
173184 duration: UbuntuAnimation.BriskDuration }
185+ PropertyAction { target: sessionContainer.surfaceContainer
186+ property: "visible"; value: false }
174187 }
175188 },
176189 Transition {
@@ -181,15 +194,15 @@ SessionContainer {
181194 UbuntuNumberAnimation { target: screenshotImage; property: "opacity";
182195 from: 0.0; to: 1.0
183196 duration: UbuntuAnimation.BriskDuration }
184− PropertyAction { target: surfaceContainer
197+ PropertyAction { target: sessionContainer.surfaceContainer
185198 property: "visible"; value: false }
186− ScriptAction { script: { if (root.session) { root.session.release(); } } }
199+ ScriptAction { script: { if (sessionContainer.session) { sessionContainer.session.release(); } } }
187200 }
188201 },
189202 Transition {
190203 from: "screenshot"; to: "surface"
191204 SequentialAnimation {
192− PropertyAction { target: surfaceContainer
205+ PropertyAction { target: sessionContainer.surfaceContainer
193206 property: "visible"; value: true }
194207 UbuntuNumberAnimation { target: screenshotImage; property: "opacity";
195208 from: 1.0; to: 0.0
@@ -201,16 +214,16 @@ SessionContainer {
201214 Transition {
202215 from: "surface"; to: "void"
203216 SequentialAnimation {
204− PropertyAction { target: surfaceContainer; property: "visible"; value: false }
205− ScriptAction { script: { if (root.session) { d.session.release(); } } }
217+ PropertyAction { target: sessionContainer.surfaceContainer; property: "visible"; value: false }
218+ ScriptAction { script: { if (sessionContainer.session) { sessionContainer.session.release(); } } }
206219 }
207220 },
208221 Transition {
209222 from: "void"; to: "surface"
210223 SequentialAnimation {
211− PropertyAction { target: surfaceContainer; property: "opacity"; value: 0.0 }
212− PropertyAction { target: surfaceContainer; property: "visible"; value: true }
213− UbuntuNumberAnimation { target: surfaceContainer; property: "opacity";
224+ PropertyAction { target: sessionContainer.surfaceContainer; property: "opacity"; value: 0.0 }
225+ PropertyAction { target: sessionContainer.surfaceContainer; property: "visible"; value: true }
226+ UbuntuNumberAnimation { target: sessionContainer.surfaceContainer; property: "opacity";
214227 from: 0.0; to: 1.0
215228 duration: UbuntuAnimation.BriskDuration }
216229 }