Don't warp the mouse for relative mode when the window doesn't have focus

This commit is contained in:
Sam Lantinga
2021-08-13 11:39:41 -07:00
parent 629e9f820a
commit b28ed02803
2 changed files with 5 additions and 2 deletions

View File

@@ -358,7 +358,9 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ
mouse->last_y = center_y;
return 0;
}
SDL_WarpMouseInWindow(window, center_x, center_y);
if (window && (window->flags & SDL_WINDOW_INPUT_FOCUS) != 0) {
SDL_WarpMouseInWindow(window, center_x, center_y);
}
}
if (relative) {