diff --git a/android-project/src/org/libsdl/app/SDLActivity.java b/android-project/src/org/libsdl/app/SDLActivity.java index adaf15b9d..c3d448437 100644 --- a/android-project/src/org/libsdl/app/SDLActivity.java +++ b/android-project/src/org/libsdl/app/SDLActivity.java @@ -1245,14 +1245,15 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, // SOURCE_JOYSTICK, while its key events arrive from the keyboard source // So, retrieve the device itself and check all of its sources if (SDLActivity.isDeviceSDLJoystick(event.getDeviceId())) { - // Note that we always process a pressed/released button here, as an unopened - // SDL_Joystick's button press should not be processed as a keyboard's key press + // Note that we process events with specific key codes here if (event.getAction() == KeyEvent.ACTION_DOWN) { - SDLActivity.onNativePadDown(event.getDeviceId(), keyCode); - return true; + if (SDLActivity.onNativePadDown(event.getDeviceId(), keyCode) == 0) { + return true; + } } else if (event.getAction() == KeyEvent.ACTION_UP) { - SDLActivity.onNativePadUp(event.getDeviceId(), keyCode); - return true; + if (SDLActivity.onNativePadUp(event.getDeviceId(), keyCode) == 0) { + return true; + } } } diff --git a/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c index 075b65797..a09e9a12c 100644 --- a/src/joystick/android/SDL_sysjoystick.c +++ b/src/joystick/android/SDL_sysjoystick.c @@ -187,8 +187,8 @@ Android_OnPadDown(int device_id, int keycode) item = JoystickByDeviceId(device_id); if (item && item->joystick) { SDL_PrivateJoystickButton(item->joystick, button , SDL_PRESSED); - return 0; } + return 0; } return -1; @@ -203,8 +203,8 @@ Android_OnPadUp(int device_id, int keycode) item = JoystickByDeviceId(device_id); if (item && item->joystick) { SDL_PrivateJoystickButton(item->joystick, button, SDL_RELEASED); - return 0; } + return 0; } return -1;