Commit 803a5f07 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserPerMonitorDPIPhysicalToLogicalPoint implementation from user32.

parent 352e24dc
...@@ -670,36 +670,6 @@ BOOL WINAPI EnumDisplaySettingsExW( const WCHAR *device, DWORD mode, ...@@ -670,36 +670,6 @@ BOOL WINAPI EnumDisplaySettingsExW( const WCHAR *device, DWORD mode,
} }
/********************************************************************** /**********************************************************************
* get_win_monitor_dpi
*/
static UINT get_win_monitor_dpi( HWND hwnd )
{
/* FIXME: use the monitor DPI instead */
return system_dpi;
}
/**********************************************************************
* map_dpi_point
*/
static POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to )
{
if (dpi_from && dpi_to && dpi_from != dpi_to)
{
pt.x = MulDiv( pt.x, dpi_to, dpi_from );
pt.y = MulDiv( pt.y, dpi_to, dpi_from );
}
return pt;
}
/**********************************************************************
* point_phys_to_win_dpi
*/
static POINT point_phys_to_win_dpi( HWND hwnd, POINT pt )
{
return map_dpi_point( pt, get_win_monitor_dpi( hwnd ), GetDpiForWindow( hwnd ));
}
/**********************************************************************
* SetProcessDpiAwarenessContext (USER32.@) * SetProcessDpiAwarenessContext (USER32.@)
*/ */
BOOL WINAPI SetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT context ) BOOL WINAPI SetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT context )
...@@ -871,26 +841,6 @@ DPI_AWARENESS_CONTEXT WINAPI SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT ...@@ -871,26 +841,6 @@ DPI_AWARENESS_CONTEXT WINAPI SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT
return ULongToHandle( prev ); return ULongToHandle( prev );
} }
/**********************************************************************
* PhysicalToLogicalPointForPerMonitorDPI (USER32.@)
*/
BOOL WINAPI PhysicalToLogicalPointForPerMonitorDPI( HWND hwnd, POINT *pt )
{
DPI_AWARENESS_CONTEXT context;
RECT rect;
BOOL ret = FALSE;
context = SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
if (GetWindowRect( hwnd, &rect ) &&
pt->x >= rect.left && pt->y >= rect.top && pt->x <= rect.right && pt->y <= rect.bottom)
{
*pt = point_phys_to_win_dpi( hwnd, *pt );
ret = TRUE;
}
SetThreadDpiAwarenessContext( context );
return ret;
}
/*********************************************************************** /***********************************************************************
* MonitorFromRect (USER32.@) * MonitorFromRect (USER32.@)
*/ */
......
...@@ -565,7 +565,7 @@ ...@@ -565,7 +565,7 @@
@ stdcall PeekMessageA(ptr long long long long) @ stdcall PeekMessageA(ptr long long long long)
@ stdcall PeekMessageW(ptr long long long long) @ stdcall PeekMessageW(ptr long long long long)
@ stdcall PhysicalToLogicalPoint(long ptr) @ stdcall PhysicalToLogicalPoint(long ptr)
@ stdcall PhysicalToLogicalPointForPerMonitorDPI(long ptr) @ stdcall PhysicalToLogicalPointForPerMonitorDPI(long ptr) NtUserPerMonitorDPIPhysicalToLogicalPoint
@ stub PlaySoundEvent @ stub PlaySoundEvent
@ stdcall PostMessageA(long long long long) @ stdcall PostMessageA(long long long long)
@ stdcall PostMessageW(long long long long) @ stdcall PostMessageW(long long long long)
......
...@@ -230,6 +230,7 @@ static void * const syscalls[] = ...@@ -230,6 +230,7 @@ static void * const syscalls[] =
NtUserOpenInputDesktop, NtUserOpenInputDesktop,
NtUserOpenWindowStation, NtUserOpenWindowStation,
NtUserPeekMessage, NtUserPeekMessage,
NtUserPerMonitorDPIPhysicalToLogicalPoint,
NtUserPostMessage, NtUserPostMessage,
NtUserPostThreadMessage, NtUserPostThreadMessage,
NtUserQueryInputContext, NtUserQueryInputContext,
......
...@@ -2461,6 +2461,23 @@ BOOL WINAPI NtUserLogicalToPerMonitorDPIPhysicalPoint( HWND hwnd, POINT *pt ) ...@@ -2461,6 +2461,23 @@ BOOL WINAPI NtUserLogicalToPerMonitorDPIPhysicalPoint( HWND hwnd, POINT *pt )
return TRUE; return TRUE;
} }
/**********************************************************************
* NtUserPerMonitorDPIPhysicalToLogicalPoint (win32u.@)
*/
BOOL WINAPI NtUserPerMonitorDPIPhysicalToLogicalPoint( HWND hwnd, POINT *pt )
{
RECT rect;
BOOL ret = FALSE;
if (get_window_rect( hwnd, &rect, 0 ) &&
pt->x >= rect.left && pt->y >= rect.top && pt->x <= rect.right && pt->y <= rect.bottom)
{
*pt = point_phys_to_win_dpi( hwnd, *pt );
ret = TRUE;
}
return ret;
}
/* retrieve the cached base keys for a given entry */ /* retrieve the cached base keys for a given entry */
static BOOL get_base_keys( enum parameter_key index, HKEY *base_key, HKEY *volatile_key ) static BOOL get_base_keys( enum parameter_key index, HKEY *base_key, HKEY *volatile_key )
{ {
......
...@@ -1099,7 +1099,7 @@ ...@@ -1099,7 +1099,7 @@
@ stub NtUserPaintMenuBar @ stub NtUserPaintMenuBar
@ stub NtUserPaintMonitor @ stub NtUserPaintMonitor
@ stdcall -syscall NtUserPeekMessage(ptr long long long long) @ stdcall -syscall NtUserPeekMessage(ptr long long long long)
@ stub NtUserPerMonitorDPIPhysicalToLogicalPoint @ stdcall -syscall NtUserPerMonitorDPIPhysicalToLogicalPoint(long ptr)
@ stub NtUserPhysicalToLogicalDpiPointForWindow @ stub NtUserPhysicalToLogicalDpiPointForWindow
@ stub NtUserPhysicalToLogicalPoint @ stub NtUserPhysicalToLogicalPoint
@ stub NtUserPostKeyboardInputMessage @ stub NtUserPostKeyboardInputMessage
......
...@@ -216,6 +216,7 @@ ...@@ -216,6 +216,7 @@
SYSCALL_ENTRY( NtUserOpenInputDesktop ) \ SYSCALL_ENTRY( NtUserOpenInputDesktop ) \
SYSCALL_ENTRY( NtUserOpenWindowStation ) \ SYSCALL_ENTRY( NtUserOpenWindowStation ) \
SYSCALL_ENTRY( NtUserPeekMessage ) \ SYSCALL_ENTRY( NtUserPeekMessage ) \
SYSCALL_ENTRY( NtUserPerMonitorDPIPhysicalToLogicalPoint ) \
SYSCALL_ENTRY( NtUserPostMessage ) \ SYSCALL_ENTRY( NtUserPostMessage ) \
SYSCALL_ENTRY( NtUserPostThreadMessage ) \ SYSCALL_ENTRY( NtUserPostThreadMessage ) \
SYSCALL_ENTRY( NtUserQueryInputContext ) \ SYSCALL_ENTRY( NtUserQueryInputContext ) \
......
...@@ -3100,6 +3100,14 @@ NTSTATUS WINAPI wow64_NtUserPeekMessage( UINT *args ) ...@@ -3100,6 +3100,14 @@ NTSTATUS WINAPI wow64_NtUserPeekMessage( UINT *args )
return TRUE; return TRUE;
} }
NTSTATUS WINAPI wow64_NtUserPerMonitorDPIPhysicalToLogicalPoint( UINT *args )
{
HWND hwnd = get_handle( &args );
POINT *pt = get_ptr( &args );
return NtUserPerMonitorDPIPhysicalToLogicalPoint( hwnd, pt );
}
NTSTATUS WINAPI wow64_NtUserPostMessage( UINT *args ) NTSTATUS WINAPI wow64_NtUserPostMessage( UINT *args )
{ {
HWND hwnd = get_handle( &args ); HWND hwnd = get_handle( &args );
......
...@@ -788,6 +788,7 @@ BOOL WINAPI NtUserOpenClipboard( HWND hwnd, ULONG unk ); ...@@ -788,6 +788,7 @@ BOOL WINAPI NtUserOpenClipboard( HWND hwnd, ULONG unk );
HDESK WINAPI NtUserOpenDesktop( OBJECT_ATTRIBUTES *attr, DWORD flags, ACCESS_MASK access ); HDESK WINAPI NtUserOpenDesktop( OBJECT_ATTRIBUTES *attr, DWORD flags, ACCESS_MASK access );
HDESK WINAPI NtUserOpenInputDesktop( DWORD flags, BOOL inherit, ACCESS_MASK access ); HDESK WINAPI NtUserOpenInputDesktop( DWORD flags, BOOL inherit, ACCESS_MASK access );
BOOL WINAPI NtUserPeekMessage( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT flags ); BOOL WINAPI NtUserPeekMessage( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT flags );
BOOL WINAPI NtUserPerMonitorDPIPhysicalToLogicalPoint( HWND hwnd, POINT *pt );
BOOL WINAPI NtUserPostMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ); BOOL WINAPI NtUserPostMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam );
BOOL WINAPI NtUserPostThreadMessage( DWORD thread, UINT msg, WPARAM wparam, LPARAM lparam ); BOOL WINAPI NtUserPostThreadMessage( DWORD thread, UINT msg, WPARAM wparam, LPARAM lparam );
UINT_PTR WINAPI NtUserQueryInputContext( HIMC handle, UINT attr ); UINT_PTR WINAPI NtUserQueryInputContext( HIMC handle, UINT attr );
......
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