From d3b56d8e326e7a08e4b4e72bd372cbd85b96cef3 Mon Sep 17 00:00:00 2001 From: Andrew Tonner Date: Thu, 19 Jan 2017 05:14:20 -0800 Subject: [PATCH] Fix for intermittent cursor snapping: don't attempt to warp the cursor when it's not in the window --- BasiliskII/src/SDL/video_sdl.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/BasiliskII/src/SDL/video_sdl.cpp b/BasiliskII/src/SDL/video_sdl.cpp index 77c102bc..9ab036cb 100644 --- a/BasiliskII/src/SDL/video_sdl.cpp +++ b/BasiliskII/src/SDL/video_sdl.cpp @@ -1493,6 +1493,14 @@ void video_set_cursor(void) #elif defined(__APPLE__) move = mouse_grabbed; #endif + if (move) { + // when the cursor is not in the window, the cursor position from GetMouseState is not the actual + // cursor position, so do not warp the cursor as we don't want to actually move it. + if (!(SDL_GetAppState() & SDL_APPMOUSEFOCUS)) { + move = false; + } + } + if (move) { int visible = SDL_ShowCursor(-1); if (visible) {