From c7a043cbf47dbafc4b75ff2dbb1cf304d41ac77d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 23 Mar 2009 05:37:45 +0000 Subject: [PATCH] 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 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/SDL_compat.c b/src/SDL_compat.c index 88a16c5f1..a776b0cb1 100644 --- a/src/SDL_compat.c +++ b/src/SDL_compat.c @@ -494,6 +494,15 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) return NULL; } } + + SDL_GetDesktopDisplayMode(&desktop_mode); + + if (width == 0) { + width = desktop_mode.w; + } + if (height == 0) { + height = desktop_mode.h; + } /* See if we can simply resize the existing window and surface */ if (SDL_ResizeVideoMode(width, height, bpp, flags) == 0) { @@ -567,7 +576,6 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) } /* Set up the desired display mode */ - SDL_GetDesktopDisplayMode(&desktop_mode); desktop_format = desktop_mode.format; if (desktop_format && ((flags & SDL_ANYFORMAT) || (bpp == SDL_BITSPERPIXEL(desktop_format)))) {