Author: weiden Date: Sat Nov 17 10:01:14 2007 New Revision: 30520
URL: http://svn.reactos.org/svn/reactos?rev=30520&view=rev Log: Optimize IsWindowVisible() a bit more to use the desktop heap directly
Modified: trunk/reactos/dll/win32/user32/windows/window.c
Modified: trunk/reactos/dll/win32/user32/windows/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/wi... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/window.c (original) +++ trunk/reactos/dll/win32/user32/windows/window.c Sat Nov 17 10:01:14 2007 @@ -1342,17 +1342,38 @@ BOOL STDCALL IsWindowVisible(HWND hWnd) { - DWORD Style; - - while ((Style = GetWindowLongW(hWnd, GWL_STYLE)) & WS_CHILD) - { - if (!(Style & WS_VISIBLE)) - return FALSE; - - hWnd = GetAncestor(hWnd, GA_PARENT); - } - - return (GetWindowLongW(hWnd, GWL_STYLE) & WS_VISIBLE) != 0; + BOOL Ret = FALSE; + PWINDOW Wnd = ValidateHwnd(hWnd); + + if (Wnd != NULL) + { + _SEH_TRY + { + Ret = TRUE; + + 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 Ret; }