on xenial help sign in
Fix indicators bar show/hide behavior when stages come and go
commitc0b380be34530e8be2e94cf88199cee4cc6c42e9 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateTue 20 May 2014, 18:22 (12 years ago) parent0eeeb56
1 file changed+34−15
qml/Shell.qml+34−15
qml/Shell.qml+34−15
@@ -144,7 +144,7 @@ FocusScope {
144144
145145 onTouchXChanged: {
146146 if (status == DirectionalDragArea.Recognized) {
147− if (stages.empty) {
147+ if (SurfaceManager.empty) {
148148 progress = Math.max(stages.width - stagesDragArea.width + touchX, stages.width * .3);
149149 } else {
150150 progress = stages.width - stagesDragArea.width + touchX;
@@ -154,7 +154,7 @@ FocusScope {
154154
155155 onDraggingChanged: {
156156 if (!dragging) {
157− if (!stages.empty && progress < stages.width - units.gu(10)) {
157+ if (!SurfaceManager.empty && progress < stages.width - units.gu(10)) {
158158 stages.show();
159159 }
160160 stagesDragArea.progress = Qt.binding(function () { return stages.width; });
@@ -176,9 +176,16 @@ FocusScope {
176176
177177 property bool shown: false
178178 onShownChanged: {
179− if (!shown && ApplicationManager.focusedApplicationId) {
180− ApplicationManager.updateScreenshot(ApplicationManager.focusedApplicationId);
181− ApplicationManager.unfocusCurrentApplication();
179+ if (shown) {
180+ if (SurfaceManager.count > 0) {
181+ var topmostSurface = SurfaceManager.getSurface(0);
182+ ApplicaitonManager.focusApplication(topmostSurface.application.appId);
183+ }
184+ } else {
185+ if (ApplicationManager.focusedApplicationId) {
186+ ApplicationManager.updateScreenshot(ApplicationManager.focusedApplicationId);
187+ ApplicationManager.unfocusCurrentApplication();
188+ }
182189 }
183190 }
184191
@@ -190,12 +197,8 @@ FocusScope {
190197 property bool fullyShown: x == 0
191198 property bool fullyHidden: x == width
192199
193− property bool empty: SurfaceManager.count == 0
194− onEmptyChanged: {
195− if (empty) {
196− hide();
197− }
198− }
200+ // It might technically not be fullyShown but visually it just looks so.
201+ property bool roughlyFullyShown: x >= 0 && x <= units.gu(1)
199202
200203 function show() {
201204 shown = true;
@@ -258,6 +261,12 @@ FocusScope {
258261 surface.release();
259262 }
260263 }
264+
265+ onEmptyChanged: {
266+ if (SurfaceManager.empty) {
267+ stages.hide();
268+ }
269+ }
261270 }
262271
263272 Lockscreen {
@@ -424,10 +433,20 @@ FocusScope {
424433 available: edgeDemo.panelEnabled
425434 contentEnabled: edgeDemo.panelContentEnabled
426435 }
427− property string focusedAppId: ApplicationManager.focusedApplicationId
428− property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
429− //fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
430− fullscreenMode: focusedApplication && !greeter.shown && !lockscreen.shown
436+
437+ property bool topmostSurfaceIsFullscreen: {
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
448+ && !greeter.shown && !lockscreen.shown
449+
431450 searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
432451 }
433452