diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-06-12 10:00:44 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-06-12 10:00:44 +0200 |
commit | e78db2c423be39730058f5cb57cd83cde45887ae (patch) | |
tree | 0f35f5da029199024ba42e0e380a58d1abaa5ff7 | |
parent | b29723444a55b96a8ed4544e6ae4d799d6d4f789 (diff) | |
parent | d14bea4413a0c2945cad288d5361fa56c806b59c (diff) | |
download | redot-engine-e78db2c423be39730058f5cb57cd83cde45887ae.tar.gz |
Merge pull request #93011 from MTareqAzim/fix-android-motion-event-guards
Fix Left Joystick Motion Not Registering on Android
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java index 43ae71f8e1..83e76e49c9 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java +++ b/platform/android/java/lib/src/org/godotengine/godot/input/GodotInputHandler.java @@ -228,16 +228,6 @@ public class GodotInputHandler implements InputManager.InputDeviceListener { public boolean onGenericMotionEvent(MotionEvent event) { lastSeenToolType = getEventToolType(event); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && gestureDetector.onGenericMotionEvent(event)) { - // The gesture detector has handled the event. - return true; - } - - if (godotGestureHandler.onMotionEvent(event)) { - // The gesture handler has handled the event. - return true; - } - if (event.isFromSource(InputDevice.SOURCE_JOYSTICK) && event.getActionMasked() == MotionEvent.ACTION_MOVE) { // Check if the device exists final int deviceId = event.getDeviceId(); @@ -273,11 +263,20 @@ public class GodotInputHandler implements InputManager.InputDeviceListener { } return true; } - } else { - return handleMouseEvent(event); + return false; } - return false; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && gestureDetector.onGenericMotionEvent(event)) { + // The gesture detector has handled the event. + return true; + } + + if (godotGestureHandler.onMotionEvent(event)) { + // The gesture handler has handled the event. + return true; + } + + return handleMouseEvent(event); } public void initInputDevices() { |