fixed WinPosWindowFromPoint(), now it should work properly.

svn path=/trunk/; revision=8262
This commit is contained in:
Thomas Bluemel 2004-02-19 15:27:55 +00:00
parent 98efb8ab35
commit 3ea2262879
2 changed files with 51 additions and 48 deletions

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: msgqueue.c,v 1.65 2004/02/08 21:47:10 gvg Exp $ /* $Id: msgqueue.c,v 1.66 2004/02/19 15:27:55 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -291,6 +291,8 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh,
} }
else else
{ {
if(Window)
IntReleaseWindowObject(Window);
ExFreePool(Message); ExFreePool(Message);
*Freed = TRUE; *Freed = TRUE;
return(FALSE); return(FALSE);

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: winpos.c,v 1.90 2004/02/18 12:21:57 rcampbell Exp $ /* $Id: winpos.c,v 1.91 2004/02/19 15:27:55 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -1231,17 +1231,8 @@ WinPosShowWindow(HWND Wnd, INT Cmd)
} }
BOOL STATIC FASTCALL BOOL STATIC FASTCALL
WinPosPtInWindow(PWINDOW_OBJECT Window, POINT Point) WinPosSearchChildren(PWINDOW_OBJECT ScopeWin, POINT *Point,
{ PWINDOW_OBJECT* Window, USHORT *HitTest)
return(Point.x >= Window->WindowRect.left &&
Point.x < Window->WindowRect.right &&
Point.y >= Window->WindowRect.top &&
Point.y < Window->WindowRect.bottom);
}
USHORT STATIC FASTCALL
WinPosSearchChildren(PWINDOW_OBJECT ScopeWin, POINT Point,
PWINDOW_OBJECT* Window)
{ {
PWINDOW_OBJECT Current; PWINDOW_OBJECT Current;
@ -1252,37 +1243,64 @@ WinPosSearchChildren(PWINDOW_OBJECT ScopeWin, POINT Point,
if (Current->Style & WS_VISIBLE && if (Current->Style & WS_VISIBLE &&
((!(Current->Style & WS_DISABLED)) || ((!(Current->Style & WS_DISABLED)) ||
(Current->Style & (WS_CHILD | WS_POPUP)) != WS_CHILD) && (Current->Style & (WS_CHILD | WS_POPUP)) != WS_CHILD) &&
WinPosPtInWindow(Current, Point)) (Point->x >= Current->WindowRect.left &&
Point->x < Current->WindowRect.right &&
Point->y >= Current->WindowRect.top &&
Point->y < Current->WindowRect.bottom))
/* FIXME - check if Point is in window region */
{ {
if(*Window) if(*Window)
{
ObmDereferenceObject(*Window); ObmDereferenceObject(*Window);
}
ObmReferenceObjectByPointer(Current, otWindow); ObmReferenceObjectByPointer(Current, otWindow);
*Window = Current; *Window = Current;
if (Current->Style & WS_DISABLED) if (Current->Style & WS_DISABLED)
{ {
ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock); ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock);
return(HTERROR); *HitTest = HTERROR;
return TRUE;
} }
if (Point.x >= Current->ClientRect.left && if(Current->MessageQueue == PsGetWin32Thread()->MessageQueue)
Point.x < Current->ClientRect.right && {
Point.y >= Current->ClientRect.top && *HitTest = IntSendMessage(Current->Self, WM_NCHITTEST, 0,
Point.y < Current->ClientRect.bottom) MAKELONG(Point->x, Point->y));
if((*HitTest) == (USHORT)HTTRANSPARENT)
{ {
Current = Current->NextSibling;
continue;
}
}
else
{
*HitTest = HTCLIENT;
}
ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock); if (Point->x >= Current->ClientRect.left &&
return(WinPosSearchChildren(Current, Point, Window)); Point->x < Current->ClientRect.right &&
Point->y >= Current->ClientRect.top &&
Point->y < Current->ClientRect.bottom)
{
USHORT ChildHitTest;
ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock);
if(WinPosSearchChildren(Current, Point, Window, &ChildHitTest))
{
*HitTest = ChildHitTest;
return TRUE;
}
} }
ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock); ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock);
return(0); return TRUE;
} }
Current = Current->NextSibling; Current = Current->NextSibling;
} }
ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock); ExReleaseFastMutexUnsafe(&ScopeWin->ChildrenListLock);
return(0); if(*Window == NULL)
*HitTest = HTNOWHERE;
return FALSE;
} }
USHORT FASTCALL USHORT FASTCALL
@ -1314,28 +1332,11 @@ WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, POINT WinPoint,
Point.y += ScopeWin->ClientRect.top - DesktopWindow->ClientRect.top; Point.y += ScopeWin->ClientRect.top - DesktopWindow->ClientRect.top;
IntReleaseWindowObject(DesktopWindow); IntReleaseWindowObject(DesktopWindow);
HitTest = WinPosSearchChildren(ScopeWin, Point, Window); if(WinPosSearchChildren(ScopeWin, &Point, Window, &HitTest))
if (HitTest != 0) {
{ return HitTest;
return(HitTest); }
} return HTNOWHERE;
if ((*Window) == NULL)
{
return(HTNOWHERE);
}
if ((*Window)->MessageQueue == PsGetWin32Thread()->MessageQueue)
{
HitTest = IntSendMessage((*Window)->Self, WM_NCHITTEST, 0,
MAKELONG(Point.x, Point.y));
/* FIXME: Check for HTTRANSPARENT here. */
}
else
{
HitTest = HTCLIENT;
}
return(HitTest);
} }
BOOL BOOL