[prev in list] [next in list] [prev in thread] [next in thread]
List: freedesktop-xorg-devel
Subject: [PATCH 03/12] Cygwin/X: Correctly allow for the native window frame
From: jon.turney () dronecode ! org ! uk (Jon TURNEY)
Date: 2009-05-20 11:52:21
Message-ID: 1242820350-5200-4-git-send-email-jon.turney () dronecode ! org ! uk
[Download RAW message or body]
Fix internal WM to correctly calculate the native window border when validating window sizing
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
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 b5e789c..0dd8885 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) {
--
1.6.1.2
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic