slackbuilds_ponce/libraries/agar/463ea0a-sdl_hint_mouse_auto_capture.diff
B. Watson 4355ab5e59
libraries/agar: Added (GUI toolkit)
Signed-off-by: bedlam <dave@slackbuilds.org>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2023-05-27 08:08:48 +07:00

33 lines
1.1 KiB
Diff

diff --git a/gui/drv_sdl2mw.c b/gui/drv_sdl2mw.c
index a196e1e4e..ddf89d537 100644
--- a/gui/drv_sdl2mw.c
+++ b/gui/drv_sdl2mw.c
@@ -150,10 +150,11 @@ SDL2MW_Open(void *_Nonnull obj, const char *_Nullable spec)
drv->flags |= AG_DRIVER_WINDOW_BG;
if (nDrivers == 0) { /* Root driver instance */
+#ifdef SDL_HINT_MOUSE_AUTO_CAPTURE
if (AG_Defined(drv, "noAutoCapture") &&
AG_GetInt(drv, "noAutoCapture"))
SDL_SetHint(SDL_HINT_MOUSE_AUTO_CAPTURE, "0");
-
+#endif
/* Enable the joystick subsystem if requested. */
if (AG_Defined(drv, "ctrl")) {
Uint32 sdlFlags = SDL_INIT_GAMECONTROLLER;
@@ -753,6 +754,7 @@ SDL2MW_SetWindowMaxSize(AG_Window *_Nonnull win, int w, int h)
static void
SDL2MW_SetMouseAutoCapture(void *_Nonnull obj, int state)
{
+#ifdef SDL_HINT_MOUSE_AUTO_CAPTURE
if (state == 0) {
SDL_SetHint(SDL_HINT_MOUSE_AUTO_CAPTURE, "0");
} else if (state == -1) {
@@ -760,6 +762,7 @@ SDL2MW_SetMouseAutoCapture(void *_Nonnull obj, int state)
} else {
SDL_SetHint(SDL_HINT_MOUSE_AUTO_CAPTURE, "1");
}
+#endif
}
#if defined(AG_WIDGETS) && defined(AG_DEBUG)