mirror of
https://github.com/rust-mobile/android-activity.git
synced 2026-07-15 19:18:54 +00:00
game_activity/input: support Pointer::tool_type()
This maintains compatibility with the `ndk` crate's `Pointer` API Ref: https://github.com/rust-windowing/android-ndk-rs/pull/323 This will also be required for enabling pen pressure support to Winit, re: https://github.com/rust-windowing/winit/pull/2396
This commit is contained in:
@@ -890,6 +890,7 @@ static struct {
|
||||
|
||||
jmethodID getPointerCount;
|
||||
jmethodID getPointerId;
|
||||
jmethodID getToolType;
|
||||
jmethodID getRawX;
|
||||
jmethodID getRawY;
|
||||
jmethodID getXPrecision;
|
||||
@@ -941,6 +942,8 @@ extern "C" int GameActivityMotionEvent_fromJava(
|
||||
env->GetMethodID(motionEventClass, "getPointerCount", "()I");
|
||||
gMotionEventClassInfo.getPointerId =
|
||||
env->GetMethodID(motionEventClass, "getPointerId", "(I)I");
|
||||
gMotionEventClassInfo.getToolType =
|
||||
env->GetMethodID(motionEventClass, "getToolType", "(I)I");
|
||||
if (sdkVersion >= 29) {
|
||||
gMotionEventClassInfo.getRawX =
|
||||
env->GetMethodID(motionEventClass, "getRawX", "(I)F");
|
||||
@@ -1001,6 +1004,8 @@ extern "C" int GameActivityMotionEvent_fromJava(
|
||||
out_event->pointers[i] = {
|
||||
/*id=*/env->CallIntMethod(motionEvent,
|
||||
gMotionEventClassInfo.getPointerId, i),
|
||||
/*toolType=*/env->CallIntMethod(motionEvent,
|
||||
gMotionEventClassInfo.getToolType, i),
|
||||
/*axisValues=*/{0},
|
||||
/*rawX=*/gMotionEventClassInfo.getRawX
|
||||
? env->CallFloatMethod(motionEvent,
|
||||
|
||||
Reference in New Issue
Block a user