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 <bogdan@kde.org>
This commit is contained in:
Shawn Rutledge 2015-03-06 13:37:44 +01:00
parent 3ff80d1fe4
commit 21a0e3c111

View File

@ -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;
}