Only save the window position if we're in windowed mode
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401294
This commit is contained in:
parent
b8df286813
commit
e051a43d15
3 changed files with 21 additions and 10 deletions
|
@ -568,8 +568,12 @@ LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
GetClientRect(SDL_Window, &SDL_bounds);
|
GetClientRect(SDL_Window, &SDL_bounds);
|
||||||
ClientToScreen(SDL_Window, (LPPOINT)&SDL_bounds);
|
ClientToScreen(SDL_Window, (LPPOINT)&SDL_bounds);
|
||||||
ClientToScreen(SDL_Window, (LPPOINT)&SDL_bounds+1);
|
ClientToScreen(SDL_Window, (LPPOINT)&SDL_bounds+1);
|
||||||
SDL_windowX = SDL_bounds.left;
|
if ( !SDL_resizing && !IsZoomed(SDL_Window) &&
|
||||||
SDL_windowY = SDL_bounds.top;
|
SDL_PublicSurface &&
|
||||||
|
!(SDL_PublicSurface->flags & SDL_FULLSCREEN) ) {
|
||||||
|
SDL_windowX = SDL_bounds.left;
|
||||||
|
SDL_windowY = SDL_bounds.top;
|
||||||
|
}
|
||||||
w = SDL_bounds.right-SDL_bounds.left;
|
w = SDL_bounds.right-SDL_bounds.left;
|
||||||
h = SDL_bounds.bottom-SDL_bounds.top;
|
h = SDL_bounds.bottom-SDL_bounds.top;
|
||||||
if ( this->input_grab != SDL_GRAB_OFF ) {
|
if ( this->input_grab != SDL_GRAB_OFF ) {
|
||||||
|
|
|
@ -468,6 +468,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
if ( current->flags & SDL_OPENGL ) {
|
if ( current->flags & SDL_OPENGL ) {
|
||||||
WIN_GL_ShutDown(this);
|
WIN_GL_ShutDown(this);
|
||||||
}
|
}
|
||||||
|
SDL_resizing = 1;
|
||||||
|
|
||||||
/* Recalculate the bitmasks if necessary */
|
/* Recalculate the bitmasks if necessary */
|
||||||
if ( bpp == current->format->BitsPerPixel ) {
|
if ( bpp == current->format->BitsPerPixel ) {
|
||||||
|
@ -686,7 +687,6 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
}
|
}
|
||||||
swp_flags = (SWP_NOCOPYBITS | SWP_SHOWWINDOW);
|
swp_flags = (SWP_NOCOPYBITS | SWP_SHOWWINDOW);
|
||||||
|
|
||||||
SDL_resizing = 1;
|
|
||||||
bounds.left = SDL_windowX;
|
bounds.left = SDL_windowX;
|
||||||
bounds.top = SDL_windowY;
|
bounds.top = SDL_windowY;
|
||||||
bounds.right = SDL_windowX+video->w;
|
bounds.right = SDL_windowX+video->w;
|
||||||
|
@ -713,9 +713,13 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
top = HWND_NOTOPMOST;
|
top = HWND_NOTOPMOST;
|
||||||
}
|
}
|
||||||
SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags);
|
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);
|
SetForegroundWindow(SDL_Window);
|
||||||
}
|
}
|
||||||
|
SDL_resizing = 0;
|
||||||
|
|
||||||
/* Set up for OpenGL */
|
/* Set up for OpenGL */
|
||||||
if ( flags & SDL_OPENGL ) {
|
if ( flags & SDL_OPENGL ) {
|
||||||
|
|
|
@ -1007,6 +1007,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
LPDIRECTDRAWSURFACE dd_surface1;
|
LPDIRECTDRAWSURFACE dd_surface1;
|
||||||
LPDIRECTDRAWSURFACE3 dd_surface3;
|
LPDIRECTDRAWSURFACE3 dd_surface3;
|
||||||
|
|
||||||
|
SDL_resizing = 1;
|
||||||
#ifdef DDRAW_DEBUG
|
#ifdef DDRAW_DEBUG
|
||||||
fprintf(stderr, "Setting %dx%dx%d video mode\n", width, height, bpp);
|
fprintf(stderr, "Setting %dx%dx%d video mode\n", width, height, bpp);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1157,7 +1158,6 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
}
|
}
|
||||||
swp_flags = (SWP_NOCOPYBITS | SWP_SHOWWINDOW);
|
swp_flags = (SWP_NOCOPYBITS | SWP_SHOWWINDOW);
|
||||||
|
|
||||||
SDL_resizing = 1;
|
|
||||||
bounds.left = SDL_windowX;
|
bounds.left = SDL_windowX;
|
||||||
bounds.top = SDL_windowY;
|
bounds.top = SDL_windowY;
|
||||||
bounds.right = SDL_windowX+video->w;
|
bounds.right = SDL_windowX+video->w;
|
||||||
|
@ -1184,9 +1184,13 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
top = HWND_NOTOPMOST;
|
top = HWND_NOTOPMOST;
|
||||||
}
|
}
|
||||||
SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags);
|
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);
|
SetForegroundWindow(SDL_Window);
|
||||||
}
|
}
|
||||||
|
SDL_resizing = 0;
|
||||||
|
|
||||||
/* Set up for OpenGL */
|
/* Set up for OpenGL */
|
||||||
if ( WIN_GL_SetupWindow(this) < 0 ) {
|
if ( WIN_GL_SetupWindow(this) < 0 ) {
|
||||||
|
@ -1240,7 +1244,6 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
int maxRefreshRate;
|
int maxRefreshRate;
|
||||||
|
|
||||||
/* Cover up desktop during mode change */
|
/* Cover up desktop during mode change */
|
||||||
SDL_resizing = 1;
|
|
||||||
bounds.left = 0;
|
bounds.left = 0;
|
||||||
bounds.top = 0;
|
bounds.top = 0;
|
||||||
bounds.right = GetSystemMetrics(SM_CXSCREEN);
|
bounds.right = GetSystemMetrics(SM_CXSCREEN);
|
||||||
|
@ -1250,7 +1253,6 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
bounds.left, bounds.top,
|
bounds.left, bounds.top,
|
||||||
bounds.right - bounds.left,
|
bounds.right - bounds.left,
|
||||||
bounds.bottom - bounds.top, SWP_NOCOPYBITS);
|
bounds.bottom - bounds.top, SWP_NOCOPYBITS);
|
||||||
SDL_resizing = 0;
|
|
||||||
ShowWindow(SDL_Window, SW_SHOW);
|
ShowWindow(SDL_Window, SW_SHOW);
|
||||||
while ( GetForegroundWindow() != SDL_Window ) {
|
while ( GetForegroundWindow() != SDL_Window ) {
|
||||||
SetForegroundWindow(SDL_Window);
|
SetForegroundWindow(SDL_Window);
|
||||||
|
@ -1559,7 +1561,6 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
}
|
}
|
||||||
swp_flags = SWP_NOCOPYBITS;
|
swp_flags = SWP_NOCOPYBITS;
|
||||||
|
|
||||||
SDL_resizing = 1;
|
|
||||||
bounds.left = SDL_windowX;
|
bounds.left = SDL_windowX;
|
||||||
bounds.top = SDL_windowY;
|
bounds.top = SDL_windowY;
|
||||||
bounds.right = SDL_windowX+video->w;
|
bounds.right = SDL_windowX+video->w;
|
||||||
|
@ -1578,12 +1579,14 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||||
swp_flags |= SWP_NOMOVE;
|
swp_flags |= SWP_NOMOVE;
|
||||||
}
|
}
|
||||||
SetWindowPos(SDL_Window, HWND_NOTOPMOST, x, y, width, height, swp_flags);
|
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);
|
ShowWindow(SDL_Window, SW_SHOW);
|
||||||
SetForegroundWindow(SDL_Window);
|
SetForegroundWindow(SDL_Window);
|
||||||
|
SDL_resizing = 0;
|
||||||
|
|
||||||
/* We're live! */
|
/* We're live! */
|
||||||
return(video);
|
return(video);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue