mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
Fix The Win32 Backend for Newer Visual Studio Versions
The GetSystemMetrics() function returns wrong values for SM_CXSIZEFRAME, SM_CYSIZEFRAME, SM_CXFIXEDFRAME and SM_CYFIXEDFRAME when built with Visual Studio 2012 and 2013 (unless the XP compatibility setting for the PlatformToolset entry is turned on), causing the window of Clutter programs to automatically shrink to a point where they become unusable. This patch uses AdjustWindowRectEx() for builds using Visual Studio 2012 and later, which deduces the required height and width of the Window properly. Unfortunately we can't use this for the VS 2008/2010 builds as they cause the Window to continually expand as the program is run. https://bugzilla.gnome.org/show_bug.cgi?id=725873
This commit is contained in:
parent
acd7d9555c
commit
c1fd29df7a
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user