From beac09d6419446bec3920511fdfaad18e4c06f57 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Wed, 24 Oct 2007 06:26:07 +0000
Subject: [PATCH] Support headers from versions < 1.2.10

When old headers are used, overlay mode is not guaranteed to go edge-to-edge
on the display.
---
 src/conio/sdl_con.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/conio/sdl_con.c b/src/conio/sdl_con.c
index 4611446f3d..7695612a66 100644
--- a/src/conio/sdl_con.c
+++ b/src/conio/sdl_con.c
@@ -78,6 +78,8 @@ struct yuv_settings {
 	int			enabled;
 	int			win_width;
 	int			win_height;
+	int			screen_width;
+	int			screen_height;
 	int			changed;
 	int			best_format;
 	SDL_Overlay	*overlay;
@@ -85,7 +87,7 @@ struct yuv_settings {
 	Uint8		colours[sizeof(dac_default)/sizeof(struct dac_colors)][3];
 };
 
-static struct yuv_settings yuv={0,0,0,0,0,NULL,NULL};
+static struct yuv_settings yuv={0,0,0,0,0,0,0,NULL,NULL};
 
 struct sdl_keyvals {
 	int	keysym
@@ -619,13 +621,18 @@ int sdl_init(int mode)
 
 	if(mode==CIOLIB_MODE_SDL_FULLSCREEN)
 		fullscreen=1;
-	if(mode==CIOLIB_MODE_SDL_YUV) {
+	if(mode==CIOLIB_MODE_SDL_YUV)
 		yuv.enabled=1;
-	}
 	if(mode==CIOLIB_MODE_SDL_YUV_FULLSCREEN) {
 		yuv.enabled=1;
 		fullscreen=1;
 	}
+#if (SDL_MAJOR_VERSION > 1) || (SDL_MINOR_VERSION > 2) || (SDL_PATCHLEVEL > 9)
+	if(yuv.enabled) {
+		yuv.screen_width=sdl.initial_videoinfo.current_w;
+		yuv.screen_height=sdl.initial_videoinfo.current_h;
+	}
+#endif
 	sdl_init_mode(3);
 	sdl_user_func_ret(SDL_USEREVENT_INIT);
 
@@ -1220,8 +1227,8 @@ void setup_surfaces(void)
 			yuv.win_width=vstat.charwidth*vstat.cols;
 		if(!yuv.win_height)
 			yuv.win_height=vstat.charheight*vstat.rows;
-		if(fullscreen && sdl.initial_videoinfo.current_w && sdl.initial_videoinfo.current_h)
-			win=sdl.SetVideoMode(sdl.initial_videoinfo.current_w,sdl.initial_videoinfo.current_h,0,flags);
+		if(fullscreen && yuv.screen_width && yuv.screen_height)
+			win=sdl.SetVideoMode(yuv.screen_width,yuv.screen_height,0,flags);
 		else
 			win=sdl.SetVideoMode(yuv.win_width,yuv.win_height,0,flags);
 	}
-- 
GitLab