From 41df8b886e62cc9a2681ba216835b2ad6e115df8 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Thu, 13 May 2004 20:46:28 +0000 Subject: [PATCH] - Make WinPosSearchChildren more readable. svn path=/trunk/; revision=9374 --- reactos/subsys/win32k/ntuser/winpos.c | 115 +++++++++++++------------- 1 file changed, 57 insertions(+), 58 deletions(-) diff --git a/reactos/subsys/win32k/ntuser/winpos.c b/reactos/subsys/win32k/ntuser/winpos.c index ecd50c1655a..faa97c92de4 100644 --- a/reactos/subsys/win32k/ntuser/winpos.c +++ b/reactos/subsys/win32k/ntuser/winpos.c @@ -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.114 2004/05/10 17:07:18 weiden Exp $ +/* $Id: winpos.c,v 1.115 2004/05/13 20:46:28 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -1350,70 +1350,69 @@ WinPosShowWindow(HWND Wnd, INT Cmd) return(WasVisible); } -VOID STATIC FASTCALL -WinPosSearchChildren(PWINDOW_OBJECT ScopeWin, PUSER_MESSAGE_QUEUE OnlyHitTests, POINT *Point, - PWINDOW_OBJECT* Window, USHORT *HitTest) +STATIC VOID FASTCALL +WinPosSearchChildren( + PWINDOW_OBJECT ScopeWin, PUSER_MESSAGE_QUEUE OnlyHitTests, POINT *Point, + PWINDOW_OBJECT* Window, USHORT *HitTest) { - PWINDOW_OBJECT Current; - HWND *List, *phWnd; + PWINDOW_OBJECT Current; + HWND *List, *phWnd; - if((List = IntWinListChildren(ScopeWin))) - { - for(phWnd = List; *phWnd; ++phWnd) - { - if(!(Current = IntGetWindowObject(*phWnd))) + if ((List = IntWinListChildren(ScopeWin))) + { + for (phWnd = List; *phWnd; ++phWnd, IntReleaseWindowObject(Current)) { - continue; - } - - if (Current->Style & WS_VISIBLE && - (!(Current->Style & WS_DISABLED) || (Current->Style & (WS_CHILD | WS_POPUP)) != WS_CHILD) && - IntPtInWindow(Current, Point->x, Point->y)) - { - if(*Window) - { - IntReleaseWindowObject(*Window); - } - *Window = Current; - - if(Current->Style & WS_DISABLED) - { - *HitTest = HTERROR; - ExFreePool(List); - return; - } - - if(OnlyHitTests && (Current->MessageQueue == OnlyHitTests)) - { - *HitTest = IntSendMessage(Current->Self, WM_NCHITTEST, 0, - MAKELONG(Point->x, Point->y)); - if((*HitTest) == (USHORT)HTTRANSPARENT) - { + if (!(Current = IntGetWindowObject(*phWnd))) continue; - } - } - else - { - *HitTest = HTCLIENT; - } + + if (!(Current->Style & WS_VISIBLE)) + continue; + + if ((Current->Style & (WS_POPUP | WS_CHILD | WS_DISABLED)) == + (WS_CHILD | WS_DISABLED)) + continue; + + if (!IntPtInWindow(Current, Point->x, Point->y)) + continue; + + if (*Window) + IntReleaseWindowObject(*Window); + *Window = Current; + + if (Current->Style & WS_MINIMIZE) + { + *HitTest = HTCAPTION; + break; + } + + if (Current->Style & WS_DISABLED) + { + *HitTest = HTERROR; + break; + } - if(Point->x >= Current->ClientRect.left && - Point->x < Current->ClientRect.right && - Point->y >= Current->ClientRect.top && - Point->y < Current->ClientRect.bottom) - { - WinPosSearchChildren(Current, OnlyHitTests, Point, Window, HitTest); - ExFreePool(List); - return; - } + if (OnlyHitTests && (Current->MessageQueue == OnlyHitTests)) + { + *HitTest = IntSendMessage(Current->Self, WM_NCHITTEST, 0, + MAKELONG(Point->x, Point->y)); + if ((*HitTest) == (USHORT)HTTRANSPARENT) + continue; + } + else + *HitTest = HTCLIENT; - ExFreePool(List); - return; + if (Point->x >= Current->ClientRect.left && + Point->x < Current->ClientRect.right && + Point->y >= Current->ClientRect.top && + Point->y < Current->ClientRect.bottom) + { + WinPosSearchChildren(Current, OnlyHitTests, Point, Window, HitTest); + } + + break; } - IntReleaseWindowObject(Current); - } - ExFreePool(List); - } + ExFreePool(List); + } } USHORT FASTCALL