Alexandre Julliard : user32: The client rectangle is in screen coordinates for the initial WM_NCCALCSIZE .
Alexandre Julliard
julliard at winehq.org
Thu May 8 04:50:55 CDT 2008
Module: wine
Branch: master
Commit: 5714c4deee6f3c0cc30098d056fa4ce39a333878
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5714c4deee6f3c0cc30098d056fa4ce39a333878
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu May 8 11:12:03 2008 +0200
user32: The client rectangle is in screen coordinates for the initial WM_NCCALCSIZE.
---
dlls/user32/tests/win.c | 9 +++++++++
dlls/user32/win.c | 7 +++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 26ceb55..21119d5 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -3929,6 +3929,15 @@ static LRESULT CALLBACK winsizes_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM
expected_rect.left, expected_rect.top, expected_rect.right, expected_rect.bottom );
return DefWindowProc(hwnd, msg, wp, lp);
}
+ case WM_NCCALCSIZE:
+ {
+ RECT rect, *r = (RECT *)lp;
+ GetWindowRect( hwnd, &rect );
+ ok( !memcmp( &rect, r, sizeof(rect) ),
+ "passed rect %d,%d-%d,%d doesn't match window rect %d,%d-%d,%d\n",
+ r->left, r->top, r->right, r->bottom, rect.left, rect.top, rect.right, rect.bottom );
+ return DefWindowProc(hwnd, msg, wp, lp);
+ }
default:
return DefWindowProc(hwnd, msg, wp, lp);
}
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index a1f3024..8214fd5 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -1139,11 +1139,18 @@ static HWND WIN_CreateWindowEx( CREATESTRUCTA *cs, LPCWSTR className, UINT flags
if ((wndPtr = WIN_GetPtr(hwnd)))
{
/* yes, even if the CBT hook was called with HWND_TOP */
+ POINT pt;
HWND insert_after = (wndPtr->dwStyle & WS_CHILD) ? HWND_BOTTOM : HWND_TOP;
RECT window_rect = wndPtr->rectWindow;
RECT client_rect = window_rect;
WIN_ReleasePtr( wndPtr );
+
+ /* the rectangle is in screen coords for WM_NCCALCSIZE when wparam is FALSE */
+ pt.x = pt.y = 0;
+ MapWindowPoints( parent, 0, &pt, 1 );
+ OffsetRect( &client_rect, pt.x, pt.y );
SendMessageW( hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&client_rect );
+ OffsetRect( &client_rect, -pt.x, -pt.y );
set_window_pos( hwnd, insert_after, SWP_NOACTIVATE, &window_rect, &client_rect, NULL );
}
else return 0;
More information about the wine-cvs
mailing list