Fixed mouse clip rect bounds on Windows

Fixes https://github.com/libsdl-org/SDL/issues/5946
This commit is contained in:
Sam Lantinga 2022-07-24 11:50:14 -07:00
parent 6bcde52d88
commit 4d8bb89c46
1 changed files with 2 additions and 2 deletions

View File

@ -1296,8 +1296,8 @@ WIN_UpdateClipCursor(SDL_Window *window)
/* mouse_rect is the rect in Windows screen space */ /* mouse_rect is the rect in Windows screen space */
mouse_rect.left = rect.left + mouse_rect_win_client.x; mouse_rect.left = rect.left + mouse_rect_win_client.x;
mouse_rect.top = rect.top + mouse_rect_win_client.y; mouse_rect.top = rect.top + mouse_rect_win_client.y;
mouse_rect.right = mouse_rect.left + mouse_rect_win_client.w - 1; mouse_rect.right = mouse_rect.left + mouse_rect_win_client.w;
mouse_rect.bottom = mouse_rect.top + mouse_rect_win_client.h - 1; mouse_rect.bottom = mouse_rect.top + mouse_rect_win_client.h;
if (IntersectRect(&intersection, &rect, &mouse_rect)) { if (IntersectRect(&intersection, &rect, &mouse_rect)) {
SDL_memcpy(&rect, &intersection, sizeof(rect)); SDL_memcpy(&rect, &intersection, sizeof(rect));
} else if ((window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) { } else if ((window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0) {