diff --git a/reactos/dll/win32/user32/windows/paint.c b/reactos/dll/win32/user32/windows/paint.c index 982cc5cfb06..6ea4a478c71 100644 --- a/reactos/dll/win32/user32/windows/paint.c +++ b/reactos/dll/win32/user32/windows/paint.c @@ -278,7 +278,7 @@ GetWindowRgn( pWnd = ValidateHwnd(hWnd); - if (!pWnd) // || !pwnd->hrgnClip || pwnd->state2 & WNDS2_MAXIMIZEDMONITORREGION) + if (!pWnd) // || !pWnd->hrgnClip || pWnd->state2 & WNDS2_MAXIMIZEDMONITORREGION) return ERROR; /* Ret = CombineRgn(hRgn, pWnd->hrgnClip, NULL, RGN_COPY); @@ -314,21 +314,19 @@ GetWindowRgnBox( pWnd = ValidateHwnd(hWnd); - if (!pWnd) // || !pwnd->hrgnClip || pwnd->state2 & WNDS2_MAXIMIZEDMONITORREGION) + if (!pWnd || !pWnd->hrgnClip || pWnd->state2 & WNDS2_MAXIMIZEDMONITORREGION) return ERROR; -/* + Ret = GetRgnBox(pWnd->hrgnClip, lprc); if (!Ret) return ERROR; if (pWnd->fnid != FNID_DESKTOP) - Ret = OffsetRect(lprc, -pWnd->rcWindow.left, -pWnd->rcWindow.top); + OffsetRect(lprc, -pWnd->rcWindow.left, -pWnd->rcWindow.top); if (pWnd->ExStyle & WS_EX_LAYOUTRTL) MirrorWindowRect(pWnd, lprc); -*/ - Ret = (int)NtUserCallTwoParam((DWORD_PTR)hWnd, (DWORD_PTR)lprc, TWOPARAM_ROUTINE_GETWINDOWRGNBOX); return Ret; } diff --git a/reactos/include/reactos/win32k/ntuser.h b/reactos/include/reactos/win32k/ntuser.h index 0b4f587a34a..5610bf94e7f 100644 --- a/reactos/include/reactos/win32k/ntuser.h +++ b/reactos/include/reactos/win32k/ntuser.h @@ -3130,7 +3130,6 @@ typedef struct tagKMDDELPARAM #define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING 0xfffe000d #define ONEPARAM_ROUTINE_GETDESKTOPMAPPING 0xfffe000e #define ONEPARAM_ROUTINE_GETCURSORPOSITION 0xfffe0048 // use ONEPARAM_ or TWOPARAM routine ? -#define TWOPARAM_ROUTINE_GETWINDOWRGNBOX 0xfffd0048 // user mode #define TWOPARAM_ROUTINE_GETWINDOWRGN 0xfffd0049 // user mode #define TWOPARAM_ROUTINE_SETMENUBARHEIGHT 0xfffd0050 #define TWOPARAM_ROUTINE_SETGUITHRDHANDLE 0xfffd0052 diff --git a/reactos/subsystems/win32/win32k/ntuser/simplecall.c b/reactos/subsystems/win32/win32k/ntuser/simplecall.c index f31b44296a1..155feeda3fc 100644 --- a/reactos/subsystems/win32/win32k/ntuser/simplecall.c +++ b/reactos/subsystems/win32/win32k/ntuser/simplecall.c @@ -367,7 +367,6 @@ NtUserCallTwoParam( DWORD_PTR Param2, DWORD Routine) { - NTSTATUS Status; PWND Window; DECLARE_RETURN(DWORD_PTR); @@ -376,22 +375,6 @@ NtUserCallTwoParam( switch(Routine) { - case TWOPARAM_ROUTINE_GETWINDOWRGNBOX: - { - DWORD_PTR Ret; - RECTL rcRect; - Window = UserGetWindowObject((HWND)Param1); - if (!Window) RETURN(ERROR); - - Ret = (DWORD_PTR)IntGetWindowRgnBox(Window, &rcRect); - Status = MmCopyToCaller((PVOID)Param2, &rcRect, sizeof(RECT)); - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - RETURN( ERROR); - } - RETURN( Ret); - } case TWOPARAM_ROUTINE_GETWINDOWRGN: { Window = UserGetWindowObject((HWND)Param1); diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index cb431f21000..321666e362f 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -4056,45 +4056,6 @@ IntGetWindowRgn(PWND Window, HRGN hRgn) return Ret; } -// This should be in user32! -INT FASTCALL -IntGetWindowRgnBox(PWND Window, RECTL *Rect) -{ - INT Ret; - HRGN VisRgn; - ROSRGNDATA *pRgn; - - if(!Window) - { - return ERROR; - } - if(!Rect) - { - return ERROR; - } - - /* Create a new window region using the window rectangle */ - VisRgn = IntSysCreateRectRgnIndirect(&Window->rcWindow); - NtGdiOffsetRgn(VisRgn, -Window->rcWindow.left, -Window->rcWindow.top); - /* if there's a region assigned to the window, combine them both */ - if(Window->hrgnClip && !(Window->style & WS_MINIMIZE)) - NtGdiCombineRgn(VisRgn, VisRgn, Window->hrgnClip, RGN_AND); - - if((pRgn = RGNOBJAPI_Lock(VisRgn, NULL))) - { - Ret = REGION_Complexity(pRgn); - *Rect = pRgn->rdh.rcBound; - RGNOBJAPI_Unlock(pRgn); - } - else - Ret = ERROR; - - REGION_FreeRgnByHandle(VisRgn); - - return Ret; -} - - /* * @implemented */ @@ -4143,6 +4104,12 @@ NtUserSetWindowRgn( GreDeleteObject(Window->hrgnClip); } + if (Window->fnid != FNID_DESKTOP) + NtGdiOffsetRgn(hrgnCopy, Window->rcWindow.left, Window->rcWindow.top); + + /* Set public ownership */ + IntGdiSetRegionOwner(hrgnCopy, GDI_OBJ_HMGR_PUBLIC); + Window->hrgnClip = hrgnCopy; Ret = co_WinPosSetWindowPos(Window, HWND_TOP, 0, 0, 0, 0, bRedraw ? flags : (flags|SWP_NOREDRAW) );