[PATCH] Potential fix for mouse jumping issues

This commit is contained in:
Andrettin 2017-11-20 10:15:22 +01:00 committed by Tim Felgentreff
parent 7760b6ec7c
commit 8ac2bd9ea9
2 changed files with 22 additions and 10 deletions
src
include
video

View file

@ -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;

View file

@ -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)