diff --git a/build/android/app/src/main/java/org/libsdl/app/SDLActivity.java b/build/android/app/src/main/java/org/libsdl/app/SDLActivity.java index eef4ee870..9f2342db4 100644 --- a/build/android/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/build/android/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -1327,19 +1327,6 @@ public static boolean handleKeyEvent(View v, int keyCode, KeyEvent event, InputC // Furthermore, it's possible a game controller has SOURCE_KEYBOARD and // SOURCE_JOYSTICK, while its key events arrive from the keyboard source // So, retrieve the device itself and check all of its sources - if (SDLControllerManager.isDeviceSDLJoystick(deviceId)) { - // Note that we process events with specific key codes here - if (event.getAction() == KeyEvent.ACTION_DOWN) { - if (SDLControllerManager.onNativePadDown(deviceId, keyCode) == 0) { - return true; - } - } else if (event.getAction() == KeyEvent.ACTION_UP) { - if (SDLControllerManager.onNativePadUp(deviceId, keyCode) == 0) { - return true; - } - } - } - if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) { if (event.getAction() == KeyEvent.ACTION_DOWN) { if (isTextInputEvent(event)) { @@ -1356,7 +1343,18 @@ public static boolean handleKeyEvent(View v, int keyCode, KeyEvent event, InputC return true; } } - + if (SDLControllerManager.isDeviceSDLJoystick(deviceId)) { + // Note that we process events with specific key codes here + if (event.getAction() == KeyEvent.ACTION_DOWN) { + if (SDLControllerManager.onNativePadDown(deviceId, keyCode) == 0) { + return true; + } + } else if (event.getAction() == KeyEvent.ACTION_UP) { + if (SDLControllerManager.onNativePadUp(deviceId, keyCode) == 0) { + return true; + } + } + } if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) { // on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses // they are ignored here because sending them as mouse input to SDL is messy