From 96c6ce2221ad552a3c54a4e0f3618e4023b75eb9 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 9 Feb 2019 05:05:26 +0100 Subject: [PATCH] SDL_CaptureMouse() is available since SDL 2.0.4. --- src/input.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/input.c b/src/input.c index f9fc0f40..ba48a0f8 100644 --- a/src/input.c +++ b/src/input.c @@ -1318,9 +1318,10 @@ int Get_input(int sleep_time) break; case SDL_MOUSEBUTTONDOWN: -#ifdef USE_SDL2 +#if defined(USE_SDL2) && SDL_VERSION_ATLEAST(2, 0, 4) + // SDL_CaptureMouse() is available since SDL 2.0.4. SDL_CaptureMouse(SDL_TRUE); -#else +#elif defined(USE_SDL) SDL_WM_GrabInput(SDL_GRAB_ON); #endif Handle_mouse_click(&event.button); @@ -1328,9 +1329,10 @@ int Get_input(int sleep_time) break; case SDL_MOUSEBUTTONUP: -#ifdef USE_SDL2 +#if defined(USE_SDL2) && SDL_VERSION_ATLEAST(2, 0, 4) + // SDL_CaptureMouse() is available since SDL 2.0.4. SDL_CaptureMouse(SDL_FALSE); -#else +#elif defined(USE_SDL) SDL_WM_GrabInput(SDL_GRAB_OFF); #endif Handle_mouse_release(&event.button);