Warning, /graphics/krita/3rdparty/ext_qt/0003-Add-support-for-pen-tilt-rotation-for-Android.patch is written in an unsupported language. File is not indexed.
0001 From d9e72f135cdcc9cd2e7d366cf88149daeac4e606 Mon Sep 17 00:00:00 2001 0002 From: Max Thomas <mtinc2@gmail.com> 0003 Date: Wed, 8 Jan 2020 10:34:10 -0700 0004 Subject: [PATCH 03/46] Add support for pen tilt/rotation for Android 0005 0006 Change-Id: I195c891b47841ac86048dc38ea95beaeced8b70a 0007 --- 0008 .../jar/src/org/qtproject/qt5/android/QtNative.java | 9 +++++++-- 0009 src/plugins/platforms/android/androidjniinput.cpp | 6 +++--- 0010 2 files changed, 10 insertions(+), 5 deletions(-) 0011 0012 diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java 0013 index 6d4ef654d3..7b28fdb407 100644 0014 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java 0015 +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java 0016 @@ -490,8 +490,13 @@ public class QtNative 0017 if (event.getToolType(0) == MotionEvent.TOOL_TYPE_MOUSE) { 0018 sendMouseEvent(event, id); 0019 } else if (m_tabletEventSupported && pointerType != 0) { 0020 + float tiltRot = event.getAxisValue(MotionEvent.AXIS_TILT); 0021 + float orientation = event.getAxisValue(MotionEvent.AXIS_ORIENTATION); 0022 + float tiltX = (float) Math.toDegrees(-Math.sin(orientation) * tiltRot); 0023 + float tiltY = (float) Math.toDegrees(Math.cos(orientation) * tiltRot); 0024 tabletEvent(id, event.getDeviceId(), event.getEventTime(), event.getAction(), pointerType, 0025 - event.getButtonState(), event.getX(), event.getY(), event.getPressure()); 0026 + event.getButtonState(), event.getX(), event.getY(), event.getPressure(), tiltX, tiltY, 0027 + (float) Math.toDegrees(orientation)); 0028 } else { 0029 touchBegin(id); 0030 for (int i = 0; i < event.getPointerCount(); ++i) { 0031 @@ -1045,7 +1050,7 @@ public class QtNative 0032 0033 // tablet methods 0034 public static native boolean isTabletEventSupported(); 0035 - public static native void tabletEvent(int winId, int deviceId, long time, int action, int pointerType, int buttonState, float x, float y, float pressure); 0036 + public static native void tabletEvent(int winId, int deviceId, long time, int action, int pointerType, int buttonState, float x, float y, float pressure, float tiltX, float tiltY, float rotation); 0037 // tablet methods 0038 0039 // keyboard methods 0040 diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp 0041 index a5bd1a58d1..0e74468266 100644 0042 --- a/src/plugins/platforms/android/androidjniinput.cpp 0043 +++ b/src/plugins/platforms/android/androidjniinput.cpp 0044 @@ -323,7 +323,7 @@ namespace QtAndroidInput 0045 } 0046 0047 static void tabletEvent(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint deviceId, jlong time, jint action, 0048 - jint pointerType, jint buttonState, jfloat x, jfloat y, jfloat pressure) 0049 + jint pointerType, jint buttonState, jfloat x, jfloat y, jfloat pressure, jfloat tiltX, jfloat tiltY, jfloat rotation) 0050 { 0051 #if QT_CONFIG(tabletevent) 0052 QPointF globalPosF(x, y); 0053 @@ -371,7 +371,7 @@ namespace QtAndroidInput 0054 0055 QWindowSystemInterface::handleTabletEvent(tlw, ulong(time), 0056 localPos, globalPosF, QTabletEvent::Stylus, pointerType, 0057 - buttons, pressure, 0, 0, 0., 0., 0, deviceId, Qt::NoModifier); 0058 + buttons, pressure, tiltX, tiltY, 0., rotation, 0, deviceId, Qt::NoModifier); 0059 #endif // QT_CONFIG(tabletevent) 0060 } 0061 0062 @@ -876,7 +876,7 @@ namespace QtAndroidInput 0063 {"mouseWheel", "(IIIFF)V", (void *)mouseWheel}, 0064 {"longPress", "(III)V", (void *)longPress}, 0065 {"isTabletEventSupported", "()Z", (void *)isTabletEventSupported}, 0066 - {"tabletEvent", "(IIJIIIFFF)V", (void *)tabletEvent}, 0067 + {"tabletEvent", "(IIJIIIFFFFFF)V", (void *)tabletEvent}, 0068 {"keyDown", "(IIIZ)V", (void *)keyDown}, 0069 {"keyUp", "(IIIZ)V", (void *)keyUp}, 0070 {"keyboardVisibilityChanged", "(Z)V", (void *)keyboardVisibilityChanged}, 0071 -- 0072 2.33.0 0073