comparison 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
comparison
equal deleted inserted replaced
1290:c4a5a772c5d9 1291:31331c444ea2
1005 (WS_THICKFRAME|WS_MAXIMIZEBOX); 1005 (WS_THICKFRAME|WS_MAXIMIZEBOX);
1006 DDSURFACEDESC ddsd; 1006 DDSURFACEDESC ddsd;
1007 LPDIRECTDRAWSURFACE dd_surface1; 1007 LPDIRECTDRAWSURFACE dd_surface1;
1008 LPDIRECTDRAWSURFACE3 dd_surface3; 1008 LPDIRECTDRAWSURFACE3 dd_surface3;
1009 1009
1010 SDL_resizing = 1;
1010 #ifdef DDRAW_DEBUG 1011 #ifdef DDRAW_DEBUG
1011 fprintf(stderr, "Setting %dx%dx%d video mode\n", width, height, bpp); 1012 fprintf(stderr, "Setting %dx%dx%d video mode\n", width, height, bpp);
1012 #endif 1013 #endif
1013 /* Clean up any previous DirectDraw surfaces */ 1014 /* Clean up any previous DirectDraw surfaces */
1014 if ( current->hwdata ) { 1015 if ( current->hwdata ) {
1155 } 1156 }
1156 } 1157 }
1157 } 1158 }
1158 swp_flags = (SWP_NOCOPYBITS | SWP_SHOWWINDOW); 1159 swp_flags = (SWP_NOCOPYBITS | SWP_SHOWWINDOW);
1159 1160
1160 SDL_resizing = 1;
1161 bounds.left = SDL_windowX; 1161 bounds.left = SDL_windowX;
1162 bounds.top = SDL_windowY; 1162 bounds.top = SDL_windowY;
1163 bounds.right = SDL_windowX+video->w; 1163 bounds.right = SDL_windowX+video->w;
1164 bounds.bottom = SDL_windowY+video->h; 1164 bounds.bottom = SDL_windowY+video->h;
1165 AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0); 1165 AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
1182 top = HWND_TOPMOST; 1182 top = HWND_TOPMOST;
1183 } else { 1183 } else {
1184 top = HWND_NOTOPMOST; 1184 top = HWND_NOTOPMOST;
1185 } 1185 }
1186 SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags); 1186 SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags);
1187 SDL_resizing = 0; 1187 if ( !(flags & SDL_FULLSCREEN) ) {
1188 SDL_windowX = SDL_bounds.left;
1189 SDL_windowY = SDL_bounds.top;
1190 }
1188 SetForegroundWindow(SDL_Window); 1191 SetForegroundWindow(SDL_Window);
1189 } 1192 }
1193 SDL_resizing = 0;
1190 1194
1191 /* Set up for OpenGL */ 1195 /* Set up for OpenGL */
1192 if ( WIN_GL_SetupWindow(this) < 0 ) { 1196 if ( WIN_GL_SetupWindow(this) < 0 ) {
1193 return(NULL); 1197 return(NULL);
1194 } 1198 }
1238 RECT bounds; 1242 RECT bounds;
1239 struct DX5EnumRect *rect; 1243 struct DX5EnumRect *rect;
1240 int maxRefreshRate; 1244 int maxRefreshRate;
1241 1245
1242 /* Cover up desktop during mode change */ 1246 /* Cover up desktop during mode change */
1243 SDL_resizing = 1;
1244 bounds.left = 0; 1247 bounds.left = 0;
1245 bounds.top = 0; 1248 bounds.top = 0;
1246 bounds.right = GetSystemMetrics(SM_CXSCREEN); 1249 bounds.right = GetSystemMetrics(SM_CXSCREEN);
1247 bounds.bottom = GetSystemMetrics(SM_CYSCREEN); 1250 bounds.bottom = GetSystemMetrics(SM_CYSCREEN);
1248 AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0); 1251 AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
1249 SetWindowPos(SDL_Window, HWND_TOPMOST, 1252 SetWindowPos(SDL_Window, HWND_TOPMOST,
1250 bounds.left, bounds.top, 1253 bounds.left, bounds.top,
1251 bounds.right - bounds.left, 1254 bounds.right - bounds.left,
1252 bounds.bottom - bounds.top, SWP_NOCOPYBITS); 1255 bounds.bottom - bounds.top, SWP_NOCOPYBITS);
1253 SDL_resizing = 0;
1254 ShowWindow(SDL_Window, SW_SHOW); 1256 ShowWindow(SDL_Window, SW_SHOW);
1255 while ( GetForegroundWindow() != SDL_Window ) { 1257 while ( GetForegroundWindow() != SDL_Window ) {
1256 SetForegroundWindow(SDL_Window); 1258 SetForegroundWindow(SDL_Window);
1257 SDL_Delay(100); 1259 SDL_Delay(100);
1258 } 1260 }
1557 } 1559 }
1558 } 1560 }
1559 } 1561 }
1560 swp_flags = SWP_NOCOPYBITS; 1562 swp_flags = SWP_NOCOPYBITS;
1561 1563
1562 SDL_resizing = 1;
1563 bounds.left = SDL_windowX; 1564 bounds.left = SDL_windowX;
1564 bounds.top = SDL_windowY; 1565 bounds.top = SDL_windowY;
1565 bounds.right = SDL_windowX+video->w; 1566 bounds.right = SDL_windowX+video->w;
1566 bounds.bottom = SDL_windowY+video->h; 1567 bounds.bottom = SDL_windowY+video->h;
1567 AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0); 1568 AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), FALSE, 0);
1576 } else { 1577 } else {
1577 x = y = -1; 1578 x = y = -1;
1578 swp_flags |= SWP_NOMOVE; 1579 swp_flags |= SWP_NOMOVE;
1579 } 1580 }
1580 SetWindowPos(SDL_Window, HWND_NOTOPMOST, x, y, width, height, swp_flags); 1581 SetWindowPos(SDL_Window, HWND_NOTOPMOST, x, y, width, height, swp_flags);
1581 SDL_resizing = 0; 1582 SDL_windowX = SDL_bounds.left;
1583 SDL_windowY = SDL_bounds.top;
1582 } 1584 }
1583 1585
1584 } 1586 }
1585 ShowWindow(SDL_Window, SW_SHOW); 1587 ShowWindow(SDL_Window, SW_SHOW);
1586 SetForegroundWindow(SDL_Window); 1588 SetForegroundWindow(SDL_Window);
1589 SDL_resizing = 0;
1587 1590
1588 /* We're live! */ 1591 /* We're live! */
1589 return(video); 1592 return(video);
1590 } 1593 }
1591 1594