diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2009-01-07 18:29:16 +0000 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2009-05-27 14:11:36 +0100 |
commit | 888e6961a4ee76d05d212cfb946f089caafb3f69 (patch) | |
tree | e41f597f90e14161c5b048cfc668384570ba236e /hw | |
parent | a72865868f03b675f86990476fcee601822894b3 (diff) |
Cygwin/X: Correctly allow for the native window frame width in ValidateSizing()
Fix internal WM to correctly calculate the native window border when validating window sizing
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xwin/winmultiwindowwndproc.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c index b5e789c2c..0dd88851f 100644 --- a/hw/xwin/winmultiwindowwndproc.c +++ b/hw/xwin/winmultiwindowwndproc.c @@ -207,6 +207,8 @@ ValidateSizing (HWND hwnd, WindowPtr pWin, WinXSizeHints sizeHints; RECT *rect; int iWidth, iHeight; + RECT rcClient, rcWindow; + int iBorderWidthX, iBorderWidthY; /* Invalid input checking */ if (pWin==NULL || lParam==0) @@ -228,19 +230,20 @@ ValidateSizing (HWND hwnd, WindowPtr pWin, iWidth = rect->right - rect->left; iHeight = rect->bottom - rect->top; - /* Now remove size of any borders */ - iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME); - iHeight -= (GetSystemMetrics(SM_CYCAPTION) - + 2 * GetSystemMetrics(SM_CYSIZEFRAME)); - + /* Now remove size of any borders and title bar */ + GetClientRect(hwnd, &rcClient); + GetWindowRect(hwnd, &rcWindow); + iBorderWidthX = (rcWindow.right - rcWindow.left) - (rcClient.right - rcClient.left); + iBorderWidthY = (rcWindow.bottom - rcWindow.top) - (rcClient.bottom - rcClient.top); + iWidth -= iBorderWidthX; + iHeight -= iBorderWidthY; /* Constrain the size to legal values */ ConstrainSize (sizeHints, &iWidth, &iHeight); - /* Add back the borders */ - iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME); - iHeight += (GetSystemMetrics(SM_CYCAPTION) - + 2 * GetSystemMetrics(SM_CYSIZEFRAME)); + /* Add back the size of borders and title bar */ + iWidth += iBorderWidthX; + iHeight += iBorderWidthY; /* Adjust size according to where we're dragging from */ switch(wParam) { |