From 2a873be9cdb35972dc8bacd12653aafc02e835de Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 6 Nov 2025 11:59:47 -0800
Subject: [PATCH] Return false from SDL_SetWindowMouseRect() if it's not
supported
---
src/video/SDL_video.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index d363855446c50..ea1b634a42753 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -4052,6 +4052,10 @@ bool SDL_SetWindowMouseRect(SDL_Window *window, const SDL_Rect *rect)
{
CHECK_WINDOW_MAGIC(window, false);
+ if (!_this->SetWindowMouseRect) {
+ return SDL_Unsupported();
+ }
+
SDL_Rect zero = { 0, 0, 0, 0 };
if (!rect) {
rect = &zero;
@@ -4062,10 +4066,7 @@ bool SDL_SetWindowMouseRect(SDL_Window *window, const SDL_Rect *rect)
}
SDL_memcpy(&window->mouse_rect, rect, sizeof(*rect));
- if (_this->SetWindowMouseRect) {
- return _this->SetWindowMouseRect(_this, window);
- }
- return true;
+ return _this->SetWindowMouseRect(_this, window);
}
const SDL_Rect *SDL_GetWindowMouseRect(SDL_Window *window)