@@ -83,8 +83,6 @@ FocusScope {
8383 applicationManager.setSideStageAppRect(sideStageAppRect);
8484 }
8585
86− readonly property bool applicationFocused: !!applicationManager.mainStageFocusedApplication
87− || !!applicationManager.sideStageFocusedApplication
8886 // Used for autopilot testing.
8987 readonly property string currentFocusedAppId: ApplicationManager.focusedApplicationId
9088
@@ -149,66 +147,94 @@ FocusScope {
149147 // Whether the underlay is fully covered by opaque UI elements.
150148 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
151149
152− readonly property bool applicationRunning: ((mainStage.applications && mainStage.applications.count > 0)
153− || (sideStage.applications && sideStage.applications.count > 0))
150+ readonly property bool mainStageApplicationRunning: mainStage.applications && mainStage.applications.count > 0
151+ readonly property bool sideStageApplicationRunning: sideStage.applications && sideStage.applications.count > 0
154152
155153 // Whether the user should see the topmost application surface (if there's one at all).
156− readonly property bool applicationSurfaceShouldBeSeen: applicationRunning && !stages.fullyHidden
154+ readonly property bool mainStageApplicationShown: mainStageApplicationRunning && !stages.fullyHidden
157155 && !mainStage.usingScreenshots // but want sideStage animating over app surface
158156
159157
160158
161159 // NB! Application surfaces are stacked behing the shell one. So they can only be seen by the user
162160 // through the translucent parts of the shell surface.
163− visible: !fullyCovered && !applicationSurfaceShouldBeSeen
164−
165− Rectangle {
166− anchors.fill: parent
167− color: "black"
168− opacity: dash.disappearingAnimationProgress
169− }
161+ visible: !fullyCovered && !mainStageApplicationShown
162+
163+ Item {
164+ id: underlayClipper
165+ clip: !parent.mainStageApplicationShown && parent.sideStageApplicationRunning && stagesOuterContainer.showProgress > 0
166+ width: {
167+ if (clip) {
168+ var w = parent.width - sideStage.width
169+ w += stagesOuterContainer.x + stages.x + (sideStage.x - sideStageRevealer.openedValue)
170+ return Math.min(w, parent.width);
171+ } else {
172+ return parent.width;
173+ }
174+ }
175+ height: parent.height
170176
171− Image {
172− anchors.fill: dash
173− source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
174− fillMode: Image.PreserveAspectCrop
175− horizontalAlignment: Image.AlignRight
176− verticalAlignment: Image.AlignTop
177− }
177+ Image {
178+ anchors.fill: dash
179+ source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
180+ fillMode: Image.PreserveAspectCrop
181+ horizontalAlignment: Image.AlignRight
182+ verticalAlignment: Image.AlignTop
183+ }
184+
185+ Dash {
186+ id: dash
187+ objectName: "dash"
188+
189+ available: !greeter.shown && !lockscreen.shown
190+ hides: [stages, launcher, panel.indicators]
191+ shown: disappearingAnimationProgress !== 1.0
192+ enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
193+ // FIXME: unfocus all applications when going back to the dash
194+ onEnabledChanged: {
195+ if (enabled) {
196+ shell.applicationManager.unfocusCurrentApplication()
197+ }
198+ }
178199
179− Dash {
180− id: dash
181− objectName: "dash"
182−
183− available: !greeter.shown && !lockscreen.shown
184− hides: [stages, launcher, panel.indicators]
185− shown: disappearingAnimationProgress !== 1.0
186− enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
187− // FIXME: unfocus all applications when going back to the dash
188− onEnabledChanged: {
189− if (enabled) {
190− shell.applicationManager.unfocusCurrentApplication()
200+ width: underlay.width
201+ height: underlay.height - y
202+ y: panel.panelHeight
203+
204+ contentScale: 1.0 - 0.2 * disappearingAnimationProgress
205+ opacity: 1.0 - disappearingAnimationProgress
206+ property real disappearingAnimationProgress: {
207+ if (greeter.shown) {
208+ return greeter.showProgress;
209+ } else {
210+ if (underlayClipper.clip)
211+ return 0;
212+ else
213+ return stagesOuterContainer.showProgress;
214+ }
191215 }
216+
217+ // FIXME: only necessary because stagesOuterContainer.showProgress and
218+ // greeterRevealer.animatedProgress are not animated
219+ Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
192220 }
193221
194− anchors {
195− fill: parent
196− topMargin: panel.panelHeight
222+ Rectangle {
223+ width: underlay.width
224+ height: underlay.height
225+ color: "black"
226+ opacity: 0.5 * ((sideStage.x - sideStageRevealer.closedValue) / (sideStageRevealer.openedValue - sideStageRevealer.closedValue))
227+ visible: sideStageHideButton.enabled
197228 }
198229
199− contentScale: 1.0 - 0.2 * disappearingAnimationProgress
200− opacity: 1.0 - disappearingAnimationProgress
201− property real disappearingAnimationProgress: {
202− if (greeter.shown) {
203− return greeter.showProgress;
204− } else {
205− return stagesOuterContainer.showProgress;
230+ AbstractButton {
231+ id: sideStageHideButton
232+ enabled: mainStage.applications.count == 0 && sideStage.shown
233+ anchors.fill: parent
234+ onClicked: {
235+ sideStage.hide();
206236 }
207237 }
208−
209− // FIXME: only necessary because stagesOuterContainer.showProgress and
210− // greeterRevealer.animatedProgress are not animated
211− Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
212238 }
213239 }
214240
@@ -217,7 +243,7 @@ FocusScope {
217243
218244 width: parent.width
219245 height: parent.height
220− x: launcher.progress
246+ x: mainStage.applications.count > 0 ? launcher.progress : 0
221247 Behavior on x {SmoothedAnimation{velocity: 600}}
222248
223249 property real showProgress:
@@ -229,6 +255,16 @@ FocusScope {
229255
230256 x: width
231257
258+ function doLauncherHide() {
259+ if (mainStage.applications.count > 0) {
260+ hide();
261+ } else {
262+ if (sideStage.shown) {
263+ sideStage.hide();
264+ }
265+ }
266+ }
267+
232268 property bool fullyShown: shown && x == 0 && parent.x == 0
233269 property bool fullyHidden: !shown && x == width
234270 available: !greeter.shown
@@ -313,11 +349,6 @@ FocusScope {
313349 rightEdgeDraggingAreaWidth: shell.edgeSize
314350 normalApplicationY: shell.panelHeight
315351
316− onShownChanged: {
317− if (!shown && mainStage.applications.count == 0) {
318− stages.hide();
319− }
320− }
321352 // FIXME: when hiding the side stage, refocus the main stage
322353 // application so that it goes in front of the side stage
323354 // application and hides it
@@ -346,8 +377,16 @@ FocusScope {
346377 Connections {
347378 target: sideStage.applications
348379 onCountChanged: {
349− if (sideStage.applications.count == 0 && sideStage.shown) { // if all SS app closed, hide side stage
350− sideStage.hide();
380+ if (sideStage.applications.count == 0) {
381+ if (sideStage.shown) { // if all SS app closed, hide side stage
382+ sideStage.hide();
383+ } else {
384+ // Sidestage is hidden and there is no main app, make sure the
385+ // stages is totally hidden too
386+ if (mainStage.applications.count == 0) {
387+ stages.hideNow();
388+ }
389+ }
351390 }
352391 }
353392 }
@@ -356,7 +395,7 @@ FocusScope {
356395 Revealer {
357396 id: sideStageRevealer
358397
359− enabled: mainStage.applications.count > 0 && sideStage.applications.count > 0
398+ enabled: sideStage.applications.count > 0
360399 && sideStage.available
361400 direction: Qt.RightToLeft
362401 openedValue: parent.width - sideStage.width
@@ -561,8 +600,14 @@ FocusScope {
561600 }
562601
563602 InputFilterArea {
564− anchors.fill: parent
565− blockInput: !applicationFocused || greeter.shown || lockscreen.shown || launcher.shown
603+ width: {
604+ if (applicationManager.sideStageFocusedApplication && sideStage.shown)
605+ return parent.width - sideStage.width;
606+ else
607+ return parent.width;
608+ }
609+ height: parent.height
610+ blockInput: !applicationManager.mainStageFocusedApplication || greeter.shown || lockscreen.shown || launcher.shown
566611 || panel.indicators.shown || hud.shown
567612 }
568613
@@ -664,7 +709,7 @@ FocusScope {
664709 theHud: hud
665710 anchors.fill: parent
666711 enabled: hud.available
667− applicationIsOnForeground: applicationFocused
712+ applicationIsOnForeground: (stages.shown && mainStage.applications.count > 0) || (stages.shown && sideStage.shown)
668713 }
669714
670715 InputFilterArea {
@@ -696,7 +741,7 @@ FocusScope {
696741 }
697742 onDash: {
698743 if (stages.shown) {
699− stages.hide();
744+ stages.doLauncherHide();
700745 launcher.hide();
701746 }
702747 }