From 80fa5f6e76acf3e2850cac51f91dbfbd96092b72 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 12 Apr 2016 16:01:29 +0200 Subject: Android: populate TouchPoint rotation and axes correctly We model each TouchPoint contact patch as an ellipse now, which is consistent with Android APIs. Change-Id: I4edfbebfb5e1ab6686dba0ec924bfcfbbd6ff0f4 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/android/androidjniinput.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms/android/androidjniinput.cpp') diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index d3bb089aa4..8372bf6484 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -206,7 +206,8 @@ namespace QtAndroidInput m_touchPoints.clear(); } - static void touchAdd(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint id, jint action, jboolean /*primary*/, jint x, jint y, jfloat size, jfloat pressure) + static void touchAdd(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint id, jint action, jboolean /*primary*/, jint x, jint y, + jfloat major, jfloat minor, jfloat rotation, jfloat pressure) { Qt::TouchPointState state = Qt::TouchPointStationary; switch (action) { @@ -229,12 +230,13 @@ namespace QtAndroidInput QWindowSystemInterface::TouchPoint touchPoint; touchPoint.id = id; touchPoint.pressure = pressure; + touchPoint.rotation = rotation * 180 / M_PI; touchPoint.normalPosition = QPointF(double(x / dw), double(y / dh)); touchPoint.state = state; - touchPoint.area = QRectF(x - double(dw*size) / 2.0, - y - double(dh*size) / 2.0, - double(dw*size), - double(dh*size)); + touchPoint.area = QRectF(x - double(minor), + y - double(major), + double(minor * 2), + double(major * 2)); m_touchPoints.push_back(touchPoint); if (state == Qt::TouchPointPressed) { @@ -817,7 +819,7 @@ namespace QtAndroidInput static JNINativeMethod methods[] = { {"touchBegin","(I)V",(void*)touchBegin}, - {"touchAdd","(IIIZIIFF)V",(void*)touchAdd}, + {"touchAdd","(IIIZIIFFFF)V",(void*)touchAdd}, {"touchEnd","(II)V",(void*)touchEnd}, {"mouseDown", "(III)V", (void *)mouseDown}, {"mouseUp", "(III)V", (void *)mouseUp}, -- cgit v1.2.3