on xenial help sign in
Give a visual feedback on right-edge drag with no running apps (LP: #1116207)
b74dfe0Daniel d'Andrada
Components/Stage.qml+14
@@ -39,6 +39,7 @@ Showable {
39 type == ApplicationInfo.MainStage ? applicationManager.mainStageApplications
39 type == ApplicationInfo.MainStage ? applicationManager.mainStageApplications
40 : applicationManager.sideStageApplications
40 : applicationManager.sideStageApplications
41 property bool fullyShown: false
41 property bool fullyShown: false
42+ property bool fullyHidden: true
42 readonly property var focusedApplication:
43 readonly property var focusedApplication:
43 type == ApplicationInfo.MainStage ? applicationManager.mainStageFocusedApplication
44 type == ApplicationInfo.MainStage ? applicationManager.mainStageFocusedApplication
44 : applicationManager.sideStageFocusedApplication
45 : applicationManager.sideStageFocusedApplication
@@ -249,6 +250,19 @@ Showable {
249 }
250 }
250 }
251 }
251
252
253+ Connections {
254+ target: stage.applications
255+ onCountChanged: { __discardObsoleteScreenshots(); }
256+ ignoreUnknownSignals: true
257+ }
258+ onFullyHiddenChanged: { __discardObsoleteScreenshots(); }
259+ function __discardObsoleteScreenshots() {
260+ if (stage.fullyHidden && stage.applications && stage.applications.count == 0) {
261+ stage.focusedApplicationWhenUsingScreenshots = undefined;
262+ stage.__hideScreenshots();
263+ }
264+ }
265+
252
266
253 SequentialAnimation {
267 SequentialAnimation {
254 id: showStartingApplicationAnimation
268 id: showStartingApplicationAnimation
Shell.qml+20−7
@@ -130,10 +130,18 @@ FocusScope {
130 Item {
130 Item {
131 id: underlay
131 id: underlay
132 anchors.fill: parent
132 anchors.fill: parent
133+
134+ // Whether the underlay is fully covered by opaque UI elements.
133− visible: !(panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth)
135+ property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
134− && (stages.fullyHidden
136+
137+ // Whether the user should see the topmost application surface (if there's one at all).
138+ property bool applicationSurfaceShouldBeSeen:
139+ (mainStage.applications && mainStage.applications.count > 0)
135− || (stages.fullyShown && mainStage.usingScreenshots)
140+ && (!stages.fullyHidden && !mainStage.usingScreenshots)
136− || !stages.fullyShown && (mainStage.usingScreenshots || (sideStage.shown && sideStage.usingScreenshots)))
141+
142+ // NB! Application surfaces are stacked behing the shell one. So they can only be seen by the user
143+ // through the translucent parts of the shell surface.
144+ visible: !fullyCovered && !applicationSurfaceShouldBeSeen
137
145
138 Image {
146 Image {
139 id: backgroundImage
147 id: backgroundImage
@@ -178,7 +186,7 @@ FocusScope {
178 }
186 }
179 }
187 }
180
188
181− // FIXME: only necessary because stagesRevealer.animatedProgress and
189+ // FIXME: only necessary because stagesOuterContainer.showProgress and
182 // greeterRevealer.animatedProgress are not animated
190 // greeterRevealer.animatedProgress are not animated
183 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
191 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
184 }
192 }
@@ -254,6 +262,7 @@ FocusScope {
254
262
255 anchors.fill: parent
263 anchors.fill: parent
256 fullyShown: stages.fullyShown
264 fullyShown: stages.fullyShown
265+ fullyHidden: stages.fullyHidden
257 shouldUseScreenshots: !fullyShown
266 shouldUseScreenshots: !fullyShown
258 rightEdgeEnabled: !sideStage.enabled
267 rightEdgeEnabled: !sideStage.enabled
259
268
@@ -338,7 +347,7 @@ FocusScope {
338 }
347 }
339
348
340 DragHandle {
349 DragHandle {
341− id: stagesRevealer
350+ id: stagesDragHandle
342
351
343 anchors.top: parent.top
352 anchors.top: parent.top
344 anchors.bottom: parent.bottom
353 anchors.bottom: parent.bottom
@@ -346,7 +355,11 @@ FocusScope {
346
355
347 width: shell.edgeSize
356 width: shell.edgeSize
348 direction: Direction.Leftwards
357 direction: Direction.Leftwards
349− enabled: mainStage.applications.count > 0 || sideStage.applications.count > 0
358+ property bool haveApps: mainStage.applications.count > 0 || sideStage.applications.count > 0
359+
360+ maxTotalDragDistance: haveApps ? parent.width : parent.width * 0.7
361+ // Make autocompletion impossible when !haveApps
362+ edgeDragEvaluator.minDragDistance: haveApps ? maxTotalDragDistance * 0.1 : Number.MAX_VALUE
350 }
363 }
351 }
364 }
352 }
365 }
tests/qmltests/Components/tst_Stage.qml+1
@@ -161,6 +161,7 @@ Rectangle {
161 applicationManager: fakeAppManager
161 applicationManager: fakeAppManager
162 rightEdgeDraggingAreaWidth: units.gu(2)
162 rightEdgeDraggingAreaWidth: units.gu(2)
163 fullyShown: true
163 fullyShown: true
164+ fullyHidden: false
164 newApplicationScreenshot: FakeApplicationScreenshot {
165 newApplicationScreenshot: FakeApplicationScreenshot {
165 id: newAppScreenshot
166 id: newAppScreenshot
166 parent: stage
167 parent: stage