[Bf-blender-cvs] [52ea13e] master: Fix T37999: incorrect windows size with Visual Studio 2013 builds.
Brecht Van Lommel
noreply at git.blender.org
Tue Jan 28 21:41:26 CET 2014
Commit: 52ea13e97087f9a1d604708fe821fcf04d35aba6
Author: Brecht Van Lommel
Date: Tue Jan 28 21:35:55 2014 +0100
https://developer.blender.org/rB52ea13e97087f9a1d604708fe821fcf04d35aba6
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
===================================================================
M intern/ghost/intern/GHOST_WindowWin32.cpp
===================================================================
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index f5b7166..8436e3b 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;
More information about the Bf-blender-cvs
mailing list