Commit 80115574585059b522c6103ad3d5a47933e96162

Ryan C. Gordon 2015-04-06T18:26:13

Refuse to make a window that's too large. Some systems (x11) freak out at this. Fixes Bugzilla #2255.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index c8cb2fa..45e9960 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1260,6 +1260,12 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
         h = 1;
     }
 
+    /* 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;
+    }
+
     /* Some platforms have OpenGL enabled by default */
 #if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__ || __NACL__
     flags |= SDL_WINDOW_OPENGL;