Module: wine Branch: master Commit: a36fcc827acb1c2934dcf03ff76be99353325c93 URL: https://source.winehq.org/git/wine.git/?a=commit;h=a36fcc827acb1c2934dcf03ff...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Mar 8 14:24:20 2022 +0100
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
---
dlls/user32/win.c | 15 +-------------- dlls/win32u/window.c | 21 +++++++++++++++++++++ include/ntuser.h | 1 + 3 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 58c581c26da..a22b80da6a9 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -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 ); }
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 3c65d3ec1ce..e13107d1d64 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -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; diff --git a/include/ntuser.h b/include/ntuser.h index 8d724971d53..20fa61bacec 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -142,6 +142,7 @@ enum NtUserGetParent, NtUserGetWindowTextLength, NtUserIsWindow, + NtUserIsWindowVisible, };
/* NtUserCallHwndParam codes, not compatible with Windows */