on xenial help sign in
Use a four finger gesture to open the drawer, much like in u7

Approved by: Michael Zanetti, Unity8 CI Bot

commitf71c48a76d2393be322b8f9797085a41677114a1 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateTue 24 Jan 2017, 07:43 (10 years ago) parente5ef87749922ad
2 files changed+57
qml/Shell.qml+29 tests/qmltests/tst_Shell.qml+28
qml/Shell.qml+29
@@ -320,6 +320,35 @@ StyledItem {
320320 panel.applicationMenus.hide();
321321 }
322322 }
323+
324+ TouchGestureArea {
325+ anchors.fill: stage
326+
327+ minimumTouchPoints: 4
328+ maximumTouchPoints: minimumTouchPoints
329+
330+ readonly property bool recognisedPress: status == TouchGestureArea.Recognized &&
331+ touchPoints.length >= minimumTouchPoints &&
332+ touchPoints.length <= maximumTouchPoints
333+ property bool wasPressed: false
334+
335+ onRecognisedPressChanged: {
336+ if (recognisedPress) {
337+ wasPressed = true;
338+ }
339+ }
340+
341+ onStatusChanged: {
342+ if (status !== TouchGestureArea.Recognized) {
343+ if (status === TouchGestureArea.WaitingForTouch) {
344+ if (wasPressed && !dragging) {
345+ launcher.openDrawer(true);
346+ }
347+ }
348+ wasPressed = false;
349+ }
350+ }
351+ }
323352 }
324353
325354 InputMethod {
tests/qmltests/tst_Shell.qml+28
@@ -2751,5 +2751,33 @@ Rectangle {
27512751
27522752 tryCompare(panelTitle, "visible", true, undefined, "Panel title should be visible when greeter not shown");
27532753 }
2754+
2755+ function test_fourFingerTapOpensDrawer_data() {
2756+ return [
2757+ { tag: "1 finger", touchIds: [0], shown: false },
2758+ { tag: "2 finger", touchIds: [0, 1], shown: false },
2759+ { tag: "3 finger", touchIds: [0, 1, 2], shown: false },
2760+ { tag: "4 finger", touchIds: [0, 1, 2, 3], shown: true }
2761+ ];
2762+ }
2763+
2764+ function test_fourFingerTapOpensDrawer(data) {
2765+ loadShell("desktop");
2766+ shell.usageScenario = "desktop";
2767+ waitForRendering(shell);
2768+ swipeAwayGreeter();
2769+
2770+ var stage = findChild(shell, "stage");
2771+ var drawer = findChild(shell, "drawer")
2772+ verify(stage && drawer);
2773+
2774+ multiTouchTap(data.touchIds, stage);
2775+
2776+ if (data.shown) { // if shown, try to also hide it by clicking outside
2777+ tryCompareFunction(function() { return drawer.visible; }, true);
2778+ mouseClick(stage, stage.width-10, stage.height/2, undefined, undefined, 100);
2779+ }
2780+ tryCompareFunction(function() { return drawer.visible; }, false);
2781+ }
27542782 }
27552783}