@@ -144,7 +144,7 @@ FocusScope {
145 onTouchXChanged: {
145 onTouchXChanged: {
146 if (status == DirectionalDragArea.Recognized) {
146 if (status == DirectionalDragArea.Recognized) {
147− if (stages.empty) {
147+ if (SurfaceManager.empty) {
148 progress = Math.max(stages.width - stagesDragArea.width + touchX, stages.width * .3);
148 progress = Math.max(stages.width - stagesDragArea.width + touchX, stages.width * .3);
150 progress = stages.width - stagesDragArea.width + touchX;
150 progress = stages.width - stagesDragArea.width + touchX;
@@ -154,7 +154,7 @@ FocusScope {
155 onDraggingChanged: {
155 onDraggingChanged: {
156 if (!dragging) {
156 if (!dragging) {
157− if (!stages.empty && progress < stages.width - units.gu(10)) {
157+ if (!SurfaceManager.empty && progress < stages.width - units.gu(10)) {
158 stages.show();
158 stages.show();
160 stagesDragArea.progress = Qt.binding(function () { return stages.width; });
160 stagesDragArea.progress = Qt.binding(function () { return stages.width; });
@@ -176,9 +176,16 @@ FocusScope {
177 property bool shown: false
177 property bool shown: false
178 onShownChanged: {
178 onShownChanged: {
180+ if (SurfaceManager.count > 0) {
181+ var topmostSurface = SurfaceManager.getSurface(0);
182+ ApplicaitonManager.focusApplication(topmostSurface.application.appId);
179− if (!shown && ApplicationManager.focusedApplicationId) {
185+ if (ApplicationManager.focusedApplicationId) {
180− ApplicationManager.updateScreenshot(ApplicationManager.focusedApplicationId);
186+ ApplicationManager.updateScreenshot(ApplicationManager.focusedApplicationId);
181− ApplicationManager.unfocusCurrentApplication();
187+ ApplicationManager.unfocusCurrentApplication();
@@ -190,12 +197,8 @@ FocusScope {
190 property bool fullyShown: x == 0
197 property bool fullyShown: x == 0
191 property bool fullyHidden: x == width
198 property bool fullyHidden: x == width
193− property bool empty: SurfaceManager.count == 0
200+ // It might technically not be fullyShown but visually it just looks so.
194− onEmptyChanged: {
201+ property bool roughlyFullyShown: x >= 0 && x <= units.gu(1)
200 function show() {
203 function show() {
201 shown = true;
204 shown = true;
@@ -258,6 +261,12 @@ FocusScope {
258 surface.release();
261 surface.release();
266+ if (SurfaceManager.empty) {
263 Lockscreen {
272 Lockscreen {
@@ -424,10 +433,20 @@ FocusScope {
424 available: edgeDemo.panelEnabled
433 available: edgeDemo.panelEnabled
425 contentEnabled: edgeDemo.panelContentEnabled
434 contentEnabled: edgeDemo.panelContentEnabled
427− property string focusedAppId: ApplicationManager.focusedApplicationId
436+
428− property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
437+ property bool topmostSurfaceIsFullscreen: {
429− //fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
438+ if (SurfaceManager.empty) {
441+ // TODO check the actual surface size to see if it fills the screen
442+ // For now they're all fullscreen anyway, so this assumption will hold.
447+ fullscreenMode: stages.roughlyFullyShown && topmostSurfaceIsFullscreen
430− fullscreenMode: focusedApplication && !greeter.shown && !lockscreen.shown
448+ && !greeter.shown && !lockscreen.shown
431 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
450 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable