Commit 5bb70a9b authored by Sam Lantinga's avatar Sam Lantinga

Added support for SDL 1.2 environment variables:

	SDL_VIDEO_FULLSCREEN_DISPLAY, SDL_VIDEO_FULLSCREEN_HEAD

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404261
parent e12e0c04
...@@ -64,12 +64,26 @@ SDL_VideoDriverName(char *namebuf, int maxlen) ...@@ -64,12 +64,26 @@ SDL_VideoDriverName(char *namebuf, int maxlen)
return NULL; return NULL;
} }
static void
SelectVideoDisplay()
{
const char *variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_DISPLAY");
if ( !variable ) {
variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_HEAD");
}
if ( variable ) {
SDL_SelectVideoDisplay(SDL_atoi(variable));
}
}
const SDL_VideoInfo * const SDL_VideoInfo *
SDL_GetVideoInfo(void) SDL_GetVideoInfo(void)
{ {
static SDL_VideoInfo info; static SDL_VideoInfo info;
SDL_DisplayMode mode; SDL_DisplayMode mode;
SelectVideoDisplay();
/* Memory leak, compatibility code, who cares? */ /* Memory leak, compatibility code, who cares? */
if (!info.vfmt && SDL_GetDesktopDisplayMode(&mode) == 0) { if (!info.vfmt && SDL_GetDesktopDisplayMode(&mode) == 0) {
int bpp; int bpp;
...@@ -93,6 +107,8 @@ SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags) ...@@ -93,6 +107,8 @@ SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags)
return 0; return 0;
} }
SelectVideoDisplay();
if (!(flags & SDL_FULLSCREEN)) { if (!(flags & SDL_FULLSCREEN)) {
SDL_DisplayMode mode; SDL_DisplayMode mode;
SDL_GetDesktopDisplayMode(&mode); SDL_GetDesktopDisplayMode(&mode);
...@@ -124,6 +140,8 @@ SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags) ...@@ -124,6 +140,8 @@ SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags)
return NULL; return NULL;
} }
SelectVideoDisplay();
if (!(flags & SDL_FULLSCREEN)) { if (!(flags & SDL_FULLSCREEN)) {
return (SDL_Rect **) (-1); return (SDL_Rect **) (-1);
} }
...@@ -495,6 +513,8 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) ...@@ -495,6 +513,8 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
} }
} }
SelectVideoDisplay();
SDL_GetDesktopDisplayMode(&desktop_mode); SDL_GetDesktopDisplayMode(&desktop_mode);
if (width == 0) { if (width == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment