fixed implementation of ChildWindowFromPointEx()

svn path=/trunk/; revision=9134
This commit is contained in:
Thomas Bluemel 2004-04-13 23:12:30 +00:00
parent bbd9b3d4a8
commit b4472c0848
3 changed files with 65 additions and 70 deletions

View file

@ -5,6 +5,15 @@
#define SWP_NOCLIENTMOVE 0x0800
#define SWP_NOCLIENTSIZE 0x1000
#define IntPtInWindow(WndObject,x,y) \
((x) >= (WndObject)->WindowRect.left && \
(x) < (WndObject)->WindowRect.right && \
(y) >= (WndObject)->WindowRect.top && \
(y) < (WndObject)->WindowRect.bottom && \
(!(WndObject)->WindowRegion || ((WndObject)->Style & WS_MINIMIZE) || \
NtGdiPtInRegion((WndObject)->WindowRegion, (INT)((x) - (WndObject)->WindowRect.left), \
(INT)((y) - (WndObject)->WindowRect.top))))
BOOL FASTCALL
IntGetClientOrigin(HWND hWnd, LPPOINT Point);
LRESULT FASTCALL

View file

@ -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.214 2004/04/13 18:40:00 weiden Exp $
/* $Id: window.c,v 1.215 2004/04/13 23:12:29 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -1233,76 +1233,69 @@ NtUserBuildHwndList(
/*
* @implemented
*/
/* FIXME - NEEDS TO BE FIXED - UNSAFE !!! */
HWND STDCALL
NtUserChildWindowFromPointEx(HWND hwndParent,
LONG x,
LONG y,
UINT uiFlags)
{
PWINDOW_OBJECT pParent, pCurrent, pLast, pPar;
POINT p = {x,y};
RECT rc;
BOOL bFirstRun = TRUE;
PWINDOW_OBJECT Parent;
POINTL Pt;
HWND Ret;
HWND *List, *phWnd;
if(hwndParent)
if(!(Parent = IntGetWindowObject(hwndParent)))
{
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return NULL;
}
Ret = NULL;
Pt.x = Parent->WindowRect.left + x;
Pt.y = Parent->WindowRect.top + y;
if((List = IntWinListChildren(Parent)))
{
for(phWnd = List; *phWnd; phWnd++)
{
pParent = IntGetWindowObject(hwndParent);
if(pParent)
PWINDOW_OBJECT Child;
if((Child = IntGetWindowObject(*phWnd)))
{
if(!(Child->Style & WS_VISIBLE) && (uiFlags & CWP_SKIPINVISIBLE))
{
IntLockRelatives(pParent);
pLast = IntGetWindowObject(pParent->LastChild->Self);
pCurrent = IntGetWindowObject(pParent->FirstChild->Self);
do
{
if (!bFirstRun)
{
pCurrent = IntGetWindowObject(pCurrent->NextSibling->Self);
}
else
bFirstRun = FALSE;
if(!pCurrent)
{
IntUnLockRelatives(pParent);
return (HWND)NULL;
}
if(!(pPar = IntGetWindowObject(pCurrent->Parent)))
{
IntUnLockRelatives(pParent);
return (HWND)NULL;
}
rc.left = pCurrent->WindowRect.left - pPar->ClientRect.left;
rc.top = pCurrent->WindowRect.top - pPar->ClientRect.top;
rc.right = rc.left + (pCurrent->WindowRect.right - pCurrent->WindowRect.left);
rc.bottom = rc.top + (pCurrent->WindowRect.bottom - pCurrent->WindowRect.top);
DbgPrint("Rect: %i,%i,%i,%i\n",rc.left, rc.top, rc.right, rc.bottom);
IntReleaseWindowObject(pPar);
if (POINT_IN_RECT(p,rc)) /* Found a match */
{
if ( (uiFlags & CWP_SKIPDISABLED) && (pCurrent->Style & WS_DISABLED) )
continue;
if( (uiFlags & CWP_SKIPTRANSPARENT) && (pCurrent->ExStyle & WS_EX_TRANSPARENT) )
continue;
if( (uiFlags & CWP_SKIPINVISIBLE) && !(pCurrent->Style & WS_VISIBLE) )
continue;
IntUnLockRelatives(pParent);
return pCurrent->Self;
}
}
while(pCurrent != pLast);
IntUnLockRelatives(pParent);
return (HWND)NULL;
IntReleaseWindowObject(Child);
continue;
}
SetLastWin32Error(ERROR_INVALID_PARAMETER);
if((Child->Style & WS_DISABLED) && (uiFlags & CWP_SKIPDISABLED))
{
IntReleaseWindowObject(Child);
continue;
}
if((Child->ExStyle & WS_EX_TRANSPARENT) && (uiFlags & CWP_SKIPTRANSPARENT))
{
IntReleaseWindowObject(Child);
continue;
}
if(IntPtInWindow(Child, Pt.x, Pt.y))
{
Ret = Child->Self;
IntReleaseWindowObject(Child);
break;
}
IntReleaseWindowObject(Child);
}
}
ExFreePool(List);
}
return (HWND)NULL;
if((Ret == NULL) && IntPtInWindow(Parent, Pt.x, Pt.y))
{
Ret = Parent->Self;
}
IntReleaseWindowObject(Parent);
return Ret;
}

View file

@ -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.109 2004/04/09 20:03:19 navaraf Exp $
/* $Id: winpos.c,v 1.110 2004/04/13 23:12:30 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -1385,14 +1385,7 @@ WinPosSearchChildren(PWINDOW_OBJECT ScopeWin, BOOL SendHitTestMessage, POINT *Po
if (Current->Style & WS_VISIBLE &&
(!(Current->Style & WS_DISABLED) || (Current->Style & (WS_CHILD | WS_POPUP)) != WS_CHILD) &&
(Point->x >= Current->WindowRect.left &&
Point->x < Current->WindowRect.right &&
Point->y >= Current->WindowRect.top &&
Point->y < Current->WindowRect.bottom) &&
(!Current->WindowRegion || (Current->Style & WS_MINIMIZE) ||
NtGdiPtInRegion(Current->WindowRegion, (INT)(Point->x - Current->WindowRect.left),
(INT)(Point->y - Current->WindowRect.top)))
)
IntPtInWindow(Current, Point->x, Point->y))
{
if(*Window)
{