Commit dbd2ced
fix: Fix incorrect handling of unhandled MotionEvent axes on android (#74)
This PR fixes an issue in the Android gamepads plugin where certain
MotionEvent axes
could be incorrectly reported as handled even when no value change
occurred.
Context:
- I am using a wheel controller on a GCS-type drone controller.
- Before this fix, when using axes that were not recognized by the
library,
the plugin still returned `handled=true`, which made it impossible to
choose between using Gamepads or a custom library for the same input.
- The current workaround required modifying MainActivity.kt to call both
Gamepads and a custom input handler, which caused duplicate events.
Changes:
- onMotionEvent now returns `false` if no supported axis has been
processed.
- Ensures unhandled axes can be caught by custom logic, preventing
duplicate
values when integrating with other input systems.
Impact:
- Existing joysticks and gamepads continue to work as before.
- Provides more accurate and flexible event handling for apps consuming
gamepad input.
---------
Co-authored-by: David Linhares <[email protected]>
Co-authored-by: Lukas Klingsbo <[email protected]>1 parent f3c0335 commit dbd2ced
File tree
1 file changed
+6
-3
lines changed- packages/gamepads_android/android/src/main/kotlin/org/flame_engine/gamepads_android
1 file changed
+6
-3
lines changedLines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
49 | 51 | | |
50 | | - | |
| 52 | + | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
0 commit comments