x11: Let apps specify that video init should fail if XRandR is unavailable.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 04 Jan 2016 23:44:27 -0500
changeset 10015d809627808b1
parent 10014 906340c8c820
child 10016 d565c0f35a92
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
     1.1 --- a/src/video/x11/SDL_x11modes.c	Tue Jan 05 02:40:14 2016 -0500
     1.2 +++ b/src/video/x11/SDL_x11modes.c	Mon Jan 04 23:44:27 2016 -0500
     1.3 @@ -618,6 +618,20 @@
     1.4  
     1.5  /* !!! FIXME: eventually remove support for Xinerama and XVidMode (everything below here). */
     1.6  
     1.7 +    /* This is a workaround for some apps (UnrealEngine4, for example) until
     1.8 +       we sort out the ramifications of removing XVidMode support outright.
     1.9 +       This block should be removed with the XVidMode support. */
    1.10 +    {
    1.11 +        const char *env = SDL_GetHint("SDL_VIDEO_X11_REQUIRE_XRANDR");
    1.12 +        if (env && SDL_atoi(env)) {
    1.13 +            #if SDL_VIDEO_DRIVER_X11_XRANDR
    1.14 +            return SDL_SetError("XRandR support is required but not available");
    1.15 +            #else
    1.16 +            return SDL_SetError("XRandR support is required but not built into SDL!");
    1.17 +            #endif
    1.18 +        }
    1.19 +    }
    1.20 +
    1.21  #if SDL_VIDEO_DRIVER_X11_XINERAMA
    1.22      /* Query Xinerama extention
    1.23       * NOTE: This works with Nvidia Twinview correctly, but you need version 302.17 (released on June 2012)