Remove workaround for macOS TODO

SDL 5340 5976
This commit is contained in:
Romain Vimont
2025-10-12 12:10:33 +02:00
parent e3fb943d03
commit 7698ae6f3d

View File

@@ -81,30 +81,6 @@ sc_mouse_capture_handle_event(struct sc_mouse_capture *mc,
void
sc_mouse_capture_set_active(struct sc_mouse_capture *mc, bool capture) {
#ifdef __APPLE__
// Workaround for SDL bug on macOS:
// <https://github.com/libsdl-org/SDL/issues/5340>
if (capture) {
float mouse_x, mouse_y;
SDL_GetGlobalMouseState(&mouse_x, &mouse_y);
int x, y, w, h;
bool always_ok;
(void) always_ok;
always_ok = SDL_GetWindowPosition(mc->window, &x, &y);
assert(always_ok);
always_ok = SDL_GetWindowSize(mc->window, &w, &h);
assert(always_ok);
bool outside_window = mouse_x < x || mouse_x >= x + w
|| mouse_y < y || mouse_y >= y + h;
if (outside_window) {
SDL_WarpMouseInWindow(mc->window, w / 2, h / 2);
}
}
#endif
bool ok = SDL_SetWindowRelativeMouseMode(mc->window, capture);
if (!ok) {
LOGE("Could not set relative mouse mode to %s: %s",