Skip to content

Instantly share code, notes, and snippets.

@shinyquagsire23
Last active January 19, 2022 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinyquagsire23/bc7cd198745e6d305716aaa679f9c19e to your computer and use it in GitHub Desktop.
Save shinyquagsire23/bc7cd198745e6d305716aaa679f9c19e to your computer and use it in GitHub Desktop.
diff -r /home/maxamillion/workspace/qt5_compare/qt-everywhere-src-5.12.2/qtbase/src/android/jar/src/org/qtproject/qt5/android/QtNative.java ./qtbase/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
491a492,495
> float tiltRot = event.getAxisValue(MotionEvent.AXIS_TILT);
> float orientation = event.getAxisValue(MotionEvent.AXIS_ORIENTATION);
> float tiltX = (float) Math.toDegrees(-Math.sin(orientation) * tiltRot);
> float tiltY = (float) Math.toDegrees(Math.cos(orientation) * tiltRot);
493c497
< event.getButtonState(), event.getX(), event.getY(), event.getPressure());
---
> event.getButtonState(), event.getX(), event.getY(), event.getPressure(), tiltX, tiltY, (float)Math.toDegrees(orientation));
1025c1029
< public static native void tabletEvent(int winId, int deviceId, long time, int action, int pointerType, int buttonState, float x, float y, float pressure);
---
> 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);
diff -r /home/maxamillion/workspace/qt5_compare/qt-everywhere-src-5.12.2/qtbase/src/plugins/platforms/android/androidjniinput.cpp ./qtbase/src/plugins/platforms/android/androidjniinput.cpp
321c321
< jint pointerType, jint buttonState, jfloat x, jfloat y, jfloat pressure)
---
> jint pointerType, jint buttonState, jfloat x, jfloat y, jfloat pressure, jfloat tiltX, jfloat tiltY, jfloat rotation)
364c367
< buttons, pressure, 0, 0, 0., 0., 0, deviceId, Qt::NoModifier);
---
> buttons, pressure, tiltX, tiltY, 0., rotation, 0, deviceId, Qt::NoModifier);
869c872
< {"tabletEvent", "(IIJIIIFFF)V", (void *)tabletEvent},
---
> {"tabletEvent", "(IIJIIIFFFFFF)V", (void *)tabletEvent},
@kim-tsai
Copy link

Thanks for the tilt transform is vary helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment