[ros-diffs] [weiden] 30520: Optimize IsWindowVisible() a bit more to use the desktop heap directly

weiden at svn.reactos.org weiden at svn.reactos.org
Sat Nov 17 08:01:14 CET 2007


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/window.c?rev=30520&r1=30519&r2=30520&view=diff
==============================================================================
--- 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;
 }
 
 




More information about the Ros-diffs mailing list