diff --git a/src/modules/joystick/sdl/JoystickSDL3.cpp b/src/modules/joystick/sdl/JoystickSDL3.cpp index d671cd4a5..3b6d4b7a4 100644 --- a/src/modules/joystick/sdl/JoystickSDL3.cpp +++ b/src/modules/joystick/sdl/JoystickSDL3.cpp @@ -334,14 +334,13 @@ Joystick::JoystickInput Joystick::getGamepadMapping(const GamepadInput &input) c int bindcount = 0; SDL_GamepadBinding **sdlbindings = SDL_GetGamepadBindings(controller, &bindcount); - const SDL_GamepadBinding *sdlbinding = nullptr; for (int i = 0; i < bindcount; i++) { const SDL_GamepadBinding *b = sdlbindings[i]; - if ((input.type == INPUT_TYPE_BUTTON && b->outputType == SDL_GAMEPAD_BINDTYPE_BUTTON && b->output.button == sdlbutton) - || (input.type == INPUT_TYPE_AXIS && b->outputType == SDL_GAMEPAD_BINDTYPE_AXIS && b->output.axis.axis == sdlaxis)) + if ((input.type == INPUT_TYPE_BUTTON && b->output_type == SDL_GAMEPAD_BINDTYPE_BUTTON && b->output.button == sdlbutton) + || (input.type == INPUT_TYPE_AXIS && b->output_type == SDL_GAMEPAD_BINDTYPE_AXIS && b->output.axis.axis == sdlaxis)) { - switch (b->inputType) + switch (b->input_type) { case SDL_GAMEPAD_BINDTYPE_BUTTON: jinput.type = INPUT_TYPE_BUTTON; diff --git a/src/modules/window/sdl/Window.cpp b/src/modules/window/sdl/Window.cpp index 31f0db984..3b35e0fbb 100644 --- a/src/modules/window/sdl/Window.cpp +++ b/src/modules/window/sdl/Window.cpp @@ -1512,13 +1512,21 @@ void Window::setMouseGrab(bool grab) { mouseGrabbed = grab; if (window) +#if SDL_VERSION_ATLEAST(3, 0, 0) + SDL_SetWindowMouseGrab(window, (SDL_bool) grab); +#else SDL_SetWindowGrab(window, (SDL_bool) grab); +#endif } bool Window::isMouseGrabbed() const { if (window) +#if SDL_VERSION_ATLEAST(3, 0, 0) + return SDL_GetWindowMouseGrab(window); +#else return SDL_GetWindowGrab(window) != SDL_FALSE; +#endif else return mouseGrabbed; } @@ -1684,7 +1692,11 @@ int Window::showMessageBox(const MessageBoxData &data) { SDL_MessageBoxButtonData sdlbutton = {}; +#if SDL_VERSION_ATLEAST(3, 0, 0) + sdlbutton.buttonID = i; +#else sdlbutton.buttonid = i; +#endif sdlbutton.text = data.buttons[i].c_str(); if (i == data.enterButtonIndex)