From 8ac2bd9ea989e7405060e6134f79c9cc15a3c5bb Mon Sep 17 00:00:00 2001 From: Andrettin <andre.ng@live.com> Date: Mon, 20 Nov 2017 10:15:22 +0100 Subject: [PATCH] [PATCH] Potential fix for mouse jumping issues --- src/include/video.h | 2 -- src/video/sdl.cpp | 30 ++++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/include/video.h b/src/include/video.h index 46df30758..4083e324d 100644 --- a/src/include/video.h +++ b/src/include/video.h @@ -375,9 +375,7 @@ public: int Height; int ViewportWidth; /// Actual width of the window int ViewportHeight; /// Actual height of the window -#if defined(USE_TOUCHSCREEN) && defined(USE_WIN32) SDL_Cursor *blankCursor; -#endif int Depth; int ShaderIndex; bool FullScreen; diff --git a/src/video/sdl.cpp b/src/video/sdl.cpp index bcc1022de..c39f94fa6 100644 --- a/src/video/sdl.cpp +++ b/src/video/sdl.cpp @@ -466,10 +466,14 @@ void InitVideoSdl() Uint32 flags = 0; if (SDL_WasInit(SDL_INIT_VIDEO) == 0) { -#ifndef USE_WIN32 +//Wyrmgus start +//#ifndef USE_WIN32 +//Wyrmgus end // Fix tablet input in full-screen mode SDL_putenv(strdup("SDL_MOUSE_RELATIVE=0")); -#endif +//Wyrmgus start +//#endif +//Wyrmgus end int res = SDL_Init( #ifdef DEBUG SDL_INIT_NOPARACHUTE | @@ -652,17 +656,25 @@ void InitVideoSdl() Video.FullScreen = (TheScreen->flags & SDL_FULLSCREEN) ? 1 : 0; Video.Depth = TheScreen->format->BitsPerPixel; -#if defined(USE_TOUCHSCREEN) && defined(USE_WIN32) +//Wyrmgus start +//#if defined(USE_TOUCHSCREEN) && defined(USE_WIN32) +//Wyrmgus end // Must not allow SDL to switch to relative mouse coordinates // with touchscreen when going fullscreen. So we don't hide the // cursor, but instead set a transparent 1px cursor Uint8 emptyCursor[] = {'\0'}; Video.blankCursor = SDL_CreateCursor(emptyCursor, emptyCursor, 1, 1, 0, 0); SDL_SetCursor(Video.blankCursor); -#else +//Wyrmgus start +//#else +//Wyrmgus end // Turn cursor off, we use our own. - SDL_ShowCursor(SDL_DISABLE); -#endif + //Wyrmgus start +// SDL_ShowCursor(SDL_DISABLE); + //Wyrmgus end +//Wyrmgus start +//#endif +//Wyrmgus end // Make default character translation easier SDL_EnableUNICODE(1); @@ -1174,8 +1186,10 @@ void ToggleFullScreen() // // Windows shows the SDL cursor when starting in fullscreen mode // then switching to window mode. This hides the cursor again. - SDL_ShowCursor(SDL_ENABLE); - SDL_ShowCursor(SDL_DISABLE); + //Wyrmgus start +// SDL_ShowCursor(SDL_ENABLE); +// SDL_ShowCursor(SDL_DISABLE); + //Wyrmgus end #endif #if defined(USE_OPENGL) || defined(USE_GLES)