Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Turned the X11 mode extension environment variables into hints so the…
…y can be more easily set from applications.
- Loading branch information
Showing
with
41 additions
and
7 deletions.
-
+34
−1
include/SDL_hints.h
-
+7
−6
src/video/x11/SDL_x11modes.c
|
@@ -118,7 +118,40 @@ extern "C" { |
|
|
* By default SDL does not sync screen surface updates with vertical refresh. |
|
|
*/ |
|
|
#define SDL_HINT_RENDER_VSYNC "SDL_RENDER_VSYNC" |
|
|
|
|
|
|
|
|
/** |
|
|
* \brief A variable controlling whether the X11 VidMode extension should be used. |
|
|
* |
|
|
* This variable can be set to the following values: |
|
|
* "0" - Disable XVidMode |
|
|
* "1" - Enable XVidMode |
|
|
* |
|
|
* By default SDL will use XVidMode if it is available. |
|
|
*/ |
|
|
#define SDL_HINT_VIDEO_X11_XVIDMODE "SDL_VIDEO_X11_XVIDMODE" |
|
|
|
|
|
/** |
|
|
* \brief A variable controlling whether the X11 Xinerama extension should be used. |
|
|
* |
|
|
* This variable can be set to the following values: |
|
|
* "0" - Disable Xinerama |
|
|
* "1" - Enable Xinerama |
|
|
* |
|
|
* By default SDL will use Xinerama if it is available. |
|
|
*/ |
|
|
#define SDL_HINT_VIDEO_X11_XINERAMA "SDL_VIDEO_X11_XINERAMA" |
|
|
|
|
|
/** |
|
|
* \brief A variable controlling whether the X11 XRandR extension should be used. |
|
|
* |
|
|
* This variable can be set to the following values: |
|
|
* "0" - Disable XRandR |
|
|
* "1" - Enable XRandR |
|
|
* |
|
|
* By default SDL will use XRandR if it is available. |
|
|
*/ |
|
|
#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR" |
|
|
|
|
|
/** |
|
|
* \brief A variable controlling whether the idle timer is disabled on iOS. |
|
|
* |
|
|
|
@@ -22,6 +22,7 @@ |
|
|
|
|
|
#if SDL_VIDEO_DRIVER_X11 |
|
|
|
|
|
#include "SDL_hints.h" |
|
|
#include "SDL_x11video.h" |
|
|
|
|
|
/*#define X11MODES_DEBUG*/ |
|
@@ -270,10 +271,10 @@ CheckXinerama(Display * display, int *major, int *minor) |
|
|
*major = *minor = 0; |
|
|
|
|
|
/* Allow environment override */ |
|
|
env = getenv("SDL_VIDEO_X11_XINERAMA"); |
|
|
env = SDL_GetHint(SDL_HINT_VIDEO_X11_XINERAMA); |
|
|
if (env && !SDL_atoi(env)) { |
|
|
#ifdef X11MODES_DEBUG |
|
|
printf("Xinerama disabled due to environment variable\n"); |
|
|
printf("Xinerama disabled due to hint\n"); |
|
|
#endif |
|
|
return SDL_FALSE; |
|
|
} |
|
@@ -311,10 +312,10 @@ CheckXRandR(Display * display, int *major, int *minor) |
|
|
*major = *minor = 0; |
|
|
|
|
|
/* Allow environment override */ |
|
|
env = getenv("SDL_VIDEO_X11_XRANDR"); |
|
|
env = SDL_GetHint(SDL_HINT_VIDEO_X11_XRANDR); |
|
|
if (env && !SDL_atoi(env)) { |
|
|
#ifdef X11MODES_DEBUG |
|
|
printf("XRandR disabled due to environment variable\n"); |
|
|
printf("XRandR disabled due to hint\n"); |
|
|
#endif |
|
|
return SDL_FALSE; |
|
|
} |
|
@@ -350,10 +351,10 @@ CheckVidMode(Display * display, int *major, int *minor) |
|
|
*major = *minor = 0; |
|
|
|
|
|
/* Allow environment override */ |
|
|
env = getenv("SDL_VIDEO_X11_XVIDMODE"); |
|
|
env = SDL_GetHint(SDL_HINT_VIDEO_X11_XVIDMODE); |
|
|
if (env && !SDL_atoi(env)) { |
|
|
#ifdef X11MODES_DEBUG |
|
|
printf("XVidMode disabled due to environment variable\n"); |
|
|
printf("XVidMode disabled due to hint\n"); |
|
|
#endif |
|
|
return SDL_FALSE; |
|
|
} |
|
|