Module: wine Branch: master Commit: be1f46bba453162dfff28cd1cb51183044210909 URL: https://source.winehq.org/git/wine.git/?a=commit;h=be1f46bba453162dfff28cd1c...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Mar 8 14:24:15 2022 +0100
win32u: Move IsChild 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/user_main.c | 1 - dlls/user32/win.c | 19 +------------------ dlls/win32u/ntuser_private.h | 2 +- dlls/win32u/palette.c | 2 +- dlls/win32u/window.c | 25 +++++++++++++++++++++++++ include/ntuser.h | 1 + 6 files changed, 29 insertions(+), 21 deletions(-)
diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 3afda0d528d..f9fce07ddab 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -138,7 +138,6 @@ static const struct user_callbacks user_funcs = CopyImage, GetDesktopWindow, GetWindowRect, - IsChild, RedrawWindow, SendMessageTimeoutW, WindowFromDC, diff --git a/dlls/user32/win.c b/dlls/user32/win.c index fe8d929a102..58c581c26da 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -3007,24 +3007,7 @@ HWND WINAPI SetParent( HWND hwnd, HWND parent ) */ BOOL WINAPI IsChild( HWND parent, HWND child ) { - HWND *list; - int i; - BOOL ret = FALSE; - - if (!(GetWindowLongW( child, GWL_STYLE ) & WS_CHILD)) return FALSE; - if (!(list = list_window_parents( child ))) return FALSE; - parent = WIN_GetFullHandle( parent ); - for (i = 0; list[i]; i++) - { - if (list[i] == parent) - { - ret = list[i] && list[i+1]; - break; - } - if (!(GetWindowLongW( list[i], GWL_STYLE ) & WS_CHILD)) break; - } - HeapFree( GetProcessHeap(), 0, list ); - return ret; + return NtUserCallHwndParam( parent, HandleToUlong(child), NtUserIsChild ); }
diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 5f3cf41c1a2..4c05d070a0a 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -32,7 +32,6 @@ struct user_callbacks HANDLE (WINAPI *pCopyImage)( HANDLE, UINT, INT, INT, UINT ); HWND (WINAPI *pGetDesktopWindow)(void); BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect ); - BOOL (WINAPI *pIsChild)( HWND, HWND ); BOOL (WINAPI *pRedrawWindow)( HWND, const RECT*, HRGN, UINT ); LRESULT (WINAPI *pSendMessageTimeoutW)( HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR ); HWND (WINAPI *pWindowFromDC)( HDC ); @@ -232,6 +231,7 @@ void *get_user_handle_ptr( HANDLE handle, unsigned int type ) DECLSPEC_HIDDEN; void release_user_handle_ptr( void *ptr ) DECLSPEC_HIDDEN;
WND *get_win_ptr( HWND hwnd ) DECLSPEC_HIDDEN; +BOOL is_child( HWND parent, HWND child ); BOOL is_window( HWND hwnd ) DECLSPEC_HIDDEN;
#endif /* __WINE_NTUSER_PRIVATE_H */ diff --git a/dlls/win32u/palette.c b/dlls/win32u/palette.c index d09fc9d4d73..367bfea21b4 100644 --- a/dlls/win32u/palette.c +++ b/dlls/win32u/palette.c @@ -521,7 +521,7 @@ HPALETTE WINAPI NtUserSelectPalette( HDC hdc, HPALETTE hpal, WORD bkg ) { /* set primary palette if it's related to current active */ HWND foreground = NtUserGetForegroundWindow(); - is_primary = foreground == hwnd || user_callbacks->pIsChild( foreground, hwnd ); + is_primary = foreground == hwnd || is_child( foreground, hwnd ); } }
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index f7f0d4e6a65..3c65d3ec1ce 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -583,6 +583,29 @@ HWND WINAPI NtUserGetAncestor( HWND hwnd, UINT type ) return ret; }
+/* see IsChild */ +BOOL is_child( HWND parent, HWND child ) +{ + HWND *list; + int i; + BOOL ret = FALSE; + + if (!(get_window_long( child, GWL_STYLE ) & WS_CHILD)) return FALSE; + if (!(list = list_window_parents( child ))) return FALSE; + parent = get_full_window_handle( parent ); + for (i = 0; list[i]; i++) + { + if (list[i] == parent) + { + ret = list[i] && list[i+1]; + break; + } + if (!(get_window_long( list[i], GWL_STYLE ) & WS_CHILD)) break; + } + free( list ); + return ret; +} + static LONG_PTR get_win_data( const void *ptr, UINT size ) { if (size == sizeof(WORD)) @@ -969,6 +992,8 @@ ULONG_PTR WINAPI NtUserCallHwndParam( HWND hwnd, DWORD_PTR param, DWORD code ) return get_window_thread( hwnd, (DWORD *)param ); case NtUserGetWindowWord: return get_window_word( hwnd, param ); + case NtUserIsChild: + return is_child( hwnd, UlongToHandle(param) ); default: FIXME( "invalid code %u\n", code ); return 0; diff --git a/include/ntuser.h b/include/ntuser.h index d62a4ed4459..8d724971d53 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -159,6 +159,7 @@ enum NtUserGetWindowRelative, NtUserGetWindowThread, NtUserGetWindowWord, + NtUserIsChild, };
/* color index used to retrieve system 55aa brush */