SDL_JoystickEventState: Make documentation and implementation match.

This changes the `SDL_EVENTS_DISABLED` path's return value from SDL_DISABLE
to SDL_IGNORE to match expectations, but doesn't actually change the ABI,
since these two symbols are both zero.

Fixes https://github.com/libsdl-org/sdlwiki/issues/460
This commit is contained in:
Ryan C. Gordon 2024-05-08 16:35:10 -04:00
parent d499b25a3f
commit 7d60ff9965
No known key found for this signature in database
GPG key ID: FA148B892AB48044
2 changed files with 11 additions and 6 deletions

View file

@ -794,12 +794,17 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
* **WARNING**: Calling this function may delete all events currently in SDL's * **WARNING**: Calling this function may delete all events currently in SDL's
* event queue. * event queue.
* *
* \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE` * While `param` is meant to be one of `SDL_QUERY`, `SDL_IGNORE`, or
* \returns 1 if enabled, 0 if disabled, or a negative error code on failure; * `SDL_ENABLE`, this function accepts any value, with any non-zero value that
* call SDL_GetError() for more information. * isn't `SDL_QUERY` being treated as `SDL_ENABLE`.
* *
* If `state` is `SDL_QUERY` then the current state is returned, * If SDL was built with events disabled (extremely uncommon!), this will
* otherwise the new processing state is returned. * do nothing and always return `SDL_IGNORE`.
*
* \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE`
* \returns If `state` is `SDL_QUERY` then the current state is returned,
* otherwise `state` is returned (even if it was not one of the
* allowed values).
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *

View file

@ -2209,7 +2209,7 @@ void SDL_JoystickUpdate(void)
int SDL_JoystickEventState(int state) int SDL_JoystickEventState(int state)
{ {
#ifdef SDL_EVENTS_DISABLED #ifdef SDL_EVENTS_DISABLED
return SDL_DISABLE; return SDL_IGNORE;
#else #else
const Uint32 event_list[] = { const Uint32 event_list[] = {
SDL_JOYAXISMOTION, SDL_JOYBALLMOTION, SDL_JOYHATMOTION, SDL_JOYAXISMOTION, SDL_JOYBALLMOTION, SDL_JOYHATMOTION,