Optimize GetAncestor for the most common case GA_PARENT (for now)

svn path=/trunk/; revision=30518
This commit is contained in:
Thomas Bluemel 2007-11-17 06:22:39 +00:00
parent 07c6776607
commit 1e40d2861b

View file

@ -842,7 +842,42 @@ GetAltTabInfoW(HWND hwnd,
HWND STDCALL
GetAncestor(HWND hwnd, UINT gaFlags)
{
return(NtUserGetAncestor(hwnd, gaFlags));
HWND Ret = NULL;
PWINDOW Ancestor, Wnd;
Wnd = ValidateHwnd(hwnd);
if (!Wnd)
return NULL;
_SEH_TRY
{
Ancestor = NULL;
switch (gaFlags)
{
case GA_PARENT:
if (Wnd->Parent != NULL)
Ancestor = DesktopPtrToUser(Wnd->Parent);
break;
default:
/* FIXME: Call win32k for now */
Wnd = NULL;
break;
}
if (Ancestor != NULL)
Ret = UserHMGetHandle(Ancestor);
}
_SEH_HANDLE
{
/* Do nothing */
}
_SEH_END;
if (!Wnd) /* Fall back */
Ret = NtUserGetAncestor(hwnd, gaFlags);
return Ret;
}