Android: minor change in the evaluation of SOURCE_CLASS_JOYSTICK (no op!)
authorSylvain Becker <sylvain.becker@gmail.com>
Thu, 17 Jan 2019 13:42:13 +0100
changeset 125588ca43abe9870
parent 12557 09698ac34c0e
child 12559 d88be7fb81a0
Android: minor change in the evaluation of SOURCE_CLASS_JOYSTICK (no op!)

InputDevice.SOURCE_CLASS_* are one bit
More readable to check that the source has this class_joystick set,
compared to the other statements, where the source is gamepad or dpad.
(Clean-up from bug 3958)
android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java
     1.1 --- a/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java	Thu Jan 17 12:25:19 2019 +0100
     1.2 +++ b/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java	Thu Jan 17 13:42:13 2019 +0100
     1.3 @@ -99,8 +99,8 @@
     1.4  
     1.5          /* This is called for every button press, so let's not spam the logs */
     1.6          /**
     1.7 -        if ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) {
     1.8 -            Log.v(TAG, "Input device " + device.getName() + " is a joystick.");
     1.9 +        if ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
    1.10 +            Log.v(TAG, "Input device " + device.getName() + " has class joystick.");
    1.11          }
    1.12          if ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) {
    1.13              Log.v(TAG, "Input device " + device.getName() + " is a dpad.");
    1.14 @@ -110,7 +110,7 @@
    1.15          }
    1.16          **/
    1.17  
    1.18 -        return (((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) ||
    1.19 +        return ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) != 0 ||
    1.20                  ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) ||
    1.21                  ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD)
    1.22          );