Now restores window position when returning from fullscreen

This commit is contained in:
pagefault
2001-08-26 02:24:16 +00:00
parent 3c84c0e563
commit 6d03d8c15d

View File

@@ -1697,26 +1697,27 @@ void initwinvideo(void)
if (!FirstVid) if (!FirstVid)
{ {
if (X<0)X=0; if (X<0)X=0;
if (X>(GetSystemMetrics( SM_CXSCREEN )-WindowWidth)) X=(GetSystemMetrics( SM_CXSCREEN )-WindowWidth); if (X>(GetSystemMetrics(SM_CXSCREEN) - WindowWidth)) X=(GetSystemMetrics(SM_CXSCREEN) - WindowWidth);
if (Y<0)Y=0; if (Y<0)Y=0;
if (Y>(GetSystemMetrics( SM_CYSCREEN )-WindowHeight)) Y=(GetSystemMetrics( SM_CYSCREEN )-WindowHeight); if (Y>(GetSystemMetrics(SM_CYSCREEN) - WindowHeight)) Y=(GetSystemMetrics(SM_CYSCREEN) - WindowHeight);
if (FullScreen==1) {X=0; Y=0;} if (FullScreen==1) {X=0; Y=0;}
MainWindowX = X; MainWindowY = Y; if (FullScreen==0 && newmode == 1) { X = MainWindowX; Y = MainWindowY; }
else if (FullScreen==0) { MainWindowX = X; MainWindowY = Y; }
MoveWindow( hMainWindow, X, Y, MoveWindow(hMainWindow, X, Y, WindowWidth, WindowHeight, TRUE);
WindowWidth, WindowHeight, TRUE );
wndpl.length = sizeof(wndpl); wndpl.length = sizeof(wndpl);
GetWindowPlacement( hMainWindow, &wndpl); GetWindowPlacement(hMainWindow, &wndpl);
SetRect( &rc1, 0, 0, WindowWidth, WindowHeight ); SetRect(&rc1, 0, 0, WindowWidth, WindowHeight);
AdjustWindowRectEx( &rc1,GetWindowLong( hMainWindow, GWL_STYLE ), AdjustWindowRectEx(&rc1,GetWindowLong(hMainWindow, GWL_STYLE),
GetMenu( hMainWindow ) != NULL, GetWindowLong( hMainWindow, GWL_EXSTYLE ) ); GetMenu(hMainWindow) != NULL, GetWindowLong(hMainWindow, GWL_EXSTYLE));
GetClientRect(hMainWindow, &rcWindow); GetClientRect(hMainWindow, &rcWindow);
ClientToScreen(hMainWindow, ( LPPOINT )&rcWindow); ClientToScreen(hMainWindow, (LPPOINT) &rcWindow);
ClientToScreen(hMainWindow, ( LPPOINT )&rcWindow + 1); ClientToScreen(hMainWindow, (LPPOINT) &rcWindow + 1);
} }
else else
{ {
@@ -1737,8 +1738,9 @@ void initwinvideo(void)
{ {
exit(1); exit(1);
} }
X=(GetSystemMetrics( SM_CXSCREEN ) - WindowWidth) / 2; X=(GetSystemMetrics(SM_CXSCREEN) - WindowWidth) / 2;
Y=(GetSystemMetrics( SM_CYSCREEN ) - WindowHeight) / 2; Y=(GetSystemMetrics(SM_CYSCREEN) - WindowHeight) / 2;
if (FullScreen==1) {X=0; Y=0;} if (FullScreen==1) {X=0; Y=0;}
if (hMainWindow) if (hMainWindow)