From 52ea13e97087f9a1d604708fe821fcf04d35aba6 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 28 Jan 2014 21:35:55 +0100 Subject: 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 --- intern/ghost/intern/GHOST_WindowWin32.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'intern/ghost') diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index f5b716618e3..8436e3b0242 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -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; -- cgit v1.2.3