Turned the X11 mode extension environment variables into hints so they can be more easily set from applications.
authorSam Lantinga <slouken@libsdl.org>
Thu, 27 Sep 2012 11:29:13 -0700
changeset 6472d4623b7209db
parent 6471 5f6990aaf357
child 6473 a5adb68266d0
Turned the X11 mode extension environment variables into hints so they can be more easily set from applications.
include/SDL_hints.h
src/video/x11/SDL_x11modes.c
     1.1 --- a/include/SDL_hints.h	Thu Sep 27 11:13:30 2012 -0700
     1.2 +++ b/include/SDL_hints.h	Thu Sep 27 11:29:13 2012 -0700
     1.3 @@ -118,7 +118,40 @@
     1.4   *  By default SDL does not sync screen surface updates with vertical refresh.
     1.5   */
     1.6  #define SDL_HINT_RENDER_VSYNC               "SDL_RENDER_VSYNC"
     1.7 -	
     1.8 +
     1.9 +/**
    1.10 + *  \brief  A variable controlling whether the X11 VidMode extension should be used.
    1.11 + *
    1.12 + *  This variable can be set to the following values:
    1.13 + *    "0"       - Disable XVidMode
    1.14 + *    "1"       - Enable XVidMode
    1.15 + *
    1.16 + *  By default SDL will use XVidMode if it is available.
    1.17 + */
    1.18 +#define SDL_HINT_VIDEO_X11_XVIDMODE         "SDL_VIDEO_X11_XVIDMODE"
    1.19 +
    1.20 +/**
    1.21 + *  \brief  A variable controlling whether the X11 Xinerama extension should be used.
    1.22 + *
    1.23 + *  This variable can be set to the following values:
    1.24 + *    "0"       - Disable Xinerama
    1.25 + *    "1"       - Enable Xinerama
    1.26 + *
    1.27 + *  By default SDL will use Xinerama if it is available.
    1.28 + */
    1.29 +#define SDL_HINT_VIDEO_X11_XINERAMA         "SDL_VIDEO_X11_XINERAMA"
    1.30 +
    1.31 +/**
    1.32 + *  \brief  A variable controlling whether the X11 XRandR extension should be used.
    1.33 + *
    1.34 + *  This variable can be set to the following values:
    1.35 + *    "0"       - Disable XRandR
    1.36 + *    "1"       - Enable XRandR
    1.37 + *
    1.38 + *  By default SDL will use XRandR if it is available.
    1.39 + */
    1.40 +#define SDL_HINT_VIDEO_X11_XRANDR           "SDL_VIDEO_X11_XRANDR"
    1.41 +
    1.42  /**
    1.43   *  \brief  A variable controlling whether the idle timer is disabled on iOS.
    1.44   *
     2.1 --- a/src/video/x11/SDL_x11modes.c	Thu Sep 27 11:13:30 2012 -0700
     2.2 +++ b/src/video/x11/SDL_x11modes.c	Thu Sep 27 11:29:13 2012 -0700
     2.3 @@ -22,6 +22,7 @@
     2.4  
     2.5  #if SDL_VIDEO_DRIVER_X11
     2.6  
     2.7 +#include "SDL_hints.h"
     2.8  #include "SDL_x11video.h"
     2.9  
    2.10  /*#define X11MODES_DEBUG*/
    2.11 @@ -270,10 +271,10 @@
    2.12      *major = *minor = 0;
    2.13  
    2.14      /* Allow environment override */
    2.15 -    env = getenv("SDL_VIDEO_X11_XINERAMA");
    2.16 +    env = SDL_GetHint(SDL_HINT_VIDEO_X11_XINERAMA);
    2.17      if (env && !SDL_atoi(env)) {
    2.18  #ifdef X11MODES_DEBUG
    2.19 -        printf("Xinerama disabled due to environment variable\n");
    2.20 +        printf("Xinerama disabled due to hint\n");
    2.21  #endif
    2.22          return SDL_FALSE;
    2.23      }
    2.24 @@ -311,10 +312,10 @@
    2.25      *major = *minor = 0;
    2.26  
    2.27      /* Allow environment override */
    2.28 -    env = getenv("SDL_VIDEO_X11_XRANDR");
    2.29 +    env = SDL_GetHint(SDL_HINT_VIDEO_X11_XRANDR);
    2.30      if (env && !SDL_atoi(env)) {
    2.31  #ifdef X11MODES_DEBUG
    2.32 -        printf("XRandR disabled due to environment variable\n");
    2.33 +        printf("XRandR disabled due to hint\n");
    2.34  #endif
    2.35          return SDL_FALSE;
    2.36      }
    2.37 @@ -350,10 +351,10 @@
    2.38      *major = *minor = 0;
    2.39  
    2.40      /* Allow environment override */
    2.41 -    env = getenv("SDL_VIDEO_X11_XVIDMODE");
    2.42 +    env = SDL_GetHint(SDL_HINT_VIDEO_X11_XVIDMODE);
    2.43      if (env && !SDL_atoi(env)) {
    2.44  #ifdef X11MODES_DEBUG
    2.45 -        printf("XVidMode disabled due to environment variable\n");
    2.46 +        printf("XVidMode disabled due to hint\n");
    2.47  #endif
    2.48          return SDL_FALSE;
    2.49      }