diff --git a/clutter/win32/clutter-stage-win32.c b/clutter/win32/clutter-stage-win32.c index bcc39a7d3..cdc1fc69b 100644 --- a/clutter/win32/clutter-stage-win32.c +++ b/clutter/win32/clutter-stage-win32.c @@ -138,11 +138,26 @@ get_full_window_size (ClutterStageWin32 *stage_win32, = clutter_stage_get_user_resizable (stage_win32->wrapper); /* The window size passed to CreateWindow includes the window decorations */ - *width_out = width_in + GetSystemMetrics (resizable ? SM_CXSIZEFRAME - : SM_CXFIXEDFRAME) * 2; - *height_out = height_in + GetSystemMetrics (resizable ? SM_CYSIZEFRAME - : SM_CYFIXEDFRAME) * 2 - + GetSystemMetrics (SM_CYCAPTION); + gint frame_width, frame_height; + +#if !defined (_MSC_VER) || (_MSC_VER < 1700) + frame_width = GetSystemMetrics (resizable ? SM_CXSIZEFRAME : SM_CXFIXEDFRAME); + frame_height = GetSystemMetrics (resizable ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME); +#else + /* MSVC 2012 and later returns wrong values from GetSystemMetrics() + * http://connect.microsoft.com/VisualStudio/feedback/details/753224/regression-getsystemmetrics-delivers-different-values + * + * For AdjustWindowRectEx(), it doesn't matter much whether the Window is resizble. + */ + + RECT cxrect = {0, 0, 0, 0}; + AdjustWindowRectEx (&cxrect, WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_THICKFRAME | WS_DLGFRAME, FALSE, 0); + + frame_width = abs (cxrect.bottom); + frame_height = abs (cxrect.left); +#endif + *width_out = width_in + frame_width * 2; + *height_out = height_in + frame_height * 2 + GetSystemMetrics (SM_CYCAPTION); } void