win32u: Move IsWindowVisible implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-03-08 14:24:20 +01:00 committed by Alexandre Julliard
parent be1f46bba4
commit a36fcc827a
3 changed files with 23 additions and 14 deletions

View file

@ -3016,20 +3016,7 @@ BOOL WINAPI IsChild( HWND parent, HWND child )
*/
BOOL WINAPI IsWindowVisible( HWND hwnd )
{
HWND *list;
BOOL retval = TRUE;
int i;
if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) return FALSE;
if (!(list = list_window_parents( hwnd ))) return TRUE;
if (list[0])
{
for (i = 0; list[i+1]; i++)
if (!(GetWindowLongW( list[i], GWL_STYLE ) & WS_VISIBLE)) break;
retval = !list[i+1] && (list[i] == GetDesktopWindow()); /* top message window isn't visible */
}
HeapFree( GetProcessHeap(), 0, list );
return retval;
return NtUserCallHwnd( hwnd, NtUserIsWindowVisible );
}

View file

@ -606,6 +606,25 @@ BOOL is_child( HWND parent, HWND child )
return ret;
}
/* see IsWindowVisible */
static BOOL is_window_visible( HWND hwnd )
{
HWND *list;
BOOL retval = TRUE;
int i;
if (!(get_window_long( hwnd, GWL_STYLE ) & WS_VISIBLE)) return FALSE;
if (!(list = list_window_parents( hwnd ))) return TRUE;
if (list[0])
{
for (i = 0; list[i+1]; i++)
if (!(get_window_long( list[i], GWL_STYLE ) & WS_VISIBLE)) break;
retval = !list[i+1] && (list[i] == user_callbacks->pGetDesktopWindow()); /* top message window isn't visible */
}
free( list );
return retval;
}
static LONG_PTR get_win_data( const void *ptr, UINT size )
{
if (size == sizeof(WORD))
@ -955,6 +974,8 @@ DWORD WINAPI NtUserCallHwnd( HWND hwnd, DWORD code )
return get_server_window_text( hwnd, NULL, 0 );
case NtUserIsWindow:
return is_window( hwnd );
case NtUserIsWindowVisible:
return is_window_visible( hwnd );
default:
FIXME( "invalid code %u\n", code );
return 0;

View file

@ -142,6 +142,7 @@ enum
NtUserGetParent,
NtUserGetWindowTextLength,
NtUserIsWindow,
NtUserIsWindowVisible,
};
/* NtUserCallHwndParam codes, not compatible with Windows */