Fixed bug 3722 - Fall back to xinerama/xvidmode if xrandr modes initialization fails
authorSam Lantinga <slouken@libsdl.org>
Wed, 02 Aug 2017 10:28:13 -0700
changeset 11177393fa47cb702
parent 11176 9397a2d41d6b
child 11178 0ef6b8b9ca6d
Fixed bug 3722 - Fall back to xinerama/xvidmode if xrandr modes initialization fails

Levi Bard

In some environments, xrandr modes initialization can fail even though xrandr support is present and of a sufficient version.
(The one I encountered was an AWS instance running a virtual display)

The attached patch allows SDL to keep trying other methods if xrandr modes initialization fails (still subject to SDL_VIDEO_X11_REQUIRE_XRANDR).
src/video/x11/SDL_x11modes.c
     1.1 --- a/src/video/x11/SDL_x11modes.c	Wed Aug 02 10:24:47 2017 -0700
     1.2 +++ b/src/video/x11/SDL_x11modes.c	Wed Aug 02 10:28:13 2017 -0700
     1.3 @@ -604,7 +604,8 @@
     1.4      /* require at least XRandR v1.3 */
     1.5      if (CheckXRandR(data->display, &xrandr_major, &xrandr_minor) &&
     1.6          (xrandr_major >= 2 || (xrandr_major == 1 && xrandr_minor >= 3))) {
     1.7 -        return X11_InitModes_XRandR(_this);
     1.8 +        if (X11_InitModes_XRandR(_this) == 0)
     1.9 +            return 0;
    1.10      }
    1.11  #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */
    1.12