From 9d9be456826c777663ee37477531b8c5c1238e50 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 19 Oct 2017 13:54:56 -0700 Subject: [PATCH] Don't use DPAD devices as joystick input on Android --- .../src/org/libsdl/app/SDLControllerManager.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/android-project/src/org/libsdl/app/SDLControllerManager.java b/android-project/src/org/libsdl/app/SDLControllerManager.java index 36294422fc362..6d97fa8e9af66 100644 --- a/android-project/src/org/libsdl/app/SDLControllerManager.java +++ b/android-project/src/org/libsdl/app/SDLControllerManager.java @@ -92,17 +92,16 @@ public static boolean isDeviceSDLJoystick(int deviceId) { if ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) { Log.v(TAG, "Input device " + device.getName() + " is a joystick."); } + /* A lot of things are a DPAD that we don't want to use as a joystick (e.g. gpio input, etc.) if ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) { Log.v(TAG, "Input device " + device.getName() + " is a dpad."); } + */ if ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) { Log.v(TAG, "Input device " + device.getName() + " is a gamepad."); } - return (((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) || - ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) || - ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) - ); + return ((sources & (InputDevice.SOURCE_CLASS_JOYSTICK|InputDevice.SOURCE_GAMEPAD)) != 0); } }