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).
This commit is contained in:
Sam Lantinga 2023-02-09 18:29:47 -08:00
parent 5b77ad54c4
commit b9773be3b3

View file

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