win32u: Move GWLP_HWNDPARENT 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:07 +01:00 committed by Alexandre Julliard
parent 4ef69e2b59
commit 115f3f3a0a
2 changed files with 4 additions and 16 deletions

View File

@ -2555,21 +2555,11 @@ LONG_PTR WIN_SetWindowLong( HWND hwnd, INT offset, UINT size, LONG_PTR newval, B
} }
/* FIXME: move to win32u */
static ULONG_PTR get_hwnd_parent( HWND hwnd )
{
HWND parent = NtUserGetAncestor( hwnd, GA_PARENT );
if (parent == GetDesktopWindow()) parent = GetWindow( hwnd, GW_OWNER );
return (ULONG_PTR)parent;
}
/********************************************************************** /**********************************************************************
* GetWindowWord (USER32.@) * GetWindowWord (USER32.@)
*/ */
WORD WINAPI GetWindowWord( HWND hwnd, INT offset ) WORD WINAPI GetWindowWord( HWND hwnd, INT offset )
{ {
if (offset == GWLP_HWNDPARENT) return get_hwnd_parent( hwnd );
return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowWord ); return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowWord );
} }
@ -2590,7 +2580,6 @@ LONG WINAPI GetWindowLongA( HWND hwnd, INT offset )
return 0; return 0;
#endif #endif
default: default:
if (offset == GWLP_HWNDPARENT) return get_hwnd_parent( hwnd );
return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongA ); return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongA );
} }
} }
@ -2612,7 +2601,6 @@ LONG WINAPI GetWindowLongW( HWND hwnd, INT offset )
return 0; return 0;
#endif #endif
default: default:
if (offset == GWLP_HWNDPARENT) return get_hwnd_parent( hwnd );
return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongW ); return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongW );
} }
} }
@ -3805,7 +3793,6 @@ BOOL WINAPI SetProcessDefaultLayout( DWORD layout )
*/ */
LONG_PTR WINAPI GetWindowLongPtrW( HWND hwnd, INT offset ) LONG_PTR WINAPI GetWindowLongPtrW( HWND hwnd, INT offset )
{ {
if (offset == GWLP_HWNDPARENT) return get_hwnd_parent( hwnd );
return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongPtrW ); return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongPtrW );
} }
@ -3814,7 +3801,6 @@ LONG_PTR WINAPI GetWindowLongPtrW( HWND hwnd, INT offset )
*/ */
LONG_PTR WINAPI GetWindowLongPtrA( HWND hwnd, INT offset ) LONG_PTR WINAPI GetWindowLongPtrA( HWND hwnd, INT offset )
{ {
if (offset == GWLP_HWNDPARENT) return get_hwnd_parent( hwnd );
return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongPtrA ); return NtUserCallHwndParam( hwnd, offset, NtUserGetWindowLongPtrA );
} }

View File

@ -612,8 +612,10 @@ static LONG_PTR get_window_long_size( HWND hwnd, INT offset, UINT size, BOOL ans
if (offset == GWLP_HWNDPARENT) if (offset == GWLP_HWNDPARENT)
{ {
FIXME( "GWLP_HWNDPARENT not supported\n" ); HWND parent = NtUserGetAncestor( hwnd, GA_PARENT );
return 0; if (user_callbacks && parent == user_callbacks->pGetDesktopWindow())
parent = get_window_relative( hwnd, GW_OWNER );
return (ULONG_PTR)parent;
} }
if (!(win = get_win_ptr( hwnd ))) if (!(win = get_win_ptr( hwnd )))