SDL: Fix warping mouse on macOS HiDPI screens

This fixes bug #12822.
This commit is contained in:
Thierry Crozat 2021-08-20 00:16:03 +01:00
parent feac996b50
commit 9449e177f4

View file

@ -197,6 +197,9 @@ bool SdlWindow::warpMouseInWindow(int x, int y) {
if (hasMouseFocus()) { if (hasMouseFocus()) {
#if SDL_VERSION_ATLEAST(2, 0, 0) #if SDL_VERSION_ATLEAST(2, 0, 0)
if (_window) { if (_window) {
float dpiScale = getSdlDpiScalingFactor();
x = (int)(x / dpiScale + 0.5f);
y = (int)(y / dpiScale + 0.5f);
SDL_WarpMouseInWindow(_window, x, y); SDL_WarpMouseInWindow(_window, x, y);
return true; return true;
} }