sdl2_frt/src/joystick
Sam Lantinga 059d9e4627 Fixed bug 2950 - wrong axes values are set on joystick initialization
Edward Rudd

Device: Logitech Rumble Gamepad F510 in Xinput mode.

Upon opening the joystick the values of the axes are queried via PollAllValues are not actually set on the device all the time.

This can easily be seen in the testjoystick or testgamecontroller test programs,as the testjoystick shows all axes in the center until one 'tickles' the triggers., and the testgamecontroller will show the triggers as 'on' until on 'tickles' the triggers.

Upon further research the culprit is the SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS hint. In the default value events are ignored until there is an active window, Thus in cases where the joystick system is initialized and controllers opened before the initial window is created & focuses, the initial values will be incorrect.

Here is my current workaround in the game I'm working on porting..

SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
SDL_GameController* gamepad = SDL_GameControllerOpen(index);
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "0");
2017-08-12 17:41:59 -07:00
..
android Fixed bug 3191 - haptic system on android? 2017-08-12 08:15:09 -07:00
bsd
darwin Added SDL hints to filter the set of game controllers reported by SDL 2017-08-09 11:59:29 -07:00
dummy
emscripten Removed unused hint includes. 2017-06-08 22:40:09 +02:00
haiku haiku: Changed header paths to be more compatible. 2017-07-29 23:00:14 +02:00
iphoneos Fixed build on Apple TV 2017-02-02 16:56:02 -08:00
linux Added SDL hints to filter the set of game controllers reported by SDL 2017-08-09 11:59:29 -07:00
psp
windows Added SDL hints to filter the set of game controllers reported by SDL 2017-08-09 11:59:29 -07:00
SDL_gamecontroller.c Fixed compiler warnings on Visual Studio 2013 2017-08-12 00:04:46 -07:00
SDL_gamecontrollerdb.h Fixed bug 3672 - Add joystick to controllerdb 2017-08-09 20:20:35 -07:00
SDL_joystick_c.h Added SDL hints to filter the set of game controllers reported by SDL 2017-08-09 11:59:29 -07:00
SDL_joystick.c Fixed bug 2950 - wrong axes values are set on joystick initialization 2017-08-12 17:41:59 -07:00
SDL_sysjoystick.h Implemented Linux joystick blacklist 2017-04-06 06:30:43 -07:00
sort_controllers.py