on xenial help sign in
Give a visual feedback on right-edge drag with no running apps (LP: #1116207)
commitb74dfe086a98d77a62650b7c2f26a937b2820866 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateTue 16 Jul 2013, 18:28 (13 years ago) parent84d9ad2
3 files changed+35−7
Components/Stage.qml+14 Shell.qml+20−7 tests/qmltests/Components/tst_Stage.qml+1
Components/Stage.qml+14
@@ -39,6 +39,7 @@ Showable {
3939 type == ApplicationInfo.MainStage ? applicationManager.mainStageApplications
4040 : applicationManager.sideStageApplications
4141 property bool fullyShown: false
42+ property bool fullyHidden: true
4243 readonly property var focusedApplication:
4344 type == ApplicationInfo.MainStage ? applicationManager.mainStageFocusedApplication
4445 : applicationManager.sideStageFocusedApplication
@@ -249,6 +250,19 @@ Showable {
249250 }
250251 }
251252
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+
252266
253267 SequentialAnimation {
254268 id: showStartingApplicationAnimation
Shell.qml+20−7
@@ -130,10 +130,18 @@ FocusScope {
130130 Item {
131131 id: underlay
132132 anchors.fill: parent
133− visible: !(panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth)
134− && (stages.fullyHidden
135− || (stages.fullyShown && mainStage.usingScreenshots)
136− || !stages.fullyShown && (mainStage.usingScreenshots || (sideStage.shown && sideStage.usingScreenshots)))
133+
134+ // Whether the underlay is fully covered by opaque UI elements.
135+ property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
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)
140+ && (!stages.fullyHidden && !mainStage.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
137145
138146 Image {
139147 id: backgroundImage
@@ -178,7 +186,7 @@ FocusScope {
178186 }
179187 }
180188
181− // FIXME: only necessary because stagesRevealer.animatedProgress and
189+ // FIXME: only necessary because stagesOuterContainer.showProgress and
182190 // greeterRevealer.animatedProgress are not animated
183191 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
184192 }
@@ -254,6 +262,7 @@ FocusScope {
254262
255263 anchors.fill: parent
256264 fullyShown: stages.fullyShown
265+ fullyHidden: stages.fullyHidden
257266 shouldUseScreenshots: !fullyShown
258267 rightEdgeEnabled: !sideStage.enabled
259268
@@ -338,7 +347,7 @@ FocusScope {
338347 }
339348
340349 DragHandle {
341− id: stagesRevealer
350+ id: stagesDragHandle
342351
343352 anchors.top: parent.top
344353 anchors.bottom: parent.bottom
@@ -346,7 +355,11 @@ FocusScope {
346355
347356 width: shell.edgeSize
348357 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
350363 }
351364 }
352365 }
tests/qmltests/Components/tst_Stage.qml+1
@@ -161,6 +161,7 @@ Rectangle {
161161 applicationManager: fakeAppManager
162162 rightEdgeDraggingAreaWidth: units.gu(2)
163163 fullyShown: true
164+ fullyHidden: false
164165 newApplicationScreenshot: FakeApplicationScreenshot {
165166 id: newAppScreenshot
166167 parent: stage