Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Added support for SDL 1.2 environment variables:
Browse files Browse the repository at this point in the history
	SDL_VIDEO_FULLSCREEN_DISPLAY, SDL_VIDEO_FULLSCREEN_HEAD
  • Loading branch information
slouken committed Dec 3, 2009
1 parent b24e4a4 commit fc968ba
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/SDL_compat.c
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -124,6 +140,8 @@ SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags)
return NULL;
}

SelectVideoDisplay();

if (!(flags & SDL_FULLSCREEN)) {
return (SDL_Rect **) (-1);
}
Expand Down Expand Up @@ -495,6 +513,8 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
}
}

SelectVideoDisplay();

SDL_GetDesktopDisplayMode(&desktop_mode);

if (width == 0) {
Expand Down

0 comments on commit fc968ba

Please sign in to comment.