From 53b892f4d2f692302ecdc2d35e672a0a2819732a Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Sat, 17 Nov 2007 07:01:14 +0000 Subject: [PATCH] Optimize IsWindowVisible() a bit more to use the desktop heap directly svn path=/trunk/; revision=30520 --- reactos/dll/win32/user32/windows/window.c | 33 ++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/reactos/dll/win32/user32/windows/window.c b/reactos/dll/win32/user32/windows/window.c index 559ece8439c..f26190c16e5 100644 --- a/reactos/dll/win32/user32/windows/window.c +++ b/reactos/dll/win32/user32/windows/window.c @@ -1342,17 +1342,38 @@ IsWindowUnicode(HWND hWnd) BOOL STDCALL IsWindowVisible(HWND hWnd) { - DWORD Style; + BOOL Ret = FALSE; + PWINDOW Wnd = ValidateHwnd(hWnd); - while ((Style = GetWindowLongW(hWnd, GWL_STYLE)) & WS_CHILD) + if (Wnd != NULL) { - if (!(Style & WS_VISIBLE)) - return FALSE; + _SEH_TRY + { + Ret = TRUE; - hWnd = GetAncestor(hWnd, GA_PARENT); + do + { + if (!(Wnd->Style & WS_VISIBLE)) + { + Ret = FALSE; + break; + } + + if (Wnd->Parent != NULL) + Wnd = DesktopPtrToUser(Wnd->Parent); + else + break; + + } while (Wnd != NULL); + } + _SEH_HANDLE + { + Ret = FALSE; + } + _SEH_END; } - return (GetWindowLongW(hWnd, GWL_STYLE) & WS_VISIBLE) != 0; + return Ret; }