← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~nikwen/ubuntu-terminal-app/swipe-gesture-consistency into lp:ubuntu-terminal-app

 

Niklas Wenzel has proposed merging lp:~nikwen/ubuntu-terminal-app/swipe-gesture-consistency into lp:ubuntu-terminal-app.

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.

Requested reviews:
  Ubuntu Terminal Developers (ubuntu-terminal-dev)
Related bugs:
  Bug #1464566 in Ubuntu Terminal App: "Swipe gestures inconsistent"
  https://bugs.launchpad.net/ubuntu-terminal-app/+bug/1464566

For more details, see:
https://code.launchpad.net/~nikwen/ubuntu-terminal-app/swipe-gesture-consistency/+merge/261913

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.
-- 
Your team Ubuntu Terminal Developers is requested to review the proposed merge of lp:~nikwen/ubuntu-terminal-app/swipe-gesture-consistency into lp:ubuntu-terminal-app.
=== 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 @@
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-06-11 23:33+0200\n"
+"POT-Creation-Date: 2015-06-14 17:32+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -85,7 +85,7 @@
 msgid "New tab"
 msgstr ""
 
-#: ../src/app/qml/TerminalPage.qml:164
+#: ../src/app/qml/TerminalPage.qml:166
 msgid "Selection Mode"
 msgstr ""
 

=== 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 @@
 
     MultiPointTouchArea {
         property bool __moved: false
+        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.
         property point __pressPosition: Qt.point(0, 0);
         property real __prevDragStepsY: 0
         property real __prevDragStepsX: 0
@@ -68,19 +69,30 @@
             }
         }
 
+        Timer {
+            id: multiTouchTimer
+            running: false
+            interval: 200
+        }
+
         maximumTouchPoints: 1
         onPressed: {
             touchAreaPressed = true;
             __moved = false;
+            __multiTouch = false;
             __prevDragStepsY = 0.0;
             __prevDragStepsX = 0.0;
             __dragging = noDragging;
             __pressPosition = Qt.point(touchPoints[0].x, touchPoints[0].y);
             pressAndHoldTimer.start();
+            multiTouchTimer.start(); // Detect if this is going to be a multi touch swipe while the timer is running
 
             touchPress(touchPoints[0].x, touchPoints[0].y);
         }
         onUpdated: {
+            if (__multiTouch || multiTouchTimer.running) // Do not handle multi touch events here and detect multi touch swipes while the timer is running
+                return;
+
             var dragValue = touchPoints[0].y - __pressPosition.y;
             var dragValueX = touchPoints[0].x - __pressPosition.x;
             var dragSteps = dragValue / swipeDelta;
@@ -126,14 +138,23 @@
             maximumTouchPoints: 2
             minimumTouchPoints: 2
             onPressed: {
+                if (!multiTouchTimer.running) // Already recognized as single touch swipe
+                    return;
+
+                __pressPosition = avg(touchPoints[0], touchPoints[1]);
+                __prevDragSteps = 0;
+
                 singleTouchTouchArea.__moved = true;
-                __pressPosition = Qt.point(touchPoints[0].x, touchPoints[0].y);
+                singleTouchTouchArea.__multiTouch = true;
             }
             onUpdated: {
                 // WORKAROUND: filter bad events that somehow get here during release.
                 if (touchPoints.length !== 2)
                     return;
 
+                if (!singleTouchTouchArea.__multiTouch)
+                    return;
+
                 var touchPoint = avg(touchPoints[0], touchPoints[1]);
                 var dragValue = touchPoint.y - __pressPosition.y;
                 var dragSteps = dragValue / swipeDelta;

=== 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 @@
 
         function simulateSwipeUp(steps) {
             while(steps > 0) {
-                terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, -wheelValue));
+                terminal.simulateKeyPress(Qt.Key_Up, Qt.NoModifier, true, 0, "");
                 steps--;
             }
         }
         function simulateSwipeDown(steps) {
             while(steps > 0) {
-                terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, wheelValue));
+                terminal.simulateKeyPress(Qt.Key_Down, Qt.NoModifier, true, 0, "");
                 steps--;
             }
         }
@@ -107,13 +107,13 @@
         }
         function simulateDualSwipeUp(steps) {
             while(steps > 0) {
-                terminal.simulateKeyPress(Qt.Key_Up, Qt.NoModifier, true, 0, "");
+                terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, -wheelValue));
                 steps--;
             }
         }
         function simulateDualSwipeDown(steps) {
             while(steps > 0) {
-                terminal.simulateKeyPress(Qt.Key_Down, Qt.NoModifier, true, 0, "");
+                terminal.simulateWheel(width * 0.5, height * 0.5, Qt.NoButton, Qt.NoModifier, Qt.point(0, wheelValue));
                 steps--;
             }
         }


Follow ups