Add a verification layer for the gamepad.

This commit is contained in:
Boulay Mathias 2022-09-16 18:59:09 +02:00
parent 00435f2fd7
commit 9aea2065ce

View File

@ -265,8 +265,10 @@ public class Gamepad {
}
public static boolean isGamepadEvent(KeyEvent event){
return ((event.getDevice().getSources() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD
&& GamepadDpad.isDpadEvent(event) );
boolean isGamepad = ((event.getSource() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD)
|| ((event.getDevice() != null) && ((event.getDevice().getSources() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD));
return isGamepad && GamepadDpad.isDpadEvent(event);
}
/**