SDL: Don't fail to create a window if it's too large, just clamp it to the max instead

From 4a18893c73a4a6b963384e186c1b70c6f6cb08a4 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 17 Jul 2023 17:48:11 -0700
Subject: [PATCH] Don't fail to create a window if it's too large, just clamp
 it to the max instead

Some window is better than no window...
---
 src/video/SDL_video.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 5811ed90ee69..05de90bfbcec 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1858,9 +1858,11 @@ static SDL_Window *SDL_CreateWindowInternal(const char *title, int x, int y, int
     }
 
     /* Some platforms blow up if the windows are too large. Raise it later? */
-    if ((w > 16384) || (h > 16384)) {
-        SDL_SetError("Window is too large.");
-        return NULL;
+    if (w > 16384) {
+        w = 16384;
+    }
+    if (h > 16384) {
+        h = 16384;
     }
 
     if (SDL_WINDOWPOS_ISUNDEFINED(x) || SDL_WINDOWPOS_ISUNDEFINED(y) ||