From 01d5f1e08541741fdc307516dd73444f57d6551c Mon Sep 17 00:00:00 2001 From: Bim Overbohm Date: Fri, 24 May 2013 15:08:53 +0200 Subject: [PATCH] Hide and unhide mouse cursor via SDL on startup This can also be made permanent by setting the environment variable SDL_NOMOUSE=1 or 0, e.g. in $home/.bashrc --- src/Renderer_init_sdlgl.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Renderer_init_sdlgl.cpp b/src/Renderer_init_sdlgl.cpp index 2bc1b5e9c..8480d8eb0 100644 --- a/src/Renderer_init_sdlgl.cpp +++ b/src/Renderer_init_sdlgl.cpp @@ -20,6 +20,8 @@ extern bool WINDOWED; namespace Renderer { + static bool initialCursorState; + unsigned int display_width = 0; unsigned int display_height = 0; @@ -85,6 +87,9 @@ namespace Renderer LOG(LogInfo) << "Created surface successfully."; + //hide mouse cursor + initialCursorState = SDL_ShowCursor(0); + return true; } @@ -98,6 +103,10 @@ namespace Renderer { SDL_FreeSurface(sdlScreen); sdlScreen = NULL; + + //show mouse cursor + SDL_ShowCursor(initialCursorState); + SDL_Quit(); }