mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 14:01:45 +00:00
Don't use AdjustWindowRectEx to determine window sizes
- GetSystemMetrics can lie about the window border sizes, so we can't trust it if the executable is flagged as Vista-targetting (default behavior for VS2012/2013).
This commit is contained in:
parent
8398a6ee75
commit
4f04fb4fbd
6 changed files with 22 additions and 20 deletions
|
@ -505,9 +505,10 @@ bool D3DFB::CreateResources()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Resize the window to match desired dimensions
|
// Resize the window to match desired dimensions
|
||||||
int sizew = Width + GetSystemMetrics (SM_CXSIZEFRAME)*2;
|
RECT rect = { 0, 0, Width, Height };
|
||||||
int sizeh = Height + GetSystemMetrics (SM_CYSIZEFRAME) * 2 +
|
AdjustWindowRectEx(&rect, WS_VISIBLE|WS_OVERLAPPEDWINDOW, FALSE, WS_EX_APPWINDOW);
|
||||||
GetSystemMetrics (SM_CYCAPTION);
|
int sizew = rect.right - rect.left;
|
||||||
|
int sizeh = rect.bottom - rect.top;
|
||||||
LOG2 ("Resize window to %dx%d\n", sizew, sizeh);
|
LOG2 ("Resize window to %dx%d\n", sizew, sizeh);
|
||||||
VidResizing = true;
|
VidResizing = true;
|
||||||
// Make sure the window has a border in windowed mode
|
// Make sure the window has a border in windowed mode
|
||||||
|
|
|
@ -308,9 +308,10 @@ bool DDrawFB::CreateResources ()
|
||||||
MaybeCreatePalette ();
|
MaybeCreatePalette ();
|
||||||
|
|
||||||
// Resize the window to match desired dimensions
|
// Resize the window to match desired dimensions
|
||||||
int sizew = (Width << PixelDoubling) + GetSystemMetrics (SM_CXSIZEFRAME)*2;
|
RECT rect = { 0, 0, Width << PixelDoubling, Height << PixelDoubling };
|
||||||
int sizeh = (Height << PixelDoubling) + GetSystemMetrics (SM_CYSIZEFRAME) * 2 +
|
AdjustWindowRectEx(&rect, WS_VISIBLE|WS_OVERLAPPEDWINDOW, FALSE, WS_EX_APPWINDOW);
|
||||||
GetSystemMetrics (SM_CYCAPTION);
|
int sizew = rect.right - rect.left;
|
||||||
|
int sizeh = rect.bottom - rect.top;
|
||||||
LOG2 ("Resize window to %dx%d\n", sizew, sizeh);
|
LOG2 ("Resize window to %dx%d\n", sizew, sizeh);
|
||||||
VidResizing = true;
|
VidResizing = true;
|
||||||
// Make sure the window has a border in windowed mode
|
// Make sure the window has a border in windowed mode
|
||||||
|
|
|
@ -531,9 +531,10 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
if (screen && !VidResizing)
|
if (screen && !VidResizing)
|
||||||
{
|
{
|
||||||
LPMINMAXINFO mmi = (LPMINMAXINFO)lParam;
|
LPMINMAXINFO mmi = (LPMINMAXINFO)lParam;
|
||||||
mmi->ptMinTrackSize.x = SCREENWIDTH + GetSystemMetrics (SM_CXSIZEFRAME) * 2;
|
RECT rect = { 0, 0, screen->GetWidth(), screen->GetHeight() };
|
||||||
mmi->ptMinTrackSize.y = SCREENHEIGHT + GetSystemMetrics (SM_CYSIZEFRAME) * 2 +
|
AdjustWindowRectEx(&rect, WS_VISIBLE|WS_OVERLAPPEDWINDOW, FALSE, WS_EX_APPWINDOW);
|
||||||
GetSystemMetrics (SM_CYCAPTION);
|
mmi->ptMinTrackSize.x = rect.right - rect.left;
|
||||||
|
mmi->ptMinTrackSize.y = rect.bottom - rect.top;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -907,11 +907,7 @@ void DoMain (HINSTANCE hInstance)
|
||||||
FixPathSeperator(program);
|
FixPathSeperator(program);
|
||||||
progdir.Truncate((long)strlen(program));
|
progdir.Truncate((long)strlen(program));
|
||||||
progdir.UnlockBuffer();
|
progdir.UnlockBuffer();
|
||||||
/*
|
|
||||||
height = GetSystemMetrics (SM_CYFIXEDFRAME) * 2 +
|
|
||||||
GetSystemMetrics (SM_CYCAPTION) + 12 * 32;
|
|
||||||
width = GetSystemMetrics (SM_CXFIXEDFRAME) * 2 + 8 * 78;
|
|
||||||
*/
|
|
||||||
width = 512;
|
width = 512;
|
||||||
height = 384;
|
height = 384;
|
||||||
|
|
||||||
|
|
|
@ -206,9 +206,10 @@ LRESULT CALLBACK MovieWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
||||||
if (screen && !FullVideo)
|
if (screen && !FullVideo)
|
||||||
{
|
{
|
||||||
LPMINMAXINFO mmi = (LPMINMAXINFO)lParam;
|
LPMINMAXINFO mmi = (LPMINMAXINFO)lParam;
|
||||||
mmi->ptMinTrackSize.x = SCREENWIDTH + GetSystemMetrics (SM_CXSIZEFRAME) * 2;
|
RECT rect = { 0, 0, screen->GetWidth(), screen->GetHeight() };
|
||||||
mmi->ptMinTrackSize.y = SCREENHEIGHT + GetSystemMetrics (SM_CYSIZEFRAME) * 2 +
|
AdjustWindowRectEx(&rect, WS_VISIBLE|WS_OVERLAPPEDWINDOW, FALSE, WS_EX_APPWINDOW);
|
||||||
GetSystemMetrics (SM_CYCAPTION);
|
mmi->ptMinTrackSize.x = rect.right - rect.left;
|
||||||
|
mmi->ptMinTrackSize.y = rect.bottom - rect.top;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1227,9 +1227,11 @@ void ST_Util_SizeWindowForBitmap (int scale)
|
||||||
{
|
{
|
||||||
rect.bottom = 0;
|
rect.bottom = 0;
|
||||||
}
|
}
|
||||||
w = StartupBitmap->bmiHeader.biWidth * scale + GetSystemMetrics (SM_CXSIZEFRAME)*2;
|
RECT sizerect = { 0, 0, StartupBitmap->bmiHeader.biWidth * scale,
|
||||||
h = StartupBitmap->bmiHeader.biHeight * scale + rect.bottom
|
StartupBitmap->bmiHeader.biHeight * scale + rect.bottom };
|
||||||
+ GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYCAPTION);
|
AdjustWindowRectEx(&sizerect, WS_VISIBLE|WS_OVERLAPPEDWINDOW, FALSE, WS_EX_APPWINDOW);
|
||||||
|
w = sizerect.right - sizerect.left;
|
||||||
|
h = sizerect.bottom - sizerect.top;
|
||||||
|
|
||||||
// Resize the window, but keep its center point the same, unless that
|
// Resize the window, but keep its center point the same, unless that
|
||||||
// puts it partially offscreen.
|
// puts it partially offscreen.
|
||||||
|
|
Loading…
Reference in a new issue