changeset 4085:51486c979189 SDL-1.2

> Hi Ryan, > I checked the list you linked to, but did not see any reference to whether > the Win32 window centering bug was fixed... Has that been addressed at all? > I refer to the bug where, unless one has globally set the > SDL_WINDOW_CENTERED variable in the OS, only the 1st window that is created > will be centered. Subsequent calls to SetVideoMode will create a window tha t > shares the same upper-left corner location. I'm working on that now, thanks for reporting it. What I'm doing is if the width and height are the same, I'm leaving the window position alone, but if they're different they will respect the positioning environment variables.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 20 Jul 2007 03:25:40 +0000
parents 70e77cbba87c
children 7cd5a59480a4
files src/video/windib/SDL_dibvideo.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/windib/SDL_dibvideo.c	Fri Jul 20 02:58:28 2007 +0000
+++ b/src/video/windib/SDL_dibvideo.c	Fri Jul 20 03:25:40 2007 +0000
@@ -468,6 +468,7 @@
 				int width, int height, int bpp, Uint32 flags)
 {
 	SDL_Surface *video;
+	int prev_w, prev_h;
 	Uint32 prev_flags;
 	DWORD style;
 	const DWORD directstyle =
@@ -531,6 +532,8 @@
 
 	/* Fill in part of the video surface */
 	prev_flags = video->flags;
+	prev_w = video->w;
+	prev_h = video->h;
 	video->flags = 0;	/* Clear flags */
 	video->w = width;
 	video->h = height;
@@ -774,7 +777,7 @@
 		const char *window = NULL;
 		const char *center = NULL;
 
-		if ( !SDL_windowX && !SDL_windowY ) {
+		if ( video->w != prev_w || video->h != prev_h ) {
 			window = SDL_getenv("SDL_VIDEO_WINDOW_POS");
 			center = SDL_getenv("SDL_VIDEO_CENTERED");
 			if ( window ) {