Alexandre Julliard : user32: Make sure that IsWindowVisible returns FALSE for HWND_MESSAGE windows.

Alexandre Julliard julliard at winehq.org
Wed Jun 25 16:43:54 CDT 2008


Module: wine
Branch: master
Commit: 6536868d0771ab987b37d8a444ba8aaf71cd0389
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6536868d0771ab987b37d8a444ba8aaf71cd0389

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jun 25 15:49:44 2008 +0200

user32: Make sure that IsWindowVisible returns FALSE for HWND_MESSAGE windows.

---

 dlls/user32/tests/win.c |    9 +++++++++
 dlls/user32/win.c       |    8 ++++----
 server/window.c         |    2 +-
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 3a3a152..cac34f7 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -4755,6 +4755,15 @@ static void test_hwnd_message(void)
         ok( found == hwnd, "didn't find message window %p/%p\n", found, hwnd );
     }
 
+    /* test IsChild behavior */
+
+    if (parent) ok( !IsChild( parent, hwnd ), "HWND_MESSAGE is child of top window\n" );
+
+    /* test IsWindowVisible behavior */
+
+    ok( !IsWindowVisible( hwnd ), "HWND_MESSAGE window is visible\n" );
+    if (parent) ok( !IsWindowVisible( parent ), "HWND_MESSAGE parent is visible\n" );
+
     DestroyWindow(hwnd);
 }
 
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 9a21246..9a97a3a 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -2758,11 +2758,11 @@ BOOL WINAPI IsWindowVisible( HWND hwnd )
 
     if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) return FALSE;
     if (!(list = list_window_parents( hwnd ))) return TRUE;
-    if (list[0] && list[1])  /* desktop window is considered always visible so we don't check it */
+    if (list[0])
     {
         for (i = 0; list[i+1]; i++)
             if (!(GetWindowLongW( list[i], GWL_STYLE ) & WS_VISIBLE)) break;
-        retval = !list[i+1];
+        retval = !list[i+1] && (list[i] == GetDesktopWindow());  /* top message window isn't visible */
     }
     HeapFree( GetProcessHeap(), 0, list );
     return retval;
@@ -2787,12 +2787,12 @@ BOOL WIN_IsWindowDrawable( HWND hwnd, BOOL icon )
     if ((style & WS_MINIMIZE) && icon && GetClassLongPtrW( hwnd, GCLP_HICON ))  return FALSE;
 
     if (!(list = list_window_parents( hwnd ))) return TRUE;
-    if (list[0] && list[1])  /* desktop window is considered always visible so we don't check it */
+    if (list[0])
     {
         for (i = 0; list[i+1]; i++)
             if ((GetWindowLongW( list[i], GWL_STYLE ) & (WS_VISIBLE|WS_MINIMIZE)) != WS_VISIBLE)
                 break;
-        retval = !list[i+1];
+        retval = !list[i+1] && (list[i] == GetDesktopWindow());  /* top message window isn't visible */
     }
     HeapFree( GetProcessHeap(), 0, list );
     return retval;
diff --git a/server/window.c b/server/window.c
index ed8f042..303a6cf 100644
--- a/server/window.c
+++ b/server/window.c
@@ -604,7 +604,7 @@ static inline void inc_window_paint_count( struct window *win, int incr )
 /* check if window and all its ancestors are visible */
 static int is_visible( const struct window *win )
 {
-    while (win && win->parent)
+    while (win)
     {
         if (!(win->style & WS_VISIBLE)) return 0;
         win = win->parent;




More information about the wine-cvs mailing list