From b9773be3b3c5c4347c7a6c86904186ef1f57aaaf Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 9 Feb 2023 18:29:47 -0800 Subject: [PATCH] Don't clamp mouse coordinates until they're fully outside the containing area A window 1920x1080 pixels wide at 125% scaling will have a width and height of 1536x864, but at pixel (1919,1079) the mouse coordinate will be (1535.2,863.2), which is within the bounds of 1536x864, but larger than (1535,863). --- src/events/SDL_mouse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index ca8315f54..a438640de 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -553,14 +553,14 @@ static int SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_ } } - if (mouse->x > (float)x_max) { + if (mouse->x >= (float)(x_max + 1)) { mouse->x = (float)x_max; } if (mouse->x < (float)x_min) { mouse->x = (float)x_min; } - if (mouse->y > (float)y_max) { + if (mouse->y >= (float)(y_max + 1)) { mouse->y = (float)y_max; } if (mouse->y < (float)y_min) {