Fix for window border when building with VS2012 & VS2013, using GetSystemMetrics(SM_CXPADDINGBORDER)

This commit is contained in:
tomcw 2014-08-20 22:40:48 +01:00
parent 8a616f9380
commit e3508c29aa
2 changed files with 10 additions and 2 deletions

View File

@ -2168,14 +2168,16 @@ static void SetupTooltipControls(void)
SendMessage(tooltipwindow, TTM_ADDTOOL, 0, (LPARAM)&toolinfo);
}
// SM_CXPADDEDBORDER is not supported on 2000 & XP, but GetSystemMetrics() returns 0 for unknown values, so this use of SM_CXPADDEDBORDER works on 2000 & XP too:
// http://msdn.microsoft.com/en-nz/library/windows/desktop/ms724385(v=vs.85).aspx
static void GetWidthHeight(int& nWidth, int& nHeight)
{
nWidth = g_nViewportCX + VIEWPORTX*2
+ BUTTONCX
+ (GetSystemMetrics(SM_CXBORDER) + GetSystemMetrics(92)) * 2 // 92 = SM_CXPADDEDBORDER
+ (GetSystemMetrics(SM_CXBORDER) + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
+ MAGICX;
nHeight = g_nViewportCY + VIEWPORTY*2
+ (GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(92)) * 2 // 92 = SM_CXPADDEDBORDER
+ (GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2
+ GetSystemMetrics(SM_CYCAPTION)
+ MAGICY;
}

View File

@ -38,4 +38,10 @@
#include <queue>
#include <vector>
// SM_CXPADDEDBORDER is not supported on 2000 & XP:
// http://msdn.microsoft.com/en-nz/library/windows/desktop/ms724385(v=vs.85).aspx
#ifndef SM_CXPADDEDBORDER
#define SM_CXPADDEDBORDER 92
#endif
#define USE_SPEECH_API