on xenial help sign in
move right edge push area up some levels so it can be used on top of the indicators
commit56c3b8257c22b12b80dfdcc62985116456224fdf authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 23 Nov 2016, 18:36 (10 years ago) parent9571c84
4 files changed+93−35
qml/Components/EdgeBarrierController.qml+1 qml/Shell.qml+29−1 qml/Stage/Stage.qml+14−34 tests/qmltests/tst_Shell.qml+49
qml/Components/EdgeBarrierController.qml+1
@@ -34,6 +34,7 @@ MouseArea {
3434
3535 function push(amount) {
3636 if (!root._containsMouse) {
37+ console.warn("pushing right edge without mouse actually being at right edge!")
3738 return;
3839 }
3940
qml/Shell.qml+29−1
@@ -284,6 +284,7 @@ StyledItem {
284284 applicationManager: ApplicationManager
285285 topLevelSurfaceList: topLevelSurfaceList
286286 inputMethodRect: inputMethod.visibleRect
287+ rightEdgePushProgress: rightEdgeBarrier.progress
287288
288289 property string usageScenario: shell.usageScenario === "phone" || greeter.hasLockedApp
289290 ? "phone"
@@ -660,6 +661,33 @@ StyledItem {
660661 }
661662 ]
662663 }
664+
665+ EdgeBarrier {
666+ id: rightEdgeBarrier
667+ enabled: !greeter.shown
668+
669+ // NB: it does its own positioning according to the specified edge
670+ edge: Qt.RightEdge
671+
672+ onPassed: {
673+ panel.indicators.hide()
674+ }
675+
676+ material: Component {
677+ Item {
678+ Rectangle {
679+ width: parent.height
680+ height: parent.width
681+ rotation: 90
682+ anchors.centerIn: parent
683+ gradient: Gradient {
684+ GradientStop { position: 0.0; color: Qt.rgba(0.16,0.16,0.16,0.5)}
685+ GradientStop { position: 1.0; color: Qt.rgba(0.16,0.16,0.16,0)}
686+ }
687+ }
688+ }
689+ }
690+ }
663691 }
664692
665693 Dialogs {
@@ -741,7 +769,7 @@ StyledItem {
741769
742770 onPushedRightBoundary: {
743771 if (buttons === Qt.NoButton) {
744− stage.pushRightEdge(amount);
772+ rightEdgeBarrier.push(amount);
745773 } else if (buttons === Qt.LeftButton && previewRectangle && previewRectangle.target.canBeMaximizedLeftRight) {
746774 previewRectangle.maximizeRight(amount);
747775 }
qml/Stage/Stage.qml+14−34
@@ -47,6 +47,7 @@ FocusScope {
4747 property int leftMargin: 0
4848 property bool oskEnabled: false
4949 property rect inputMethodRect
50+ property real rightEdgePushProgress: 0
5051
5152 // Configuration
5253 property string mode: "staged"
@@ -126,9 +127,6 @@ FocusScope {
126127 // functions to be called from outside
127128 function updateFocusedAppOrientation() { /* TODO */ }
128129 function updateFocusedAppOrientationAnimated() { /* TODO */}
129− function pushRightEdge(amount) {
130− edgeBarrier.push(amount);
131− }
132130
133131 function closeSpread() {
134132 priv.goneToSpread = false;
@@ -140,6 +138,12 @@ FocusScope {
140138 }
141139 }
142140
141+ onRightEdgePushProgressChanged: {
142+ if (rightEdgePushProgress >= 1) {
143+ priv.goneToSpread = true
144+ }
145+ }
146+
143147 GSettings {
144148 id: lifecycleExceptions
145149 schema.id: "com.canonical.qtmir"
@@ -448,7 +452,7 @@ FocusScope {
448452 PropertyChanges { target: wallpaper; visible: false }
449453 },
450454 State {
451− name: "stagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "staged"
455+ name: "stagedRightEdge"; when: (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "staged"
452456 PropertyChanges {
453457 target: blurLayer;
454458 visible: true;
@@ -458,7 +462,7 @@ FocusScope {
458462 }
459463 },
460464 State {
461− name: "sideStagedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "stagedWithSideStage"
465+ name: "sideStagedRightEdge"; when: (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "stagedWithSideStage"
462466 extend: "stagedRightEdge"
463467 PropertyChanges {
464468 target: sideStage
@@ -467,13 +471,13 @@ FocusScope {
467471 }
468472 },
469473 State {
470− name: "windowedRightEdge"; when: (rightEdgeDragArea.dragging || edgeBarrier.progress > 0) && root.mode == "windowed"
474+ name: "windowedRightEdge"; when: (rightEdgeDragArea.dragging || rightEdgePushProgress > 0) && root.mode == "windowed"
471475 PropertyChanges {
472476 target: blurLayer;
473477 visible: true
474478 blurRadius: 32
475479 brightness: .65
476− opacity: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 0, 1, Math.max(rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0, edgeBarrier.progress))
480+ opacity: MathUtils.linearAnimation(spreadItem.rightEdgeBreakPoint, 1, 0, 1, Math.max(rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0, rightEdgePushProgress))
477481 }
478482 },
479483 State {
@@ -1129,7 +1133,7 @@ FocusScope {
11291133 when: (root.mode == "staged" || root.mode == "stagedWithSideStage") && (root.state == "sideStagedRightEdge" || root.state == "stagedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running)
11301134 PropertyChanges {
11311135 target: stagedRightEdgeMaths
1132− progress: Math.max(edgeBarrier.progress, rightEdgeDragArea.draggedProgress)
1136+ progress: Math.max(rightEdgePushProgress, rightEdgeDragArea.draggedProgress)
11331137 }
11341138 PropertyChanges {
11351139 target: appDelegate
@@ -1156,11 +1160,11 @@ FocusScope {
11561160 },
11571161 State {
11581162 name: "windowedRightEdge"
1159− when: root.mode == "windowed" && (root.state == "windowedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running || edgeBarrier.progress > 0)
1163+ when: root.mode == "windowed" && (root.state == "windowedRightEdge" || rightEdgeFocusAnimation.running || hidingAnimation.running || rightEdgePushProgress > 0)
11601164 PropertyChanges {
11611165 target: windowedRightEdgeMaths
11621166 swipeProgress: rightEdgeDragArea.dragging ? rightEdgeDragArea.progress : 0
1163− pushProgress: edgeBarrier.progress
1167+ pushProgress: rightEdgePushProgress
11641168 }
11651169 PropertyChanges {
11661170 target: appDelegate
@@ -1675,30 +1679,6 @@ FocusScope {
16751679 appContainerHeight: appContainer.height
16761680 }
16771681
1678− EdgeBarrier {
1679− id: edgeBarrier
1680−
1681− // NB: it does its own positioning according to the specified edge
1682− edge: Qt.RightEdge
1683−
1684− onPassed: priv.goneToSpread = true;
1685−
1686− material: Component {
1687− Item {
1688− Rectangle {
1689− width: parent.height
1690− height: parent.width
1691− rotation: 90
1692− anchors.centerIn: parent
1693− gradient: Gradient {
1694− GradientStop { position: 0.0; color: Qt.rgba(0.16,0.16,0.16,0.5)}
1695− GradientStop { position: 1.0; color: Qt.rgba(0.16,0.16,0.16,0)}
1696− }
1697− }
1698− }
1699− }
1700− }
1701−
17021682 MouseArea {
17031683 id: hoverMouseArea
17041684 objectName: "hoverMouseArea"
tests/qmltests/tst_Shell.qml+49
@@ -2698,6 +2698,55 @@ Rectangle {
26982698 tryCompareFunction(function() { return ApplicationManager.focusedApplicationId; }, "calendar-app");
26992699 }
27002700
2701+ function test_rightEdgePushWithOpenIndicators() {
2702+ loadShell("desktop");
2703+ shell.usageScenario = "desktop";
2704+ waitForRendering(shell);
2705+ swipeAwayGreeter();
2706+
2707+ var stage = findChild(shell, "stage");
2708+ var cursor = findChild(shell, "cursor");
2709+ var indicators = findChild(shell, "indicators");
2710+
2711+ // Open indicators
2712+ var touchX = shell.width - units.gu(5);
2713+ touchFlick(shell,
2714+ touchX /* fromX */, indicators.minimizedPanelHeight * 0.5 /* fromY */,
2715+ touchX /* toX */, shell.height * 0.9 /* toY */,
2716+ true /* beginTouch */, true /* endTouch */);
2717+ tryCompare(indicators, "fullyOpened", true);
2718+
2719+ // push the right edge
2720+ mouseMove(shell, shell.width - 1, units.gu(10));
2721+ for (var i = 0; i < units.gu(10); i++) {
2722+ cursor.pushedRightBoundary(1, 0);
2723+ }
2724+ tryCompare(stage, "rightEdgePushProgress", 1);
2725+ tryCompare(stage, "state", "spread");
2726+ tryCompare(indicators, "fullyOpened", false);
2727+
2728+ mouseMove(shell, shell.width - units.gu(5), units.gu(10));
2729+
2730+ tryCompare(stage, "rightEdgePushProgress", 0);
2731+ }
2732+
2733+ function test_rightEdgePushOnGreeter() {
2734+ loadShell("desktop");
2735+ shell.usageScenario = "desktop";
2736+ waitForRendering(shell);
2737+
2738+ var stage = findChild(shell, "stage");
2739+ var cursor = findChild(shell, "cursor");
2740+
2741+ // push the right edge, but verify it doesn't emit any progress
2742+ mouseMove(shell, shell.width - 1, units.gu(10));
2743+ for (var i = 0; i < units.gu(10); i++) {
2744+ cursor.pushedRightBoundary(1, 0);
2745+ compare(stage.rightEdgePushProgress, 0);
2746+ }
2747+ compare(stage.rightEdgePushProgress, 0);
2748+ }
2749+
27012750 function test_oskDisplacesWindow_data() {
27022751 return [
27032752 {tag: "no need to displace", windowHeight: units.gu(10), windowY: units.gu(5), targetDisplacement: units.gu(5), oskEnabled: true},