From 199c044a5dc872f03f8e74cbb50deea008a0b67c Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Wed, 30 Sep 2026 11:04:18 -0400
Subject: [PATCH] video: Return the unsupported error for more unsupported
operations
Toggling window borders, the resizable state, and always-on-top would always return success, even if the operations were unsupported by the backend, and these functions were no-ops.
---
src/video/SDL_video.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 890d3637a0224..1960d5f2acf24 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -3146,9 +3146,13 @@ bool SDL_SetWindowBordered(SDL_Window *window, bool bordered)
CHECK_WINDOW_MAGIC(window, false);
CHECK_WINDOW_NOT_POPUP(window, false);
- const bool want = (bordered != false); // normalize the flag.
+ if (!_this->SetWindowBordered) {
+ return SDL_Unsupported();
+ }
+
+ const bool want = bordered;
const bool have = !(window->flags & SDL_WINDOW_BORDERLESS);
- if ((want != have) && (_this->SetWindowBordered)) {
+ if (want != have) {
if (want) {
window->flags &= ~SDL_WINDOW_BORDERLESS;
} else {
@@ -3165,9 +3169,13 @@ bool SDL_SetWindowResizable(SDL_Window *window, bool resizable)
CHECK_WINDOW_MAGIC(window, false);
CHECK_WINDOW_NOT_POPUP(window, false);
- const bool want = (resizable != false); // normalize the flag.
+ if (!_this->SetWindowResizable) {
+ return SDL_Unsupported();
+ }
+
+ const bool want = resizable;
const bool have = ((window->flags & SDL_WINDOW_RESIZABLE) != 0);
- if ((want != have) && (_this->SetWindowResizable)) {
+ if (want != have) {
if (want) {
window->flags |= SDL_WINDOW_RESIZABLE;
} else {
@@ -3185,9 +3193,13 @@ bool SDL_SetWindowAlwaysOnTop(SDL_Window *window, bool on_top)
CHECK_WINDOW_MAGIC(window, false);
CHECK_WINDOW_NOT_POPUP(window, false);
- const bool want = (on_top != false); // normalize the flag.
+ if (!_this->SetWindowAlwaysOnTop) {
+ return SDL_Unsupported();
+ }
+
+ const bool want = on_top;
const bool have = ((window->flags & SDL_WINDOW_ALWAYS_ON_TOP) != 0);
- if ((want != have) && (_this->SetWindowAlwaysOnTop)) {
+ if (want != have) {
if (want) {
window->flags |= SDL_WINDOW_ALWAYS_ON_TOP;
} else {