Only save the window position if we're in windowed mode
authorSam Lantinga <slouken@libsdl.org>
Sun, 29 Jan 2006 22:09:26 +0000
changeset 129131331c444ea2
parent 1290 c4a5a772c5d9
child 1292 59c7a470a51e
Only save the window position if we're in windowed mode
src/video/wincommon/SDL_sysevents.c
src/video/windib/SDL_dibvideo.c
src/video/windx5/SDL_dx5video.c
     1.1 --- a/src/video/wincommon/SDL_sysevents.c	Sun Jan 29 18:17:35 2006 +0000
     1.2 +++ b/src/video/wincommon/SDL_sysevents.c	Sun Jan 29 22:09:26 2006 +0000
     1.3 @@ -568,8 +568,12 @@
     1.4  			GetClientRect(SDL_Window, &SDL_bounds);
     1.5  			ClientToScreen(SDL_Window, (LPPOINT)&SDL_bounds);
     1.6  			ClientToScreen(SDL_Window, (LPPOINT)&SDL_bounds+1);
     1.7 -			SDL_windowX = SDL_bounds.left;
     1.8 -			SDL_windowY = SDL_bounds.top;
     1.9 +			if ( !SDL_resizing && !IsZoomed(SDL_Window) &&
    1.10 +			     SDL_PublicSurface &&
    1.11 +				!(SDL_PublicSurface->flags & SDL_FULLSCREEN) ) {
    1.12 +				SDL_windowX = SDL_bounds.left;
    1.13 +				SDL_windowY = SDL_bounds.top;
    1.14 +			}
    1.15  			w = SDL_bounds.right-SDL_bounds.left;
    1.16  			h = SDL_bounds.bottom-SDL_bounds.top;
    1.17  			if ( this->input_grab != SDL_GRAB_OFF ) {
     2.1 --- a/src/video/windib/SDL_dibvideo.c	Sun Jan 29 18:17:35 2006 +0000
     2.2 +++ b/src/video/windib/SDL_dibvideo.c	Sun Jan 29 22:09:26 2006 +0000
     2.3 @@ -468,6 +468,7 @@
     2.4  	if ( current->flags & SDL_OPENGL ) {
     2.5  		WIN_GL_ShutDown(this);
     2.6  	}
     2.7 +	SDL_resizing = 1;
     2.8  
     2.9  	/* Recalculate the bitmasks if necessary */
    2.10  	if ( bpp == current->format->BitsPerPixel ) {
    2.11 @@ -686,7 +687,6 @@
    2.12  		}
    2.13  		swp_flags = (SWP_NOCOPYBITS | SWP_SHOWWINDOW);
    2.14  
    2.15 -		SDL_resizing = 1;
    2.16  		bounds.left = SDL_windowX;
    2.17  		bounds.top = SDL_windowY;
    2.18  		bounds.right = SDL_windowX+video->w;
    2.19 @@ -713,9 +713,13 @@
    2.20  			top = HWND_NOTOPMOST;
    2.21  		}
    2.22  		SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags);
    2.23 -		SDL_resizing = 0;
    2.24 +		if ( !(flags & SDL_FULLSCREEN) ) {
    2.25 +			SDL_windowX = SDL_bounds.left;
    2.26 +			SDL_windowY = SDL_bounds.top;
    2.27 +		}
    2.28  		SetForegroundWindow(SDL_Window);
    2.29  	}
    2.30 +	SDL_resizing = 0;
    2.31  
    2.32  	/* Set up for OpenGL */
    2.33  	if ( flags & SDL_OPENGL ) {
     3.1 --- a/src/video/windx5/SDL_dx5video.c	Sun Jan 29 18:17:35 2006 +0000
     3.2 +++ b/src/video/windx5/SDL_dx5video.c	Sun Jan 29 22:09:26 2006 +0000
     3.3 @@ -1007,6 +1007,7 @@
     3.4  	LPDIRECTDRAWSURFACE  dd_surface1;
     3.5  	LPDIRECTDRAWSURFACE3 dd_surface3;
     3.6  
     3.7 +	SDL_resizing = 1;
     3.8  #ifdef DDRAW_DEBUG
     3.9   fprintf(stderr, "Setting %dx%dx%d video mode\n", width, height, bpp);
    3.10  #endif
    3.11 @@ -1157,7 +1158,6 @@
    3.12  			}
    3.13  			swp_flags = (SWP_NOCOPYBITS | SWP_SHOWWINDOW);
    3.14  
    3.15 -			SDL_resizing = 1;
    3.16  			bounds.left = SDL_windowX;
    3.17  			bounds.top = SDL_windowY;
    3.18  			bounds.right = SDL_windowX+video->w;
    3.19 @@ -1184,9 +1184,13 @@
    3.20  				top = HWND_NOTOPMOST;
    3.21  			}
    3.22  			SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags);
    3.23 -			SDL_resizing = 0;
    3.24 +			if ( !(flags & SDL_FULLSCREEN) ) {
    3.25 +				SDL_windowX = SDL_bounds.left;
    3.26 +				SDL_windowY = SDL_bounds.top;
    3.27 +			}
    3.28  			SetForegroundWindow(SDL_Window);
    3.29  		}
    3.30 +		SDL_resizing = 0;
    3.31  
    3.32  		/* Set up for OpenGL */
    3.33  		if ( WIN_GL_SetupWindow(this) < 0 ) {
    3.34 @@ -1240,7 +1244,6 @@
    3.35  		int maxRefreshRate;
    3.36  
    3.37  		/* Cover up desktop during mode change */
    3.38 -		SDL_resizing = 1;
    3.39  		bounds.left = 0;
    3.40  		bounds.top = 0;
    3.41  		bounds.right = GetSystemMetrics(SM_CXSCREEN);
    3.42 @@ -1250,7 +1253,6 @@
    3.43  			bounds.left, bounds.top, 
    3.44  			bounds.right - bounds.left,
    3.45  			bounds.bottom - bounds.top, SWP_NOCOPYBITS);
    3.46 -		SDL_resizing = 0;
    3.47  		ShowWindow(SDL_Window, SW_SHOW);
    3.48  		while ( GetForegroundWindow() != SDL_Window ) {
    3.49  			SetForegroundWindow(SDL_Window);
    3.50 @@ -1559,7 +1561,6 @@
    3.51  			}
    3.52  			swp_flags = SWP_NOCOPYBITS;
    3.53  
    3.54 -			SDL_resizing = 1;
    3.55  			bounds.left = SDL_windowX;
    3.56  			bounds.top = SDL_windowY;
    3.57  			bounds.right = SDL_windowX+video->w;
    3.58 @@ -1578,12 +1579,14 @@
    3.59  				swp_flags |= SWP_NOMOVE;
    3.60  			}
    3.61  			SetWindowPos(SDL_Window, HWND_NOTOPMOST, x, y, width, height, swp_flags);
    3.62 -			SDL_resizing = 0;
    3.63 +			SDL_windowX = SDL_bounds.left;
    3.64 +			SDL_windowY = SDL_bounds.top;
    3.65  		}
    3.66  
    3.67  	}
    3.68  	ShowWindow(SDL_Window, SW_SHOW);
    3.69  	SetForegroundWindow(SDL_Window);
    3.70 +	SDL_resizing = 0;
    3.71  
    3.72  	/* We're live! */
    3.73  	return(video);