Date: Thu, 05 Feb 2009 17:27:54 +0100
authorSam Lantinga <slouken@libsdl.org>
Mon, 23 Mar 2009 05:37:45 +0000
changeset 30985f372cef955d
parent 3097 0d12e8f1de3c
child 3099 82e60908fab1
Date: Thu, 05 Feb 2009 17:27:54 +0100
From: Stefan Klug
Subject: [SDL] SDL_SetVideoMode compatibility fix

SDL_SetVideoMode(0,0,0,flags) used to be valid in SDL 1.2
Attached is a patch to replicate this behaviour in SDL 1.3

Cheers Stefan
src/SDL_compat.c
     1.1 --- a/src/SDL_compat.c	Mon Mar 23 05:35:21 2009 +0000
     1.2 +++ b/src/SDL_compat.c	Mon Mar 23 05:37:45 2009 +0000
     1.3 @@ -494,6 +494,15 @@
     1.4              return NULL;
     1.5          }
     1.6      }
     1.7 +    
     1.8 +    SDL_GetDesktopDisplayMode(&desktop_mode);
     1.9 +
    1.10 +    if (width == 0) {
    1.11 +        width = desktop_mode.w;
    1.12 +    }
    1.13 +    if (height == 0) {
    1.14 +        height = desktop_mode.h;
    1.15 +    }
    1.16  
    1.17      /* See if we can simply resize the existing window and surface */
    1.18      if (SDL_ResizeVideoMode(width, height, bpp, flags) == 0) {
    1.19 @@ -567,7 +576,6 @@
    1.20      }
    1.21  
    1.22      /* Set up the desired display mode */
    1.23 -    SDL_GetDesktopDisplayMode(&desktop_mode);
    1.24      desktop_format = desktop_mode.format;
    1.25      if (desktop_format && ((flags & SDL_ANYFORMAT)
    1.26                             || (bpp == SDL_BITSPERPIXEL(desktop_format)))) {