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

This commit is contained in:
Alexandre Julliard 2008-06-25 15:49:44 +02:00
parent 612c010431
commit 6536868d07
3 changed files with 14 additions and 5 deletions

View File

@ -4755,6 +4755,15 @@ static void test_hwnd_message(void)
ok( found == hwnd, "didn't find message window %p/%p\n", found, hwnd ); 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); DestroyWindow(hwnd);
} }

View File

@ -2758,11 +2758,11 @@ BOOL WINAPI IsWindowVisible( HWND hwnd )
if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) return FALSE; if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) return FALSE;
if (!(list = list_window_parents( hwnd ))) return TRUE; 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++) for (i = 0; list[i+1]; i++)
if (!(GetWindowLongW( list[i], GWL_STYLE ) & WS_VISIBLE)) break; 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 ); HeapFree( GetProcessHeap(), 0, list );
return retval; 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 ((style & WS_MINIMIZE) && icon && GetClassLongPtrW( hwnd, GCLP_HICON )) return FALSE;
if (!(list = list_window_parents( hwnd ))) return TRUE; 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++) for (i = 0; list[i+1]; i++)
if ((GetWindowLongW( list[i], GWL_STYLE ) & (WS_VISIBLE|WS_MINIMIZE)) != WS_VISIBLE) if ((GetWindowLongW( list[i], GWL_STYLE ) & (WS_VISIBLE|WS_MINIMIZE)) != WS_VISIBLE)
break; break;
retval = !list[i+1]; retval = !list[i+1] && (list[i] == GetDesktopWindow()); /* top message window isn't visible */
} }
HeapFree( GetProcessHeap(), 0, list ); HeapFree( GetProcessHeap(), 0, list );
return retval; return retval;

View File

@ -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 */ /* check if window and all its ancestors are visible */
static int is_visible( const struct window *win ) static int is_visible( const struct window *win )
{ {
while (win && win->parent) while (win)
{ {
if (!(win->style & WS_VISIBLE)) return 0; if (!(win->style & WS_VISIBLE)) return 0;
win = win->parent; win = win->parent;