on xenial help sign in
Fix indicators bar show/hide behavior when stages come and go
c0b380bDaniel d'Andrada
qml/Shell.qml+34−15
@@ -144,7 +144,7 @@ FocusScope {
144
144
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);
149 } else {
149 } else {
150 progress = stages.width - stagesDragArea.width + touchX;
150 progress = stages.width - stagesDragArea.width + touchX;
@@ -154,7 +154,7 @@ FocusScope {
154
154
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();
159 }
159 }
160 stagesDragArea.progress = Qt.binding(function () { return stages.width; });
160 stagesDragArea.progress = Qt.binding(function () { return stages.width; });
@@ -176,9 +176,16 @@ FocusScope {
176
176
177 property bool shown: false
177 property bool shown: false
178 onShownChanged: {
178 onShownChanged: {
179+ if (shown) {
180+ if (SurfaceManager.count > 0) {
181+ var topmostSurface = SurfaceManager.getSurface(0);
182+ ApplicaitonManager.focusApplication(topmostSurface.application.appId);
183+ }
184+ } else {
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();
188+ }
182 }
189 }
183 }
190 }
184
191
@@ -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
192
199
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)
195− if (empty) {
196− hide();
197− }
198− }
199
202
200 function show() {
203 function show() {
201 shown = true;
204 shown = true;
@@ -258,6 +261,12 @@ FocusScope {
258 surface.release();
261 surface.release();
259 }
262 }
260 }
263 }
264+
265+ onEmptyChanged: {
266+ if (SurfaceManager.empty) {
267+ stages.hide();
268+ }
269+ }
261 }
270 }
262
271
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
426 }
435 }
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) {
439+ return false;
440+ } else {
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.
443+ return true;
444+ }
445+ }
446+
447+ fullscreenMode: stages.roughlyFullyShown && topmostSurfaceIsFullscreen
430− fullscreenMode: focusedApplication && !greeter.shown && !lockscreen.shown
448+ && !greeter.shown && !lockscreen.shown
449+
431 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
450 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
432 }
451 }
433
452