From 96a21f824fbae5bb3f43871c64ed7ac25aeb02ab Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Wed, 31 Mar 2004 19:44:34 +0000 Subject: [PATCH] fixed NtUserGetAncestor() svn path=/trunk/; revision=8938 --- reactos/subsys/win32k/ntuser/msgqueue.c | 8 ++--- reactos/subsys/win32k/ntuser/window.c | 48 ++++++++++++------------- 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/reactos/subsys/win32k/ntuser/msgqueue.c b/reactos/subsys/win32k/ntuser/msgqueue.c index 7e8acfd9f40..597f4ab719c 100644 --- a/reactos/subsys/win32k/ntuser/msgqueue.c +++ b/reactos/subsys/win32k/ntuser/msgqueue.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: msgqueue.c,v 1.79 2004/03/28 21:46:26 weiden Exp $ +/* $Id: msgqueue.c,v 1.80 2004/03/31 19:44:34 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -248,8 +248,6 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh, USHORT Msg = Message->Msg.message; PWINDOW_OBJECT CaptureWin, Window = NULL; POINT Point; - LPARAM SpareLParam; - LRESULT Result; if (Msg == WM_LBUTTONDOWN || Msg == WM_MBUTTONDOWN || @@ -269,11 +267,11 @@ MsqTranslateMouseMessage(HWND hWnd, UINT FilterLow, UINT FilterHigh, { if(Window->Self != IntGetFocusWindow()) { - SpareLParam = MAKELONG(*HitTest, Msg); if(*HitTest != (USHORT)HTTRANSPARENT) { - Result = IntSendMessage(Window->Self, WM_MOUSEACTIVATE, (WPARAM)NtUserGetParent(Window->Self), (LPARAM)SpareLParam); + LRESULT Result; + Result = IntSendMessage(Window->Self, WM_MOUSEACTIVATE, (WPARAM)NtUserGetParent(Window->Self), (LPARAM)MAKELONG(*HitTest, Msg)); switch (Result) { diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index 69cab7938fb..7c81158cbce 100644 --- a/reactos/subsys/win32k/ntuser/window.c +++ b/reactos/subsys/win32k/ntuser/window.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: window.c,v 1.206 2004/03/31 19:20:18 gvg Exp $ +/* $Id: window.c,v 1.207 2004/03/31 19:44:34 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -2124,40 +2124,38 @@ NtUserGetAncestor(HWND hWnd, UINT Type) switch (Type) { case GA_PARENT: + { WndAncestor = IntGetParentObject(Wnd); break; + } case GA_ROOT: + { + PWINDOW_OBJECT tmp; WndAncestor = Wnd; Parent = NULL; -#if 0 - while (0 != (WndAncestor->Style & WS_CHILD)) - { - Parent = IntGetParentObject(WndAncestor); - if (WndAncestor != Wnd) - { - IntReleaseWindowObject(WndAncestor); - } - WndAncestor = Parent; - } -#else + for(;;) { - if(Parent) - { - IntReleaseWindowObject(Parent); - } - if(!(Parent = IntGetParentObject(WndAncestor)) || - !IntIsDesktopWindow(WndAncestor)) + tmp = Parent; + if(!(Parent = IntGetParentObject(WndAncestor))) { break; } + if(IntIsDesktopWindow(Parent)) + { + IntReleaseWindowObject(Parent); + break; + } + if(tmp) + IntReleaseWindowObject(tmp); WndAncestor = Parent; } -#endif break; + } case GA_ROOTOWNER: + { WndAncestor = Wnd; IntReferenceWindowObject(WndAncestor); for (;;) @@ -2173,21 +2171,19 @@ NtUserGetAncestor(HWND hWnd, UINT Type) WndAncestor = Parent; } break; + } default: + { IntReleaseWindowObject(Wnd); return NULL; + } } + hWndAncestor = (WndAncestor ? WndAncestor->Self : NULL); IntReleaseWindowObject(Wnd); - if(!WndAncestor) - { - return NULL; - } - - hWndAncestor = WndAncestor->Self; - if(WndAncestor != Wnd) + if(WndAncestor && (WndAncestor != Wnd)) IntReleaseWindowObject(WndAncestor); return hWndAncestor;