Fix for intermittent cursor snapping: don't attempt to warp the cursor when it's not in the window

This commit is contained in:
Andrew Tonner 2017-01-19 05:14:20 -08:00
parent d8f5d43a9c
commit d3b56d8e32
1 changed files with 8 additions and 0 deletions

View File

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