reactos/subsys/win32k/include
diff -u -r1.12 -r1.13
--- winpos.h 26 Feb 2004 22:23:54 -0000 1.12
+++ winpos.h 13 Apr 2004 23:12:29 -0000 1.13
@@ -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
reactos/subsys/win32k/ntuser
diff -u -r1.214 -r1.215
--- window.c 13 Apr 2004 18:40:00 -0000 1.214
+++ window.c 13 Apr 2004 23:12:29 -0000 1.215
@@ -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 @@
/*
* @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;
-
- if(hwndParent)
+ PWINDOW_OBJECT Parent;
+ POINTL Pt;
+ HWND Ret;
+ HWND *List, *phWnd;
+
+ 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;
+ }
+ 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;
}
- SetLastWin32Error(ERROR_INVALID_PARAMETER);
+ IntReleaseWindowObject(Child);
+ }
}
-
- return (HWND)NULL;
+ ExFreePool(List);
+ }
+
+ if((Ret == NULL) && IntPtInWindow(Parent, Pt.x, Pt.y))
+ {
+ Ret = Parent->Self;
+ }
+
+ IntReleaseWindowObject(Parent);
+ return Ret;
}
reactos/subsys/win32k/ntuser
diff -u -r1.109 -r1.110
--- winpos.c 9 Apr 2004 20:03:19 -0000 1.109
+++ winpos.c 13 Apr 2004 23:12:30 -0000 1.110
@@ -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 @@
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)
{