on xenial help sign in
Use a four finger gesture to open the drawer, much like in u7
f71c48aLukáš Tinkl
qml/Shell.qml+29
@@ -320,6 +320,35 @@ StyledItem {
320 panel.applicationMenus.hide();
320 panel.applicationMenus.hide();
321 }
321 }
322 }
322 }
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+ }
323 }
352 }
324
353
325 InputMethod {
354 InputMethod {
tests/qmltests/tst_Shell.qml+28
@@ -2751,5 +2751,33 @@ Rectangle {
2751
2751
2752 tryCompare(panelTitle, "visible", true, undefined, "Panel title should be visible when greeter not shown");
2752 tryCompare(panelTitle, "visible", true, undefined, "Panel title should be visible when greeter not shown");
2753 }
2753 }
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+ }
2754 }
2782 }
2755}
2783}