Commit 1c7bf478ae9c7904c70509277b9a3ce4a2ca7ab2

Ryan C. Gordon 2022-03-31T10:09:02

x11: Ignore BadValue for extremely small XRRSetScreenSize resolutions. Reference Issue #4840.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c
index c1efe24..f2cbdb4 100644
--- a/src/video/x11/SDL_x11modes.c
+++ b/src/video/x11/SDL_x11modes.c
@@ -1011,7 +1011,13 @@ static int (*PreXRRSetScreenSizeErrorHandler)(Display *, XErrorEvent *) = NULL;
 static int
 SDL_XRRSetScreenSizeErrHandler(Display *d, XErrorEvent *e)
 {
-    return (e->error_code == BadMatch) ? 0 : PreXRRSetScreenSizeErrorHandler(d, e);
+    /* BadMatch: https://github.com/libsdl-org/SDL/issues/4561 */
+    /* BadValue: https://github.com/libsdl-org/SDL/issues/4840 */
+    if ((e->error_code == BadMatch) || (e->error_code == BadValue)) {
+        return 0;
+    }
+
+    return PreXRRSetScreenSizeErrorHandler(d, e);
 }
 
 int