Allow building SDL2 with versions before 2.0.5.

This commit is contained in:
William McBrine
2017-12-18 13:19:36 -05:00
parent 096b8a83c4
commit 0b1e87bdcd

View File

@@ -296,24 +296,30 @@ int PDC_scr_open(int argc, char **argv)
int PDC_resize_screen(int nlines, int ncols)
{
#if SDL_VERSION_ATLEAST(2, 0, 5)
SDL_Rect max;
int top, left, bottom, right;
#endif
if (!pdc_own_window)
return ERR;
#if SDL_VERSION_ATLEAST(2, 0, 5)
SDL_GetDisplayUsableBounds(0, &max);
SDL_GetWindowBordersSize(pdc_window, &top, &left, &bottom, &right);
max.h -= top + bottom;
max.w -= left + right;
#endif
if (nlines && ncols)
{
#if SDL_VERSION_ATLEAST(2, 0, 5)
while (nlines * pdc_fheight > max.h)
nlines--;
pdc_sheight = nlines * pdc_fheight;
while (ncols * pdc_fwidth > max.w)
ncols--;
#endif
pdc_sheight = nlines * pdc_fheight;
pdc_swidth = ncols * pdc_fwidth;
}