sdl2_frt/src/joystick
Sam Lantinga ae8ca7c54d Fixed bug 3444 - Android-TV: no more handling of back button on remote
ny00

Unfortunately, simply checking the return codes of "onNativePadDown/Up" as previously done has its own issue:

If an SDL joystick is connected *and* opened, then a proper KeyEvent, say with keycode KEYCODE_BUTTON_1, should lead to an SDL joystick button event as expected.

If, however, the joystick was *not* opened, then "onNativePadDown/Up" will return a negative value, so before the commit from bug 3426, you could unexpectedly get a keyboard event. (In practice, you'll just get a log message, since KEYCODE_BUTTON_1 has no mapping to a proper SDL_ScanCode value, but it's still an problem).

What should still be done, though, is checking the key code itself. We do have the KeyEvent.isGamepadButton method, but according my test, it returns "true" exactly (and only) for the KEYCODE_BUTTON* values, and not for KEYCODE_DPAD* or any other key code.

Here is a possible solution:
- Do check the return codes of "onNativePadDown/Up" as previously done.
- In addition, in "Android_OnPadDown/Up" from src/joystick/android/SDL_sysjoystick.c, 0 should *always* be returned in case the key code can be translated to an SDL_joystick button; Even if no matching joystick can be found.
2016-10-17 22:09:22 -07:00
..
android Fixed bug 3444 - Android-TV: no more handling of back button on remote 2016-10-17 22:09:22 -07:00
bsd Fixed freeing strings created by strdup() with SDL_free(). 2016-06-28 21:08:23 +02:00
darwin Added SDL_PrivateJoystickAdded() and SDL_PrivateJoystickRemoved() 2016-08-26 12:18:08 -07:00
dummy Updated copyright to 2016 2016-01-02 10:10:34 -08:00
emscripten Added SDL_PrivateJoystickAdded() and SDL_PrivateJoystickRemoved() 2016-08-26 12:18:08 -07:00
haiku Fixed freeing strings created by strdup() with SDL_free(). 2016-06-28 21:08:23 +02:00
iphoneos Implemented SDL_GetHintBoolean() to make it easier to check boolean hints 2016-10-07 23:40:44 -07:00
linux Added SDL_PrivateJoystickAdded() and SDL_PrivateJoystickRemoved() 2016-08-26 12:18:08 -07:00
psp Patched to compile on various platforms. 2016-04-12 18:11:36 -04:00
windows Implemented SDL_GetHintBoolean() to make it easier to check boolean hints 2016-10-07 23:40:44 -07:00
SDL_gamecontroller.c Fixed bug 3438 - SDL_GameControllerEventWatcher: Log on event with value >= k_nMaxReverseEntries 2016-10-07 18:24:34 -07:00
SDL_gamecontrollerdb.h Linux: Removed not needed platform info from entry in controller database. 2016-10-16 22:46:56 +02:00
SDL_joystick_c.h Added SDL_PrivateJoystickAdded() and SDL_PrivateJoystickRemoved() 2016-08-26 12:18:08 -07:00
SDL_joystick.c Fixed recentering triggers when the application doesn't have focus 2016-10-07 16:13:37 -07:00
SDL_sysjoystick.h Fixed recentering triggers when the application doesn't have focus 2016-10-07 16:13:37 -07:00
sort_controllers.py