Fix T37999: incorrect windows size with Visual Studio 2013 builds.

This is a known bug in Windows, now work around it.
https://bugreports.qt-project.org/browse/QTBUG-36192
http://connect.microsoft.com/VisualStudio/feedback/details/753224/regression-getsystemmetrics-delivers-different-values
This commit is contained in:
Brecht Van Lommel 2014-01-28 21:35:55 +01:00
parent ae46e8a698
commit 52ea13e970
Notes: blender-bot 2023-02-14 11:25:11 +01:00
Referenced by issue #37999, blender window size does not match to given cmd-line arguments
1 changed files with 15 additions and 2 deletions

View File

@ -180,8 +180,21 @@ GHOST_WindowWin32::GHOST_WindowWin32(
MONITORINFO monitor;
GHOST_TUns32 tw, th;
width += GetSystemMetrics(SM_CXSIZEFRAME) * 2;
height += GetSystemMetrics(SM_CYSIZEFRAME) * 2 + GetSystemMetrics(SM_CYCAPTION);
#if !defined(_MSC_VER) || _MSC_VER < 1700
int cxsizeframe = GetSystemMetrics(SM_CXSIZEFRAME);
int cysizeframe = GetSystemMetrics(SM_CYSIZEFRAME);
#else
// MSVC 2012+ returns bogus values from GetSystemMetrics, bug in Windows
// http://connect.microsoft.com/VisualStudio/feedback/details/753224/regression-getsystemmetrics-delivers-different-values
RECT cxrect = {0, 0, 0, 0};
AdjustWindowRectEx(&cxrect, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_THICKFRAME | WS_DLGFRAME, FALSE, 0);
int cxsizeframe = abs(cxrect.bottom);
int cysizeframe = abs(cxrect.left);
#endif
width += cxsizeframe * 2;
height += cysizeframe * 2 + GetSystemMetrics(SM_CYCAPTION);
rect.left = left;
rect.right = left + width;