From 0b1e87bdcd01ffef24794a9fe8ab344932c111f5 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Mon, 18 Dec 2017 13:19:36 -0500 Subject: [PATCH] Allow building SDL2 with versions before 2.0.5. --- sdl2/pdcscrn.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sdl2/pdcscrn.c b/sdl2/pdcscrn.c index 79355f34..a89f143c 100644 --- a/sdl2/pdcscrn.c +++ b/sdl2/pdcscrn.c @@ -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; }