Commit c379a10f authored by Sam Lantinga's avatar Sam Lantinga

The valid mouse coordinates actually range from 0 to w-1 and h-1

parent 84c86a8d
...@@ -153,18 +153,22 @@ SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y) ...@@ -153,18 +153,22 @@ SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y)
} }
SDL_GetWindowSize(mouse->focus, &x_max, &y_max); SDL_GetWindowSize(mouse->focus, &x_max, &y_max);
--x_max;
--y_max;
/* make sure that the pointers find themselves inside the windows */ /* make sure that the pointers find themselves inside the windows */
/* only check if mouse->xmax is set ! */ /* only check if mouse->xmax is set ! */
if (x_max && mouse->x > x_max) { if (mouse->x > x_max) {
mouse->x = x_max; mouse->x = x_max;
} else if (mouse->x < 0) { }
if (mouse->x < 0) {
mouse->x = 0; mouse->x = 0;
} }
if (y_max && mouse->y > y_max) { if (mouse->y > y_max) {
mouse->y = y_max; mouse->y = y_max;
} else if (mouse->y < 0) { }
if (mouse->y < 0) {
mouse->y = 0; mouse->y = 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment