Implemented GetWindowRgn() and GetWindowRgnBox()

svn path=/trunk/; revision=8853
This commit is contained in:
Thomas Bluemel 2004-03-23 21:47:37 +00:00
parent 022bd7dd68
commit 39c6756765
6 changed files with 131 additions and 20 deletions

View file

@ -178,6 +178,8 @@ NtUserCallOneParam(
DWORD Param, DWORD Param,
DWORD Routine); DWORD Routine);
#define TWOPARAM_ROUTINE_GETWINDOWRGNBOX 0x48
#define TWOPARAM_ROUTINE_GETWINDOWRGN 0x49
#define TWOPARAM_ROUTINE_SETMENUBARHEIGHT 0x50 #define TWOPARAM_ROUTINE_SETMENUBARHEIGHT 0x50
#define TWOPARAM_ROUTINE_SETMENUITEMRECT 0x51 #define TWOPARAM_ROUTINE_SETMENUITEMRECT 0x51
#define TWOPARAM_ROUTINE_SETGUITHRDHANDLE 0x52 #define TWOPARAM_ROUTINE_SETGUITHRDHANDLE 0x52

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.56 2004/01/23 23:38:26 ekohl Exp $ /* $Id: stubs.c,v 1.57 2004/03/23 21:47:36 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -802,19 +802,6 @@ GetRegisteredRawInputDevices(
return FALSE; return FALSE;
} }
/*
* @unimplemented
*/
int
STDCALL
GetWindowRgnBox(
HWND hWnd,
LPRECT lprc)
{
UNIMPLEMENTED;
return FALSE;
}
/* /*
* @unimplemented * @unimplemented
*/ */

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: paint.c,v 1.24 2004/03/23 16:32:20 weiden Exp $ /* $Id: paint.c,v 1.25 2004/03/23 21:47:37 weiden Exp $
* *
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/paint.c * FILE: lib/user32/windows/paint.c
@ -256,7 +256,7 @@ ValidateRgn(
/* /*
* @unimplemented * @implemented
*/ */
int int
STDCALL STDCALL
@ -264,10 +264,23 @@ GetWindowRgn(
HWND hWnd, HWND hWnd,
HRGN hRgn) HRGN hRgn)
{ {
UNIMPLEMENTED; return (int)NtUserCallTwoParam((DWORD)hWnd, (DWORD)hRgn, TWOPARAM_ROUTINE_GETWINDOWRGN);
return 0;
} }
/*
* @implemented
*/
int
STDCALL
GetWindowRgnBox(
HWND hWnd,
LPRECT lprc)
{
return (int)NtUserCallTwoParam((DWORD)hWnd, (DWORD)lprc, TWOPARAM_ROUTINE_GETWINDOWRGNBOX);
}
const BYTE MappingTable[33] = {5,9,2,3,5,7,0,0,0,7,5,5,3,2,7,5,3,3,0,5,7,10,5,0,11,4,1,1,3,8,6,12,7}; const BYTE MappingTable[33] = {5,9,2,3,5,7,0,0,0,7,5,5,3,2,7,5,3,3,0,5,7,10,5,0,11,4,1,1,3,8,6,12,7};
/* /*
* @implemented * @implemented

View file

@ -188,6 +188,12 @@ IntGetParent(PWINDOW_OBJECT Wnd);
PWINDOW_OBJECT FASTCALL PWINDOW_OBJECT FASTCALL
IntGetParentObject(PWINDOW_OBJECT Wnd); IntGetParentObject(PWINDOW_OBJECT Wnd);
INT FASTCALL
IntGetWindowRgn(HWND hWnd, HRGN hRgn);
INT FASTCALL
IntGetWindowRgnBox(HWND hWnd, RECT *Rect);
DWORD IntRemoveWndProcHandle(WNDPROC Handle); DWORD IntRemoveWndProcHandle(WNDPROC Handle);
DWORD IntRemoveProcessWndProcHandles(HANDLE ProcessID); DWORD IntRemoveProcessWndProcHandles(HANDLE ProcessID);
DWORD IntAddWndProcHandle(WNDPROC WindowProc, BOOL IsUnicode); DWORD IntAddWndProcHandle(WNDPROC WindowProc, BOOL IsUnicode);

View file

@ -1,4 +1,4 @@
/* $Id: misc.c,v 1.54 2004/03/07 11:59:43 navaraf Exp $ /* $Id: misc.c,v 1.55 2004/03/23 21:47:37 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -197,6 +197,23 @@ NtUserCallTwoParam(
switch(Routine) switch(Routine)
{ {
case TWOPARAM_ROUTINE_GETWINDOWRGNBOX:
{
DWORD Ret;
RECT rcRect;
Ret = (DWORD)IntGetWindowRgnBox((HWND)Param1, &rcRect);
Status = MmCopyToCaller((PVOID)Param2, &rcRect, sizeof(RECT));
if(!NT_SUCCESS(Status))
{
SetLastNtError(Status);
return ERROR;
}
return Ret;
}
case TWOPARAM_ROUTINE_GETWINDOWRGN:
{
return (DWORD)IntGetWindowRgn((HWND)Param1, (HRGN)Param2);
}
case TWOPARAM_ROUTINE_SETMENUBARHEIGHT: case TWOPARAM_ROUTINE_SETMENUBARHEIGHT:
{ {
DWORD Ret; DWORD Ret;

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: window.c,v 1.200 2004/03/23 16:32:20 weiden Exp $ /* $Id: window.c,v 1.201 2004/03/23 21:47:37 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -3394,6 +3394,92 @@ NtUserSetWindowPos(
} }
INT FASTCALL
IntGetWindowRgn(HWND hWnd, HRGN hRgn)
{
INT Ret;
PWINDOW_OBJECT WindowObject;
HRGN VisRgn;
ROSRGNDATA *pRgn;
if(!(WindowObject = IntGetWindowObject(hWnd)))
{
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return ERROR;
}
if(!hRgn)
{
IntReleaseWindowObject(WindowObject);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return ERROR;
}
/* Create a new window region using the window rectangle */
VisRgn = UnsafeIntCreateRectRgnIndirect(&WindowObject->WindowRect);
NtGdiOffsetRgn(VisRgn, -WindowObject->WindowRect.left, -WindowObject->WindowRect.top);
/* if there's a region assigned to the window, combine them both */
if(WindowObject->WindowRegion && !(WindowObject->Style & WS_MINIMIZE))
NtGdiCombineRgn(VisRgn, VisRgn, WindowObject->WindowRegion, RGN_AND);
/* Copy the region into hRgn */
NtGdiCombineRgn(hRgn, VisRgn, NULL, RGN_COPY);
if((pRgn = RGNDATA_LockRgn(hRgn)))
{
Ret = pRgn->rdh.iType;
RGNDATA_UnlockRgn(hRgn);
}
else
Ret = ERROR;
NtGdiDeleteObject(VisRgn);
IntReleaseWindowObject(WindowObject);
return Ret;
}
INT FASTCALL
IntGetWindowRgnBox(HWND hWnd, RECT *Rect)
{
INT Ret;
PWINDOW_OBJECT WindowObject;
HRGN VisRgn;
ROSRGNDATA *pRgn;
if(!(WindowObject = IntGetWindowObject(hWnd)))
{
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return ERROR;
}
if(!Rect)
{
IntReleaseWindowObject(WindowObject);
SetLastWin32Error(ERROR_INVALID_PARAMETER);
return ERROR;
}
/* Create a new window region using the window rectangle */
VisRgn = UnsafeIntCreateRectRgnIndirect(&WindowObject->WindowRect);
NtGdiOffsetRgn(VisRgn, -WindowObject->WindowRect.left, -WindowObject->WindowRect.top);
/* if there's a region assigned to the window, combine them both */
if(WindowObject->WindowRegion && !(WindowObject->Style & WS_MINIMIZE))
NtGdiCombineRgn(VisRgn, VisRgn, WindowObject->WindowRegion, RGN_AND);
if((pRgn = RGNDATA_LockRgn(VisRgn)))
{
Ret = pRgn->rdh.iType;
*Rect = pRgn->rdh.rcBound;
RGNDATA_UnlockRgn(VisRgn);
}
else
Ret = ERROR;
NtGdiDeleteObject(VisRgn);
IntReleaseWindowObject(WindowObject);
return Ret;
}
/* /*
* @implemented * @implemented
*/ */