Merge lp:~nikwen/ubuntu-terminal-app/swipe-gesture-consistency into lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot

Proposed by Niklas Wenzel
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 89
Merged at revision: 89
Proposed branch: lp:~nikwen/ubuntu-terminal-app/swipe-gesture-consistency
Merge into: lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot
Diff against target: 125 lines (+28/-7)
3 files modified
po/com.ubuntu.terminal.pot (+2/-2)
src/app/qml/TerminalInputArea.qml (+22/-1)
src/app/qml/TerminalPage.qml (+4/-4)
To merge this branch: bzr merge lp:~nikwen/ubuntu-terminal-app/swipe-gesture-consistency
Reviewer Review Type Date Requested Status
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+261913@code.launchpad.net

Commit message

Fix swipe gesture inconsistencies by changing the behaviour to using two fingers for scrolling and one finger for key up/down events (see the bug description of LP: #1464566).
Fix issues arising from switching between single and multi touch handlers by detecting whether gestures are going to be single or multi touch before handling them.

Description of the change

Fix swipe gesture inconsistencies by changing the behaviour to using two fingers for scrolling and one finger for key up/down events (see the bug description of LP: #1464566).
Fix issues arising from switching between single and multi touch handlers by detecting whether gestures are going to be single or multi touch before handling them.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

That works great, thanks Niklas!

review: Approve
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Thanks for merging. :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/com.ubuntu.terminal.pot'
2--- po/com.ubuntu.terminal.pot 2015-06-11 21:33:57 +0000
3+++ po/com.ubuntu.terminal.pot 2015-06-14 15:46:54 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: \n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2015-06-11 23:33+0200\n"
9+"POT-Creation-Date: 2015-06-14 17:32+0200\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13@@ -85,7 +85,7 @@
14 msgid "New tab"
15 msgstr ""
16
17-#: ../src/app/qml/TerminalPage.qml:164
18+#: ../src/app/qml/TerminalPage.qml:166
19 msgid "Selection Mode"
20 msgstr ""
21
22
23=== modified file 'src/app/qml/TerminalInputArea.qml'
24--- src/app/qml/TerminalInputArea.qml 2015-03-16 01:28:50 +0000
25+++ src/app/qml/TerminalInputArea.qml 2015-06-14 15:46:54 +0000
26@@ -39,6 +39,7 @@
27
28 MultiPointTouchArea {
29 property bool __moved: false
30+ property bool __multiTouch: false // Decide whether this is a single or multi touch gesture before handling it. Otherwise, we run into problems while switching between the two modes.
31 property point __pressPosition: Qt.point(0, 0);
32 property real __prevDragStepsY: 0
33 property real __prevDragStepsX: 0
34@@ -68,19 +69,30 @@
35 }
36 }
37
38+ Timer {
39+ id: multiTouchTimer
40+ running: false
41+ interval: 200
42+ }
43+
44 maximumTouchPoints: 1
45 onPressed: {
46 touchAreaPressed = true;
47 __moved = false;
48+ __multiTouch = false;
49 __prevDragStepsY = 0.0;
50 __prevDragStepsX = 0.0;
51 __dragging = noDragging;
52 __pressPosition = Qt.point(touchPoints[0].x, touchPoints[0].y);
53 pressAndHoldTimer.start();
54+ multiTouchTimer.start(); // Detect if this is going to be a multi touch swipe while the timer is running
55
56 touchPress(touchPoints[0].x, touchPoints[0].y);
57 }
58 onUpdated: {
59+ if (__multiTouch || multiTouchTimer.running) // Do not handle multi touch events here and detect multi touch swipes while the timer is running
60+ return;
61+
62 var dragValue = touchPoints[0].y - __pressPosition.y;
63 var dragValueX = touchPoints[0].x - __pressPosition.x;
64 var dragSteps = dragValue / swipeDelta;
65@@ -126,14 +138,23 @@
66 maximumTouchPoints: 2
67 minimumTouchPoints: 2
68 onPressed: {
69+ if (!multiTouchTimer.running) // Already recognized as single touch swipe
70+ return;
71+
72+ __pressPosition = avg(touchPoints[0], touchPoints[1]);
73+ __prevDragSteps = 0;
74+
75 singleTouchTouchArea.__moved = true;
76- __pressPosition = Qt.point(touchPoints[0].x, touchPoints[0].y);
77+ singleTouchTouchArea.__multiTouch = true;
78 }
79 onUpdated: {
80 // WORKAROUND: filter bad events that somehow get here during release.
81 if (touchPoints.length !== 2)
82 return;
83
84+ if (!singleTouchTouchArea.__multiTouch)
85+ return;
86+
87 var touchPoint = avg(touchPoints[0], touchPoints[1]);
88 var dragValue = touchPoint.y - __pressPosition.y;
89 var dragSteps = dragValue / swipeDelta;
90
91=== modified file 'src/app/qml/TerminalPage.qml'
92--- src/app/qml/TerminalPage.qml 2015-03-16 01:28:50 +0000
93+++ src/app/qml/TerminalPage.qml 2015-06-14 15:46:54 +0000
94@@ -83,13 +83,13 @@
95
96 function simulateSwipeUp(steps) {
97 while(steps > 0) {
98- terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, -wheelValue));
99+ terminal.simulateKeyPress(Qt.Key_Up, Qt.NoModifier, true, 0, "");
100 steps--;
101 }
102 }
103 function simulateSwipeDown(steps) {
104 while(steps > 0) {
105- terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, wheelValue));
106+ terminal.simulateKeyPress(Qt.Key_Down, Qt.NoModifier, true, 0, "");
107 steps--;
108 }
109 }
110@@ -107,13 +107,13 @@
111 }
112 function simulateDualSwipeUp(steps) {
113 while(steps > 0) {
114- terminal.simulateKeyPress(Qt.Key_Up, Qt.NoModifier, true, 0, "");
115+ terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, -wheelValue));
116 steps--;
117 }
118 }
119 function simulateDualSwipeDown(steps) {
120 while(steps > 0) {
121- terminal.simulateKeyPress(Qt.Key_Down, Qt.NoModifier, true, 0, "");
122+ terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, wheelValue));
123 steps--;
124 }
125 }

Subscribers

People subscribed via source and target branches