src/SDL12_compat.c
changeset 58 75a93435ce44
parent 57 9bc9f6285f0b
child 59 39067b54d1b0
equal deleted inserted replaced
57:9bc9f6285f0b 58:75a93435ce44
   535 }
   535 }
   536 
   536 
   537 static int
   537 static int
   538 GetVideoDisplay()
   538 GetVideoDisplay()
   539 {
   539 {
   540     // !!! FIXME: cache this value during SDL_Init() so it doesn't change.
   540     FIXME("cache this value during SDL_Init() so it doesn't change.");
   541     const char *variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_DISPLAY");
   541     const char *variable = SDL20_getenv("SDL_VIDEO_FULLSCREEN_DISPLAY");
   542     if ( !variable ) {
   542     if ( !variable ) {
   543         variable = SDL_getenv("SDL_VIDEO_FULLSCREEN_HEAD");
   543         variable = SDL20_getenv("SDL_VIDEO_FULLSCREEN_HEAD");
   544     }
   544     }
   545     if ( variable ) {
   545     if ( variable ) {
   546         return SDL20_atoi(variable);
   546         return SDL20_atoi(variable);
   547     } else {
   547     } else {
   548         return 0;
   548         return 0;
  1588 
  1588 
  1589 static void
  1589 static void
  1590 GetEnvironmentWindowPosition(int w, int h, int *x, int *y)
  1590 GetEnvironmentWindowPosition(int w, int h, int *x, int *y)
  1591 {
  1591 {
  1592     int display = VideoDisplayIndex;
  1592     int display = VideoDisplayIndex;
  1593     const char *window = SDL_getenv("SDL_VIDEO_WINDOW_POS");
  1593     const char *window = SDL20_getenv("SDL_VIDEO_WINDOW_POS");
  1594     const char *center = SDL_getenv("SDL_VIDEO_CENTERED");
  1594     const char *center = SDL20_getenv("SDL_VIDEO_CENTERED");
  1595     if (window) {
  1595     if (window) {
  1596         if (SDL_sscanf(window, "%d,%d", x, y) == 2) {
  1596         if (SDL20_strcmp(window, "center") == 0) {
       
  1597             center = window;
       
  1598         } else if (SDL20_sscanf(window, "%d,%d", x, y) == 2) {
  1597             return;
  1599             return;
  1598         }
  1600         }
  1599         if (SDL_strcmp(window, "center") == 0) {
  1601     }
  1600             center = window;
  1602 
  1601         }
       
  1602     }
       
  1603     if (center) {
  1603     if (center) {
  1604         *x = SDL_WINDOWPOS_CENTERED_DISPLAY(display);
  1604         *x = SDL_WINDOWPOS_CENTERED_DISPLAY(display);
  1605         *y = SDL_WINDOWPOS_CENTERED_DISPLAY(display);
  1605         *y = SDL_WINDOWPOS_CENTERED_DISPLAY(display);
  1606     }
  1606     }
  1607 }
  1607 }
  1611 {
  1611 {
  1612     const char *env;
  1612     const char *env;
  1613     SDL_bool allow_screensaver;
  1613     SDL_bool allow_screensaver;
  1614 
  1614 
  1615     /* Allow environment override of screensaver disable */
  1615     /* Allow environment override of screensaver disable */
  1616     env = SDL_getenv("SDL_VIDEO_ALLOW_SCREENSAVER");
  1616     env = SDL20_getenv("SDL_VIDEO_ALLOW_SCREENSAVER");
  1617     if (env) {
  1617     if (env) {
  1618         allow_screensaver = SDL20_atoi(env) ? SDL_TRUE : SDL_FALSE;
  1618         allow_screensaver = SDL20_atoi(env) ? SDL_TRUE : SDL_FALSE;
  1619     } else if (flags12 & SDL12_FULLSCREEN) {
  1619     } else if (flags12 & SDL12_FULLSCREEN) {
  1620         allow_screensaver = SDL_FALSE;
  1620         allow_screensaver = SDL_FALSE;
  1621     } else {
  1621     } else {