diff --git a/reactos/subsys/win32k/include/winpos.h b/reactos/subsys/win32k/include/winpos.h index fc51e2bde05..d45ce2b0a1e 100644 --- a/reactos/subsys/win32k/include/winpos.h +++ b/reactos/subsys/win32k/include/winpos.h @@ -5,6 +5,8 @@ #define SWP_NOCLIENTMOVE 0x0800 #define SWP_NOCLIENTSIZE 0x1000 +BOOL FASTCALL +IntGetClientOrigin(HWND hWnd, LPPOINT Point); LRESULT FASTCALL WinPosGetNonClientSize(HWND Wnd, RECT* WindowRect, RECT* ClientRect); UINT FASTCALL diff --git a/reactos/subsys/win32k/ntuser/painting.c b/reactos/subsys/win32k/ntuser/painting.c index 119bbbe1f97..151172f8405 100644 --- a/reactos/subsys/win32k/ntuser/painting.c +++ b/reactos/subsys/win32k/ntuser/painting.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: painting.c,v 1.51 2003/12/23 18:19:07 navaraf Exp $ + * $Id: painting.c,v 1.52 2003/12/23 21:33:25 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -701,8 +701,8 @@ IntFixCaret(HWND hWnd, LPRECT lprc, UINT flags) pt.x = info.rcCaret.left; pt.y = info.rcCaret.top; - NtUserGetClientOrigin(info.hwndCaret, &FromOffset); - NtUserGetClientOrigin(hWnd, &ToOffset); + IntGetClientOrigin(info.hwndCaret, &FromOffset); + IntGetClientOrigin(hWnd, &ToOffset); Offset.x = FromOffset.x - ToOffset.x; Offset.y = FromOffset.y - ToOffset.y; info.rcCaret.left += Offset.x; @@ -1153,7 +1153,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *rect, for (i = 0; List[i]; i++) { NtUserGetWindowRect(List[i], &r); - NtUserGetClientOrigin(hWnd, &ClientOrigin); + IntGetClientOrigin(hWnd, &ClientOrigin); r.left -= ClientOrigin.x; r.top -= ClientOrigin.y; r.right -= ClientOrigin.x; diff --git a/reactos/subsys/win32k/ntuser/winpos.c b/reactos/subsys/win32k/ntuser/winpos.c index 49b068f5a73..a78611e2900 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.66 2003/12/23 21:13:00 weiden Exp $ +/* $Id: winpos.c,v 1.67 2003/12/23 21:33:25 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -29,6 +29,7 @@ /* INCLUDES ******************************************************************/ #include +#include #include #include #include @@ -75,20 +76,41 @@ #define HAS_THINFRAME(Style, ExStyle) \ (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP)))) -BOOL STDCALL -NtUserGetClientOrigin(HWND hWnd, LPPOINT Point) +BOOL FASTCALL +IntGetClientOrigin(HWND hWnd, LPPOINT Point) { PWINDOW_OBJECT WindowObject; - + WindowObject = IntGetWindowObject(hWnd); if (WindowObject == NULL) { Point->x = Point->y = 0; - return(TRUE); + return FALSE; } Point->x = WindowObject->ClientRect.left; Point->y = WindowObject->ClientRect.top; - return(TRUE); + + IntReleaseWindowObject(WindowObject); + return TRUE; +} + +BOOL STDCALL +NtUserGetClientOrigin(HWND hWnd, LPPOINT Point) +{ + BOOL Ret; + POINT pt; + NTSTATUS Status; + + Ret = IntGetClientOrigin(hWnd, &pt); + + Status = MmCopyToCaller(Point, &pt, sizeof(POINT)); + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + return FALSE; + } + + return Ret; } /*******************************************************************