From 21a0e3c111b97035a01b6386a4e9ecda2d2febf8 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 6 Mar 2015 13:37:44 +0100 Subject: [PATCH] Android: don't assume a stationary touchpoint unless all history agrees We need to compare each historical location (not just one of them) against the present location to prove that the touchpoint didn't move. We still don't actually send events for every historical touchpoint location though, because that would multiply the event traffic. Task-number: QTBUG-38379 Change-Id: I4b968ef6877031a157493d0a248564c78195c033 Reviewed-by: BogDan Vatra --- .../jar/src/org/qtproject/qt5/android/QtNative.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 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 8e35840a20..bed9d69782 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -279,12 +279,14 @@ public class QtNative if (action == MotionEvent.ACTION_MOVE) { int hsz = event.getHistorySize(); if (hsz > 0) { - if (event.getX(index) != event.getHistoricalX(index, hsz-1) - || event.getY(index) != event.getHistoricalY(index, hsz-1)) { - return 1; - } else { - return 2; + float x = event.getX(index); + float y = event.getY(index); + for (int h = 0; h < hsz; ++h) { + if ( event.getHistoricalX(index, h) != x || + event.getHistoricalY(index, h) != y ) + return 1; } + return 2; } return 1; }