Replace tri-state functions SDL_EventState(), SDL_GetJoystickEventState(), SDL_GetGamepadEventState(), SDL_ShowCursor()

`SDL_QUERY`, `SDL_IGNORE`, `SDL_ENABLE`, and `SDL_DISABLE` have been removed.

SDL_EventState() has been replaced with SDL_SetEventEnabled()
SDL_GetEventState() has been replaced with SDL_EventEnabled()
SDL_GameControllerEventState has been replaced with SDL_SetGamepadEventsEnabled() and SDL_GamepadEventsEnabled()
SDL_JoystickEventState has been replaced with SDL_SetJoystickEventsEnabled() and SDL_JoystickEventsEnabled()

SDL_ShowCursor() has been split into three functions: SDL_ShowCursor(), SDL_HideCursor(), and SDL_CursorVisible()

Fixes https://github.com/libsdl-org/SDL/issues/6929
This commit is contained in:
Sam Lantinga
2022-12-28 17:06:38 -08:00
parent 9b8208c195
commit 66351fd4ba
36 changed files with 357 additions and 319 deletions

View File

@@ -680,7 +680,7 @@ static EM_BOOL Emscripten_HandleMouseButton(int eventType, const EmscriptenMouse
return 0;
}
return SDL_GetEventState(sdl_event_type) == SDL_ENABLE;
return SDL_EventEnabled(sdl_event_type);
}
static EM_BOOL Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData)
@@ -701,7 +701,7 @@ static EM_BOOL Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseE
}
SDL_SetMouseFocus(eventType == EMSCRIPTEN_EVENT_MOUSEENTER ? window_data->window : NULL);
return SDL_GetEventState(SDL_MOUSEMOTION) == SDL_ENABLE;
return SDL_EventEnabled(SDL_MOUSEMOTION);
}
static EM_BOOL Emscripten_HandleWheel(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData)
@@ -723,7 +723,7 @@ static EM_BOOL Emscripten_HandleWheel(int eventType, const EmscriptenWheelEvent
}
SDL_SendMouseWheel(0, window_data->window, 0, (float)wheelEvent->deltaX, -deltaY, SDL_MOUSEWHEEL_NORMAL);
return SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE;
return SDL_EventEnabled(SDL_MOUSEWHEEL);
}
static EM_BOOL Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent *wheelEvent, void *userData)
@@ -739,7 +739,7 @@ static EM_BOOL Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent
sdl_event_type = (eventType == EMSCRIPTEN_EVENT_FOCUS) ? SDL_WINDOWEVENT_FOCUS_GAINED : SDL_WINDOWEVENT_FOCUS_LOST;
SDL_SendWindowEvent(window_data->window, sdl_event_type, 0, 0);
return SDL_GetEventState(sdl_event_type) == SDL_ENABLE;
return SDL_EventEnabled(sdl_event_type);
}
static EM_BOOL Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)
@@ -772,7 +772,7 @@ static EM_BOOL Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent
SDL_SendTouch(0, deviceId, id, window_data->window, SDL_TRUE, x, y, 1.0f);
/* disable browser scrolling/pinch-to-zoom if app handles touch events */
if (!preventDefault && SDL_GetEventState(SDL_FINGERDOWN) == SDL_ENABLE) {
if (!preventDefault && SDL_EventEnabled(SDL_FINGERDOWN)) {
preventDefault = 1;
}
} else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) {
@@ -822,7 +822,7 @@ static EM_BOOL Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent
is_nav_key = SDL_TRUE;
}
if ((eventType == EMSCRIPTEN_EVENT_KEYDOWN) && (SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) && !is_nav_key) {
if ((eventType == EMSCRIPTEN_EVENT_KEYDOWN) && SDL_EventEnabled(SDL_TEXTINPUT) && !is_nav_key) {
prevent_default = SDL_FALSE;
}
@@ -835,7 +835,7 @@ static EM_BOOL Emscripten_HandleKeyPress(int eventType, const EmscriptenKeyboard
if (Emscripten_ConvertUTF32toUTF8(keyEvent->charCode, text)) {
SDL_SendKeyboardText(text);
}
return SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE;
return SDL_EventEnabled(SDL_TEXTINPUT);
}
static EM_BOOL Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData)