Date: Mon, 25 Oct 2004 17:30:06 +0200
authorSam Lantinga
Fri, 12 Nov 2004 23:22:08 +0000
changeset 97196671ebc50a4
parent 970 fb8b91365766
child 972 15a7d0c44e73
Date: Mon, 25 Oct 2004 17:30:06 +0200
From: Gautier Portet
Subject: [SDL] Re: Centering a window

Hi, here is a patch fixing the win32 centered window bug
src/video/windib/SDL_dibvideo.c
src/video/windx5/SDL_dx5video.c
     1.1 --- a/src/video/windib/SDL_dibvideo.c	Fri Nov 12 23:14:47 2004 +0000
     1.2 +++ b/src/video/windib/SDL_dibvideo.c	Fri Nov 12 23:22:08 2004 +0000
     1.3 @@ -703,12 +703,12 @@
     1.4  		if ( (flags & SDL_FULLSCREEN) ) {
     1.5  			x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
     1.6  			y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
     1.7 +		} else if ( center ) {
     1.8 +			x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
     1.9 +			y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
    1.10  		} else if ( SDL_windowX || SDL_windowY || window ) {
    1.11  			x = bounds.left;
    1.12  			y = bounds.top;
    1.13 -		} else if ( center ) {
    1.14 -			x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
    1.15 -			y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
    1.16  		} else {
    1.17  			x = y = -1;
    1.18  			swp_flags |= SWP_NOMOVE;
     2.1 --- a/src/video/windx5/SDL_dx5video.c	Fri Nov 12 23:14:47 2004 +0000
     2.2 +++ b/src/video/windx5/SDL_dx5video.c	Fri Nov 12 23:22:08 2004 +0000
     2.3 @@ -1168,12 +1168,12 @@
     2.4  			if ( (flags & SDL_FULLSCREEN) ) {
     2.5  				x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
     2.6  				y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
     2.7 +			} else if ( center ) {
     2.8 +				x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
     2.9 +				y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
    2.10  			} else if ( SDL_windowX || SDL_windowY || window ) {
    2.11  				x = bounds.left;
    2.12  				y = bounds.top;
    2.13 -			} else if ( center ) {
    2.14 -				x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
    2.15 -				y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
    2.16  			} else {
    2.17  				x = y = -1;
    2.18  				swp_flags |= SWP_NOMOVE;
    2.19 @@ -1574,12 +1574,12 @@
    2.20  		if ( (flags & SDL_FULLSCREEN) ) {
    2.21  			x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
    2.22  			y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
    2.23 +		} else if ( center ) {
    2.24 +			x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
    2.25 +			y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
    2.26  		} else if ( SDL_windowX || SDL_windowY || window ) {
    2.27  			x = bounds.left;
    2.28  			y = bounds.top;
    2.29 -		} else if ( center ) {
    2.30 -			x = (GetSystemMetrics(SM_CXSCREEN)-width)/2;
    2.31 -			y = (GetSystemMetrics(SM_CYSCREEN)-height)/2;
    2.32  		} else {
    2.33  			x = y = -1;
    2.34  			swp_flags |= SWP_NOMOVE;