From 81209acbd8bd7c492a558b1234ac7b58165d2ae3 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 4 Jan 2016 23:44:27 -0500 Subject: [PATCH] x11: Let apps specify that video init should fail if XRandR is unavailable. Notably: it sets the error string to inform you that your custom SDL is built without xrandr support, which apparently has been a support issue for Unreal Engine 4 developers. --- src/video/x11/SDL_x11modes.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c index 446da2b64c686..5a866589e6702 100644 --- a/src/video/x11/SDL_x11modes.c +++ b/src/video/x11/SDL_x11modes.c @@ -618,6 +618,20 @@ X11_InitModes(_THIS) /* !!! FIXME: eventually remove support for Xinerama and XVidMode (everything below here). */ + /* This is a workaround for some apps (UnrealEngine4, for example) until + we sort out the ramifications of removing XVidMode support outright. + This block should be removed with the XVidMode support. */ + { + const char *env = SDL_GetHint("SDL_VIDEO_X11_REQUIRE_XRANDR"); + if (env && SDL_atoi(env)) { + #if SDL_VIDEO_DRIVER_X11_XRANDR + return SDL_SetError("XRandR support is required but not available"); + #else + return SDL_SetError("XRandR support is required but not built into SDL!"); + #endif + } + } + #if SDL_VIDEO_DRIVER_X11_XINERAMA /* Query Xinerama extention * NOTE: This works with Nvidia Twinview correctly, but you need version 302.17 (released on June 2012)