diff src/SDL_compat.c @ 3518:abefdc334970

Added support for SDL 1.2 environment variables: SDL_VIDEO_FULLSCREEN_DISPLAY, SDL_VIDEO_FULLSCREEN_HEAD
author Sam Lantinga <slouken@libsdl.org>
date Thu, 03 Dec 2009 08:43:12 +0000
parents 4b594623401b
children 15eea7a1fa97
line wrap: on
line diff
--- a/src/SDL_compat.c	Thu Dec 03 08:33:39 2009 +0000
+++ b/src/SDL_compat.c	Thu Dec 03 08:43:12 2009 +0000
@@ -64,12 +64,26 @@
     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 @@
         return 0;
     }
 
+    SelectVideoDisplay();
+
     if (!(flags & SDL_FULLSCREEN)) {
         SDL_DisplayMode mode;
         SDL_GetDesktopDisplayMode(&mode);
@@ -124,6 +140,8 @@
         return NULL;
     }
 
+    SelectVideoDisplay();
+
     if (!(flags & SDL_FULLSCREEN)) {
         return (SDL_Rect **) (-1);
     }
@@ -495,6 +513,8 @@
         }
     }
 
+    SelectVideoDisplay();
+
     SDL_GetDesktopDisplayMode(&desktop_mode);
 
     if (width == 0) {