diff src/video/windx5/SDL_dx5video.c @ 1291:31331c444ea2

Only save the window position if we're in windowed mode
author Sam Lantinga <slouken@libsdl.org>
date Sun, 29 Jan 2006 22:09:26 +0000
parents c4a5a772c5d9
children c3e36ac8a94c
line wrap: on
line diff
--- a/src/video/windx5/SDL_dx5video.c	Sun Jan 29 18:17:35 2006 +0000
+++ b/src/video/windx5/SDL_dx5video.c	Sun Jan 29 22:09:26 2006 +0000
@@ -1007,6 +1007,7 @@
 	LPDIRECTDRAWSURFACE  dd_surface1;
 	LPDIRECTDRAWSURFACE3 dd_surface3;
 
+	SDL_resizing = 1;
 #ifdef DDRAW_DEBUG
  fprintf(stderr, "Setting %dx%dx%d video mode\n", width, height, bpp);
 #endif
@@ -1157,7 +1158,6 @@
 			}
 			swp_flags = (SWP_NOCOPYBITS | SWP_SHOWWINDOW);
 
-			SDL_resizing = 1;
 			bounds.left = SDL_windowX;
 			bounds.top = SDL_windowY;
 			bounds.right = SDL_windowX+video->w;
@@ -1184,9 +1184,13 @@
 				top = HWND_NOTOPMOST;
 			}
 			SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags);
-			SDL_resizing = 0;
+			if ( !(flags & SDL_FULLSCREEN) ) {
+				SDL_windowX = SDL_bounds.left;
+				SDL_windowY = SDL_bounds.top;
+			}
 			SetForegroundWindow(SDL_Window);
 		}
+		SDL_resizing = 0;
 
 		/* Set up for OpenGL */
 		if ( WIN_GL_SetupWindow(this) < 0 ) {
@@ -1240,7 +1244,6 @@
 		int maxRefreshRate;
 
 		/* Cover up desktop during mode change */
-		SDL_resizing = 1;
 		bounds.left = 0;
 		bounds.top = 0;
 		bounds.right = GetSystemMetrics(SM_CXSCREEN);
@@ -1250,7 +1253,6 @@
 			bounds.left, bounds.top, 
 			bounds.right - bounds.left,
 			bounds.bottom - bounds.top, SWP_NOCOPYBITS);
-		SDL_resizing = 0;
 		ShowWindow(SDL_Window, SW_SHOW);
 		while ( GetForegroundWindow() != SDL_Window ) {
 			SetForegroundWindow(SDL_Window);
@@ -1559,7 +1561,6 @@
 			}
 			swp_flags = SWP_NOCOPYBITS;
 
-			SDL_resizing = 1;
 			bounds.left = SDL_windowX;
 			bounds.top = SDL_windowY;
 			bounds.right = SDL_windowX+video->w;
@@ -1578,12 +1579,14 @@
 				swp_flags |= SWP_NOMOVE;
 			}
 			SetWindowPos(SDL_Window, HWND_NOTOPMOST, x, y, width, height, swp_flags);
-			SDL_resizing = 0;
+			SDL_windowX = SDL_bounds.left;
+			SDL_windowY = SDL_bounds.top;
 		}
 
 	}
 	ShowWindow(SDL_Window, SW_SHOW);
 	SetForegroundWindow(SDL_Window);
+	SDL_resizing = 0;
 
 	/* We're live! */
 	return(video);