changeset 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 e7eec78e4b92
children 1374f9275de9
files src/SDL_compat.c
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
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) {