mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 06:08:35 +00:00
SDL: Fix SDL_SetWindowMouseRect in HiDPI mode
In HiDPI mode, the window coordinates and the drawable area coordinates might be on a different scale. The allowed mouse area needs to be scaled accordingly before passing it to SDL_SetWindowMouseRect(). This fixes bug #13152.
This commit is contained in:
parent
ca2405ed05
commit
31cfac5d6f
@ -168,10 +168,11 @@ void SdlWindow::grabMouse(bool grab) {
|
||||
}
|
||||
|
||||
void SdlWindow::setMouseRect(const Common::Rect &rect) {
|
||||
grabRect.x = rect.left;
|
||||
grabRect.y = rect.top;
|
||||
grabRect.w = rect.width();
|
||||
grabRect.h = rect.height();
|
||||
float dpiScale = getSdlDpiScalingFactor();
|
||||
grabRect.x = (int)(rect.left / dpiScale + 0.5f);
|
||||
grabRect.y = (int)(rect.top / dpiScale + 0.5f);
|
||||
grabRect.w = (int)(rect.width() / dpiScale + 0.5f);
|
||||
grabRect.h = (int)(rect.height() / dpiScale + 0.5f);
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 18)
|
||||
if (_inputGrabState || _lastFlags & fullscreenMask) {
|
||||
|
Loading…
Reference in New Issue
Block a user