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
This commit is contained in:
Sam Lantinga 2009-12-03 08:43:12 +00:00
parent e12e0c04d3
commit 5bb70a9b91

View file

@ -64,12 +64,26 @@ SDL_VideoDriverName(char *namebuf, int maxlen)
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 *
SDL_GetVideoInfo(void)
{
static SDL_VideoInfo info;
SDL_DisplayMode mode;
SelectVideoDisplay();
/* Memory leak, compatibility code, who cares? */
if (!info.vfmt && SDL_GetDesktopDisplayMode(&mode) == 0) {
int bpp;
@ -93,6 +107,8 @@ SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags)
return 0;
}
SelectVideoDisplay();
if (!(flags & SDL_FULLSCREEN)) {
SDL_DisplayMode mode;
SDL_GetDesktopDisplayMode(&mode);
@ -124,6 +140,8 @@ SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags)
return NULL;
}
SelectVideoDisplay();
if (!(flags & SDL_FULLSCREEN)) {
return (SDL_Rect **) (-1);
}
@ -495,6 +513,8 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
}
}
SelectVideoDisplay();
SDL_GetDesktopDisplayMode(&desktop_mode);
if (width == 0) {