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)))) {