Commit 4104b19a authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserChildWindowFromPointEx implementation from user32.

parent 52ff3a30
......@@ -216,54 +216,26 @@ HWND WINAPI WindowFromPoint( POINT pt )
/*******************************************************************
* ChildWindowFromPoint (USER32.@)
*/
HWND WINAPI ChildWindowFromPoint( HWND hwndParent, POINT pt )
HWND WINAPI ChildWindowFromPoint( HWND parent, POINT pt )
{
return ChildWindowFromPointEx( hwndParent, pt, CWP_ALL );
return NtUserChildWindowFromPointEx( parent, pt.x, pt.y, CWP_ALL );
}
/*******************************************************************
* RealChildWindowFromPoint (USER32.@)
*/
HWND WINAPI RealChildWindowFromPoint( HWND hwndParent, POINT pt )
HWND WINAPI RealChildWindowFromPoint( HWND parent, POINT pt )
{
return ChildWindowFromPointEx( hwndParent, pt, CWP_SKIPTRANSPARENT | CWP_SKIPINVISIBLE );
return NtUserChildWindowFromPointEx( parent, pt.x, pt.y,
CWP_SKIPTRANSPARENT | CWP_SKIPINVISIBLE );
}
/*******************************************************************
* ChildWindowFromPointEx (USER32.@)
*/
HWND WINAPI ChildWindowFromPointEx( HWND hwndParent, POINT pt, UINT uFlags)
HWND WINAPI ChildWindowFromPointEx( HWND parent, POINT pt, UINT flags )
{
/* pt is in the client coordinates */
HWND *list;
int i;
RECT rect;
HWND retvalue;
GetClientRect( hwndParent, &rect );
if (!PtInRect( &rect, pt )) return 0;
if (!(list = WIN_ListChildren( hwndParent ))) return hwndParent;
for (i = 0; list[i]; i++)
{
if (!WIN_GetRectangles( list[i], COORDS_PARENT, &rect, NULL )) continue;
if (!PtInRect( &rect, pt )) continue;
if (uFlags & (CWP_SKIPINVISIBLE|CWP_SKIPDISABLED))
{
LONG style = GetWindowLongW( list[i], GWL_STYLE );
if ((uFlags & CWP_SKIPINVISIBLE) && !(style & WS_VISIBLE)) continue;
if ((uFlags & CWP_SKIPDISABLED) && (style & WS_DISABLED)) continue;
}
if (uFlags & CWP_SKIPTRANSPARENT)
{
if (GetWindowLongW( list[i], GWL_EXSTYLE ) & WS_EX_TRANSPARENT) continue;
}
break;
}
retvalue = list[i];
HeapFree( GetProcessHeap(), 0, list );
if (!retvalue) retvalue = hwndParent;
return retvalue;
return NtUserChildWindowFromPointEx( parent, pt.x, pt.y, flags );
}
......
......@@ -106,6 +106,7 @@ static void * const syscalls[] =
NtUserAddClipboardFormatListener,
NtUserAttachThreadInput,
NtUserBuildHwndList,
NtUserChildWindowFromPointEx,
NtUserCloseDesktop,
NtUserCloseWindowStation,
NtUserCopyAcceleratorTable,
......
......@@ -790,7 +790,7 @@
@ stub NtUserCheckProcessForClipboardAccess
@ stub NtUserCheckProcessSession
@ stub NtUserCheckWindowThreadDesktop
@ stub NtUserChildWindowFromPointEx
@ stdcall -syscall NtUserChildWindowFromPointEx(long long long long)
@ stub NtUserClearForeground
@ stdcall NtUserClipCursor(ptr)
@ stdcall NtUserCloseClipboard()
......
......@@ -2256,6 +2256,43 @@ HWND WINAPI NtUserWindowFromPoint( LONG x, LONG y )
}
/*******************************************************************
* NtUserChildWindowFromPointEx (win32u.@)
*/
HWND WINAPI NtUserChildWindowFromPointEx( HWND parent, LONG x, LONG y, UINT flags )
{
POINT pt = { .x = x, .y = y }; /* in the client coordinates */
HWND *list;
int i;
RECT rect;
HWND ret;
get_client_rect( parent, &rect );
if (!PtInRect( &rect, pt )) return 0;
if (!(list = list_window_children( 0, parent, NULL, 0 ))) return parent;
for (i = 0; list[i]; i++)
{
if (!get_window_rects( list[i], COORDS_PARENT, &rect, NULL, get_thread_dpi() )) continue;
if (!PtInRect( &rect, pt )) continue;
if (flags & (CWP_SKIPINVISIBLE|CWP_SKIPDISABLED))
{
LONG style = get_window_long( list[i], GWL_STYLE );
if ((flags & CWP_SKIPINVISIBLE) && !(style & WS_VISIBLE)) continue;
if ((flags & CWP_SKIPDISABLED) && (style & WS_DISABLED)) continue;
}
if (flags & CWP_SKIPTRANSPARENT)
{
if (get_window_long( list[i], GWL_EXSTYLE ) & WS_EX_TRANSPARENT) continue;
}
break;
}
ret = list[i];
free( list );
if (!ret) ret = parent;
return ret;
}
/*******************************************************************
* get_work_rect
*
* Get the work area that a maximized window can cover, depending on style.
......
......@@ -93,6 +93,7 @@
SYSCALL_ENTRY( NtUserAddClipboardFormatListener ) \
SYSCALL_ENTRY( NtUserAttachThreadInput ) \
SYSCALL_ENTRY( NtUserBuildHwndList ) \
SYSCALL_ENTRY( NtUserChildWindowFromPointEx ) \
SYSCALL_ENTRY( NtUserCloseDesktop ) \
SYSCALL_ENTRY( NtUserCloseWindowStation ) \
SYSCALL_ENTRY( NtUserCopyAcceleratorTable ) \
......
......@@ -416,6 +416,16 @@ NTSTATUS WINAPI wow64_NtUserGetMouseMovePointsEx( UINT *args )
return NtUserGetMouseMovePointsEx( size, ptin, ptout, count, resolution );
}
NTSTATUS WINAPI wow64_NtUserChildWindowFromPointEx( UINT *args )
{
HWND parent = get_handle( &args );
LONG x = get_ulong( &args );
LONG y = get_ulong( &args );
UINT flags = get_ulong( &args );
return HandleToUlong( NtUserChildWindowFromPointEx( parent, x, y, flags ));
}
NTSTATUS WINAPI wow64_NtUserSetProcessDpiAwarenessContext( UINT *args )
{
ULONG awareness = get_ulong( &args );
......
......@@ -403,6 +403,7 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code );
ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code );
LONG WINAPI NtUserChangeDisplaySettings( UNICODE_STRING *devname, DEVMODEW *devmode, HWND hwnd,
DWORD flags, void *lparam );
HWND WINAPI NtUserChildWindowFromPointEx( HWND parent, LONG x, LONG y, UINT flags );
BOOL WINAPI NtUserClipCursor( const RECT *rect );
BOOL WINAPI NtUserCloseClipboard(void);
BOOL WINAPI NtUserCloseDesktop( HDESK handle );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment