Skip to content

Commit ca072c9

Browse files
committed
Don't do anything if the window mouse rect hasn't changed
1 parent de5b8a1 commit ca072c9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/video/SDL_video.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4052,11 +4052,15 @@ bool SDL_SetWindowMouseRect(SDL_Window *window, const SDL_Rect *rect)
40524052
{
40534053
CHECK_WINDOW_MAGIC(window, false);
40544054

4055-
if (rect) {
4056-
SDL_memcpy(&window->mouse_rect, rect, sizeof(*rect));
4057-
} else {
4058-
SDL_zero(window->mouse_rect);
4055+
SDL_Rect zero = { 0, 0, 0, 0 };
4056+
if (!rect) {
4057+
rect = &zero;
4058+
}
4059+
4060+
if (SDL_memcmp(&window->mouse_rect, rect, sizeof(*rect)) == 0) {
4061+
return true;
40594062
}
4063+
SDL_memcpy(&window->mouse_rect, rect, sizeof(*rect));
40604064

40614065
if (_this->SetWindowMouseRect) {
40624066
return _this->SetWindowMouseRect(_this, window);

0 commit comments

Comments
 (0)