diff options
author | Paul Olav Tvete <paul.tvete@digia.com> | 2013-03-06 18:01:37 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-12 09:16:42 +0100 |
commit | 5e907919d77fec0a92905d29764a56ee282cfcee (patch) | |
tree | 6a60fbc557b3b9a0141362df2fe5dac759787a1c /src/android | |
parent | 638d9d3831357f80800a2fae4925f71648907f30 (diff) | |
download | qtbase-5e907919d77fec0a92905d29764a56ee282cfcee.tar.gz |
Android: Allow more than three touch points
Now that we do not support Android versions below API level 9, we
can use the modern multi-touch functions.
Change-Id: I5887b4c35f9e02089a334526cebecf0cf767bd6c
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/android')
-rw-r--r-- | src/android/jar/src/org/qtproject/qt5/android/QtNative.java | 48 |
1 files changed, 7 insertions, 41 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index 346bc1221a..7cb3fdff45 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -279,10 +279,10 @@ public class QtNative }); } - //@ANDROID-5 + //@ANDROID-9 static private int getAction(int index, MotionEvent event) { - int action = event.getAction(); + int action = event.getActionMasked(); if (action == MotionEvent.ACTION_MOVE) { int hsz = event.getHistorySize(); if (hsz > 0) { @@ -295,48 +295,14 @@ public class QtNative } return 1; } - - switch (index) { - case 0: - if (action == MotionEvent.ACTION_DOWN - || action == MotionEvent.ACTION_POINTER_1_DOWN) { - return 0; - } - - if (action == MotionEvent.ACTION_UP - || action == MotionEvent.ACTION_POINTER_1_UP) { - return 3; - } - break; - - case 1: - if (action == MotionEvent.ACTION_POINTER_2_DOWN - || action == MotionEvent.ACTION_POINTER_DOWN) { - return 0; - } - - if (action == MotionEvent.ACTION_POINTER_2_UP - || action == MotionEvent.ACTION_POINTER_UP) { - return 3; - } - break; - - case 2: - if (action == MotionEvent.ACTION_POINTER_3_DOWN - || action == MotionEvent.ACTION_POINTER_DOWN) { - return 0; - } - - if (action == MotionEvent.ACTION_POINTER_3_UP - || action == MotionEvent.ACTION_POINTER_UP) { - return 3; - } - - break; + if (action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_POINTER_DOWN && index == event.getActionIndex()) { + return 0; + } else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_POINTER_UP && index == event.getActionIndex()) { + return 3; } return 2; } - //@ANDROID-5 + //@ANDROID-9 static public void sendTouchEvent(MotionEvent event, int id) { |