From e36cff0fef7012676c7317a001c82d0fa0c131f4 Mon Sep 17 00:00:00 2001 From: Thomas BERNARD Date: Thu, 21 Dec 2017 01:18:05 +0100 Subject: [PATCH] Hide cursor if we failed to set our 1 pix transparent cursor SDL_ShowCursor() can take SDL_ENABLE / SDL_DISABLE or SDL_QUERY --- src/sdlscreen.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sdlscreen.c b/src/sdlscreen.c index 92ac7e12..7ded3758 100644 --- a/src/sdlscreen.c +++ b/src/sdlscreen.c @@ -96,11 +96,19 @@ void Set_mode_SDL(int *width, int *height, int fullscreen) // Trick borrowed to Barrage (http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg737265.html) : // Showing the cursor but setting it to fully transparent allows us to get absolute mouse coordinates, // this means we can use tablet in fullscreen mode. - SDL_ShowCursor(1); // Hide the SDL mouse cursor, we use our own SDL_FreeCursor(cur); cur = SDL_CreateCursor(&cursorData, &cursorData, 1,1,0,0); - SDL_SetCursor(cur); + if (cur != NULL) + { + SDL_SetCursor(cur); + SDL_ShowCursor(SDL_ENABLE); // show the SDL 1 pixel transparent cursor + } + else + { + // failed to create the 1 pixel transparent cursor + SDL_ShowCursor(SDL_DISABLE); // Hide the SDL mouse cursor, we use our own internal one + } } #if (UPDATE_METHOD == UPDATE_METHOD_CUMULATED)