diff --git a/reactos/lib/user32/windows/defwnd.c b/reactos/lib/user32/windows/defwnd.c index 9462cf64967..c91cfa7c4df 100644 --- a/reactos/lib/user32/windows/defwnd.c +++ b/reactos/lib/user32/windows/defwnd.c @@ -1,4 +1,4 @@ -/* $Id: defwnd.c,v 1.87 2003/09/11 08:32:06 gvg Exp $ +/* $Id: defwnd.c,v 1.88 2003/09/21 06:44:51 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -1314,9 +1314,9 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam) WinPosGetMinMaxInfo(hwnd, NULL, NULL, &minTrack, &maxTrack); GetWindowRect(hwnd, &sizingRect); - origRect = sizingRect; if (Style & WS_CHILD) { + MapWindowPoints( 0, hWndParent, (LPPOINT)&sizingRect, 2 ); GetClientRect(hWndParent, &mouseRect ); } else @@ -1324,6 +1324,7 @@ DefWndDoSizeMove(HWND hwnd, WORD wParam) SetRect(&mouseRect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); } + origRect = sizingRect; if (ON_LEFT_BORDER(hittest)) { mouseRect.left = max( mouseRect.left, sizingRect.right-maxTrack.x ); diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index b96f116aa42..bd69228a196 100644 --- a/reactos/subsys/win32k/ntuser/window.c +++ b/reactos/subsys/win32k/ntuser/window.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: window.c,v 1.108 2003/09/13 13:58:38 weiden Exp $ +/* $Id: window.c,v 1.109 2003/09/21 06:44:51 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -1249,6 +1249,11 @@ NtUserCreateWindowEx(DWORD dwExStyle, WindowObject->WindowRect.top = y; WindowObject->WindowRect.right = x + nWidth; WindowObject->WindowRect.bottom = y + nHeight; + if (0 != (WindowObject->Style & WS_CHILD)) + { + NtGdiOffsetRect(&(WindowObject->WindowRect), WindowObject->Parent->ClientRect.left, + WindowObject->Parent->ClientRect.top); + } WindowObject->ClientRect = WindowObject->WindowRect; /* @@ -1269,6 +1274,11 @@ NtUserCreateWindowEx(DWORD dwExStyle, WindowObject->WindowRect.top = y; WindowObject->WindowRect.right = x + nWidth; WindowObject->WindowRect.bottom = y + nHeight; + if (0 != (WindowObject->Style & WS_CHILD)) + { + NtGdiOffsetRect(&(WindowObject->WindowRect), WindowObject->Parent->ClientRect.left, + WindowObject->Parent->ClientRect.top); + } WindowObject->ClientRect = WindowObject->WindowRect; /* FIXME: Initialize the window menu. */ @@ -1369,22 +1379,19 @@ NtUserCreateWindowEx(DWORD dwExStyle, DPRINT("NtUserCreateWindow(): About to send WM_MOVE\n"); - lParam = MAKE_LONG(WindowObject->ClientRect.left, - WindowObject->ClientRect.top); + if (0 != (WindowObject->Style & WS_CHILD)) + { + lParam = MAKE_LONG(WindowObject->ClientRect.left - WindowObject->Parent->ClientRect.left, + WindowObject->ClientRect.top - WindowObject->Parent->ClientRect.top); + } + else + { + lParam = MAKE_LONG(WindowObject->ClientRect.left, + WindowObject->ClientRect.top); + } IntCallWindowProc(NULL, WindowObject->Self, WM_MOVE, 0, lParam); } - /* Move from parent-client to screen coordinates */ - if (0 != (WindowObject->Style & WS_CHILD)) - { - NtGdiOffsetRect(&WindowObject->WindowRect, - ParentWindow->ClientRect.left, - ParentWindow->ClientRect.top); - NtGdiOffsetRect(&WindowObject->ClientRect, - ParentWindow->ClientRect.left, - ParentWindow->ClientRect.top); - } - /* Show or maybe minimize or maximize the window. */ if (WindowObject->Style & (WS_MINIMIZE | WS_MAXIMIZE)) { @@ -2874,6 +2881,26 @@ NtUserSetWindowPos( int cy, UINT uFlags) { + PWINDOW_OBJECT WindowObject; + NTSTATUS Status; + + Status = + ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable, + hWnd, otWindow, (PVOID*)&WindowObject); + if (!NT_SUCCESS(Status)) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + + if (0 != (WindowObject->Style & WS_CHILD)) + { + X += WindowObject->Parent->ClientRect.left; + Y += WindowObject->Parent->ClientRect.top; + } + + ObmDereferenceObject(WindowObject); + return WinPosSetWindowPos(hWnd, hWndInsertAfter, X, Y, cx, cy, uFlags); } diff --git a/reactos/subsys/win32k/ntuser/winpos.c b/reactos/subsys/win32k/ntuser/winpos.c index 3c7a2423420..7db00d93dce 100644 --- a/reactos/subsys/win32k/ntuser/winpos.c +++ b/reactos/subsys/win32k/ntuser/winpos.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: winpos.c,v 1.30 2003/09/09 09:39:21 gvg Exp $ +/* $Id: winpos.c,v 1.31 2003/09/21 06:44:51 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -389,8 +389,12 @@ WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos, params.rgrc[0] = *WindowRect; params.rgrc[1] = Window->WindowRect; params.rgrc[2] = Window->ClientRect; - if (Window->Style & WS_CHILD) + if (0 != (Window->Style & WS_CHILD)) { + NtGdiOffsetRect(&(params.rgrc[0]), - Window->Parent->ClientRect.left, + - Window->Parent->ClientRect.top); + NtGdiOffsetRect(&(params.rgrc[1]), - Window->Parent->ClientRect.left, + - Window->Parent->ClientRect.top); NtGdiOffsetRect(&(params.rgrc[2]), - Window->Parent->ClientRect.left, - Window->Parent->ClientRect.top); } @@ -446,6 +450,8 @@ WinPosDoWinPosChanging(PWINDOW_OBJECT WindowObject, PRECT WindowRect, PRECT ClientRect) { + INT X, Y; + if (!(WinPos->flags & SWP_NOSENDCHANGING)) { IntSendWINDOWPOSCHANGINGMessage(WindowObject->Self, WinPos); @@ -464,18 +470,25 @@ WinPosDoWinPosChanging(PWINDOW_OBJECT WindowObject, if (!(WinPos->flags & SWP_NOMOVE)) { - WindowRect->left = WinPos->x; - WindowRect->top = WinPos->y; - WindowRect->right += WinPos->x - WindowObject->WindowRect.left; - WindowRect->bottom += WinPos->y - WindowObject->WindowRect.top; + X = WinPos->x; + Y = WinPos->y; + if (0 != (WindowObject->Style & WS_CHILD)) + { + X += WindowObject->Parent->ClientRect.left; + Y += WindowObject->Parent->ClientRect.top; + } + WindowRect->left = X; + WindowRect->top = Y; + WindowRect->right += X - WindowObject->WindowRect.left; + WindowRect->bottom += Y - WindowObject->WindowRect.top; NtGdiOffsetRect(ClientRect, - WinPos->x - WindowObject->WindowRect.left, - WinPos->y - WindowObject->WindowRect.top); + X - WindowObject->WindowRect.left, + Y - WindowObject->WindowRect.top); } WinPos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE; - return(TRUE); + return TRUE; } /*********************************************************************** @@ -510,6 +523,7 @@ WinPosInternalMoveWindow(PWINDOW_OBJECT Window, INT MoveX, INT MoveY) } +/* x and y are always screen relative */ BOOLEAN STDCALL WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags) @@ -606,6 +620,11 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx, WinPos.cx = cx; WinPos.cy = cy; WinPos.flags = flags; + if (0 != (Window->Style & WS_CHILD)) + { + WinPos.x -= Window->Parent->ClientRect.left; + WinPos.y -= Window->Parent->ClientRect.top; + } WinPosDoWinPosChanging(Window, &WinPos, &NewWindowRect, &NewClientRect); @@ -692,8 +711,12 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx, /* Determine which pixels can be copied from the old window position to the new. Those pixels must be visible in both the old and new - position. */ - if (NULL != VisBefore && NULL != VisAfter && ! (WinPos.flags & SWP_NOCOPYBITS)) + position. Also, check the class style to see if the windows of this + class need to be completely repainted on (horizontal/vertical) size + change */ + if (NULL != VisBefore && NULL != VisAfter && ! (WinPos.flags & SWP_NOCOPYBITS) + && ((WinPos.flags & SWP_NOSIZE) + || ! (Window->Class->style & (CS_HREDRAW | CS_VREDRAW)))) { CopyRgn = NtGdiCreateRectRgn(0, 0, 0, 0); RgnType = NtGdiCombineRgn(CopyRgn, VisAfter, VisBefore, RGN_AND); diff --git a/reactos/subsys/win32k/objects/dc.c b/reactos/subsys/win32k/objects/dc.c index dbed533cdc6..88e4f7947fe 100644 --- a/reactos/subsys/win32k/objects/dc.c +++ b/reactos/subsys/win32k/objects/dc.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: dc.c,v 1.80 2003/09/10 23:16:13 gvg Exp $ +/* $Id: dc.c,v 1.81 2003/09/21 06:44:51 gvg Exp $ * * DC.C - Device context functions * @@ -398,6 +398,17 @@ NtGdiCreatePrimarySurface(LPCWSTR Driver, return(FALSE); } + if (0 == PrimarySurface.GDIInfo.ulLogPixelsX) + { + DPRINT("Adjusting GDIInfo.ulLogPixelsX\n"); + PrimarySurface.GDIInfo.ulLogPixelsX = 96; + } + if (0 == PrimarySurface.GDIInfo.ulLogPixelsY) + { + DPRINT("Adjusting GDIInfo.ulLogPixelsY\n"); + PrimarySurface.GDIInfo.ulLogPixelsY = 96; + } + DPRINT("calling completePDev\n"); /* Complete initialization of the physical device */