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>
This commit is contained in:
parent
a72865868f
commit
888e6961a4
|
@ -207,6 +207,8 @@ ValidateSizing (HWND hwnd, WindowPtr pWin,
|
||||||
WinXSizeHints sizeHints;
|
WinXSizeHints sizeHints;
|
||||||
RECT *rect;
|
RECT *rect;
|
||||||
int iWidth, iHeight;
|
int iWidth, iHeight;
|
||||||
|
RECT rcClient, rcWindow;
|
||||||
|
int iBorderWidthX, iBorderWidthY;
|
||||||
|
|
||||||
/* Invalid input checking */
|
/* Invalid input checking */
|
||||||
if (pWin==NULL || lParam==0)
|
if (pWin==NULL || lParam==0)
|
||||||
|
@ -228,19 +230,20 @@ ValidateSizing (HWND hwnd, WindowPtr pWin,
|
||||||
iWidth = rect->right - rect->left;
|
iWidth = rect->right - rect->left;
|
||||||
iHeight = rect->bottom - rect->top;
|
iHeight = rect->bottom - rect->top;
|
||||||
|
|
||||||
/* Now remove size of any borders */
|
/* Now remove size of any borders and title bar */
|
||||||
iWidth -= 2 * GetSystemMetrics(SM_CXSIZEFRAME);
|
GetClientRect(hwnd, &rcClient);
|
||||||
iHeight -= (GetSystemMetrics(SM_CYCAPTION)
|
GetWindowRect(hwnd, &rcWindow);
|
||||||
+ 2 * GetSystemMetrics(SM_CYSIZEFRAME));
|
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 */
|
/* Constrain the size to legal values */
|
||||||
ConstrainSize (sizeHints, &iWidth, &iHeight);
|
ConstrainSize (sizeHints, &iWidth, &iHeight);
|
||||||
|
|
||||||
/* Add back the borders */
|
/* Add back the size of borders and title bar */
|
||||||
iWidth += 2 * GetSystemMetrics(SM_CXSIZEFRAME);
|
iWidth += iBorderWidthX;
|
||||||
iHeight += (GetSystemMetrics(SM_CYCAPTION)
|
iHeight += iBorderWidthY;
|
||||||
+ 2 * GetSystemMetrics(SM_CYSIZEFRAME));
|
|
||||||
|
|
||||||
/* Adjust size according to where we're dragging from */
|
/* Adjust size according to where we're dragging from */
|
||||||
switch(wParam) {
|
switch(wParam) {
|
||||||
|
|
Loading…
Reference in New Issue