diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-04-12 16:01:29 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-01-04 14:46:25 +0000 |
commit | 80fa5f6e76acf3e2850cac51f91dbfbd96092b72 (patch) | |
tree | 7c06582a05189a42cb7b284e9abb78fd438c9ae7 /src/plugins | |
parent | 9dd4381b693420a956b1f3b5aa9daff7dd0e45c9 (diff) |
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 <shawn.rutledge@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/android/androidjniinput.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
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}, |