Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Date: Thu, 05 Feb 2009 17:27:54 +0100
Browse files Browse the repository at this point in the history
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
  • Loading branch information
slouken committed Mar 23, 2009
1 parent ff709d1 commit c32c056
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/SDL_compat.c
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)))) {
Expand Down

0 comments on commit c32c056

Please sign in to comment.