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
=== modified file 'po/com.ubuntu.terminal.pot'
--- po/com.ubuntu.terminal.pot 2015-06-11 21:33:57 +0000
+++ po/com.ubuntu.terminal.pot 2015-06-14 15:46:54 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: \n"9"Project-Id-Version: \n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2015-06-11 23:33+0200\n"11"POT-Creation-Date: 2015-06-14 17:32+0200\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -85,7 +85,7 @@
85msgid "New tab"85msgid "New tab"
86msgstr ""86msgstr ""
8787
88#: ../src/app/qml/TerminalPage.qml:16488#: ../src/app/qml/TerminalPage.qml:166
89msgid "Selection Mode"89msgid "Selection Mode"
90msgstr ""90msgstr ""
9191
9292
=== modified file 'src/app/qml/TerminalInputArea.qml'
--- src/app/qml/TerminalInputArea.qml 2015-03-16 01:28:50 +0000
+++ src/app/qml/TerminalInputArea.qml 2015-06-14 15:46:54 +0000
@@ -39,6 +39,7 @@
3939
40 MultiPointTouchArea {40 MultiPointTouchArea {
41 property bool __moved: false41 property bool __moved: false
42 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.
42 property point __pressPosition: Qt.point(0, 0);43 property point __pressPosition: Qt.point(0, 0);
43 property real __prevDragStepsY: 044 property real __prevDragStepsY: 0
44 property real __prevDragStepsX: 045 property real __prevDragStepsX: 0
@@ -68,19 +69,30 @@
68 }69 }
69 }70 }
7071
72 Timer {
73 id: multiTouchTimer
74 running: false
75 interval: 200
76 }
77
71 maximumTouchPoints: 178 maximumTouchPoints: 1
72 onPressed: {79 onPressed: {
73 touchAreaPressed = true;80 touchAreaPressed = true;
74 __moved = false;81 __moved = false;
82 __multiTouch = false;
75 __prevDragStepsY = 0.0;83 __prevDragStepsY = 0.0;
76 __prevDragStepsX = 0.0;84 __prevDragStepsX = 0.0;
77 __dragging = noDragging;85 __dragging = noDragging;
78 __pressPosition = Qt.point(touchPoints[0].x, touchPoints[0].y);86 __pressPosition = Qt.point(touchPoints[0].x, touchPoints[0].y);
79 pressAndHoldTimer.start();87 pressAndHoldTimer.start();
88 multiTouchTimer.start(); // Detect if this is going to be a multi touch swipe while the timer is running
8089
81 touchPress(touchPoints[0].x, touchPoints[0].y);90 touchPress(touchPoints[0].x, touchPoints[0].y);
82 }91 }
83 onUpdated: {92 onUpdated: {
93 if (__multiTouch || multiTouchTimer.running) // Do not handle multi touch events here and detect multi touch swipes while the timer is running
94 return;
95
84 var dragValue = touchPoints[0].y - __pressPosition.y;96 var dragValue = touchPoints[0].y - __pressPosition.y;
85 var dragValueX = touchPoints[0].x - __pressPosition.x;97 var dragValueX = touchPoints[0].x - __pressPosition.x;
86 var dragSteps = dragValue / swipeDelta;98 var dragSteps = dragValue / swipeDelta;
@@ -126,14 +138,23 @@
126 maximumTouchPoints: 2138 maximumTouchPoints: 2
127 minimumTouchPoints: 2139 minimumTouchPoints: 2
128 onPressed: {140 onPressed: {
141 if (!multiTouchTimer.running) // Already recognized as single touch swipe
142 return;
143
144 __pressPosition = avg(touchPoints[0], touchPoints[1]);
145 __prevDragSteps = 0;
146
129 singleTouchTouchArea.__moved = true;147 singleTouchTouchArea.__moved = true;
130 __pressPosition = Qt.point(touchPoints[0].x, touchPoints[0].y);148 singleTouchTouchArea.__multiTouch = true;
131 }149 }
132 onUpdated: {150 onUpdated: {
133 // WORKAROUND: filter bad events that somehow get here during release.151 // WORKAROUND: filter bad events that somehow get here during release.
134 if (touchPoints.length !== 2)152 if (touchPoints.length !== 2)
135 return;153 return;
136154
155 if (!singleTouchTouchArea.__multiTouch)
156 return;
157
137 var touchPoint = avg(touchPoints[0], touchPoints[1]);158 var touchPoint = avg(touchPoints[0], touchPoints[1]);
138 var dragValue = touchPoint.y - __pressPosition.y;159 var dragValue = touchPoint.y - __pressPosition.y;
139 var dragSteps = dragValue / swipeDelta;160 var dragSteps = dragValue / swipeDelta;
140161
=== modified file 'src/app/qml/TerminalPage.qml'
--- src/app/qml/TerminalPage.qml 2015-03-16 01:28:50 +0000
+++ src/app/qml/TerminalPage.qml 2015-06-14 15:46:54 +0000
@@ -83,13 +83,13 @@
8383
84 function simulateSwipeUp(steps) {84 function simulateSwipeUp(steps) {
85 while(steps > 0) {85 while(steps > 0) {
86 terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, -wheelValue));86 terminal.simulateKeyPress(Qt.Key_Up, Qt.NoModifier, true, 0, "");
87 steps--;87 steps--;
88 }88 }
89 }89 }
90 function simulateSwipeDown(steps) {90 function simulateSwipeDown(steps) {
91 while(steps > 0) {91 while(steps > 0) {
92 terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, wheelValue));92 terminal.simulateKeyPress(Qt.Key_Down, Qt.NoModifier, true, 0, "");
93 steps--;93 steps--;
94 }94 }
95 }95 }
@@ -107,13 +107,13 @@
107 }107 }
108 function simulateDualSwipeUp(steps) {108 function simulateDualSwipeUp(steps) {
109 while(steps > 0) {109 while(steps > 0) {
110 terminal.simulateKeyPress(Qt.Key_Up, Qt.NoModifier, true, 0, "");110 terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, -wheelValue));
111 steps--;111 steps--;
112 }112 }
113 }113 }
114 function simulateDualSwipeDown(steps) {114 function simulateDualSwipeDown(steps) {
115 while(steps > 0) {115 while(steps > 0) {
116 terminal.simulateKeyPress(Qt.Key_Down, Qt.NoModifier, true, 0, "");116 terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, wheelValue));
117 steps--;117 steps--;
118 }118 }
119 }119 }

Subscribers

People subscribed via source and target branches