mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 07:57:22 +00:00
win32u: Move NtUserPerMonitorDPIPhysicalToLogicalPoint implementation from user32.
This commit is contained in:
parent
352e24dcdf
commit
803a5f0789
|
@ -669,36 +669,6 @@ BOOL WINAPI EnumDisplaySettingsExW( const WCHAR *device, DWORD mode,
|
|||
return NtUserEnumDisplaySettings( &str, mode, dev_mode, flags );
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* 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.@)
|
||||
*/
|
||||
|
@ -871,26 +841,6 @@ DPI_AWARENESS_CONTEXT WINAPI SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT
|
|||
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.@)
|
||||
*/
|
||||
|
|
|
@ -565,7 +565,7 @@
|
|||
@ stdcall PeekMessageA(ptr long long long long)
|
||||
@ stdcall PeekMessageW(ptr long long long long)
|
||||
@ stdcall PhysicalToLogicalPoint(long ptr)
|
||||
@ stdcall PhysicalToLogicalPointForPerMonitorDPI(long ptr)
|
||||
@ stdcall PhysicalToLogicalPointForPerMonitorDPI(long ptr) NtUserPerMonitorDPIPhysicalToLogicalPoint
|
||||
@ stub PlaySoundEvent
|
||||
@ stdcall PostMessageA(long long long long)
|
||||
@ stdcall PostMessageW(long long long long)
|
||||
|
|
|
@ -230,6 +230,7 @@ static void * const syscalls[] =
|
|||
NtUserOpenInputDesktop,
|
||||
NtUserOpenWindowStation,
|
||||
NtUserPeekMessage,
|
||||
NtUserPerMonitorDPIPhysicalToLogicalPoint,
|
||||
NtUserPostMessage,
|
||||
NtUserPostThreadMessage,
|
||||
NtUserQueryInputContext,
|
||||
|
|
|
@ -2461,6 +2461,23 @@ BOOL WINAPI NtUserLogicalToPerMonitorDPIPhysicalPoint( HWND hwnd, POINT *pt )
|
|||
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 */
|
||||
static BOOL get_base_keys( enum parameter_key index, HKEY *base_key, HKEY *volatile_key )
|
||||
{
|
||||
|
|
|
@ -1099,7 +1099,7 @@
|
|||
@ stub NtUserPaintMenuBar
|
||||
@ stub NtUserPaintMonitor
|
||||
@ stdcall -syscall NtUserPeekMessage(ptr long long long long)
|
||||
@ stub NtUserPerMonitorDPIPhysicalToLogicalPoint
|
||||
@ stdcall -syscall NtUserPerMonitorDPIPhysicalToLogicalPoint(long ptr)
|
||||
@ stub NtUserPhysicalToLogicalDpiPointForWindow
|
||||
@ stub NtUserPhysicalToLogicalPoint
|
||||
@ stub NtUserPostKeyboardInputMessage
|
||||
|
|
|
@ -216,6 +216,7 @@
|
|||
SYSCALL_ENTRY( NtUserOpenInputDesktop ) \
|
||||
SYSCALL_ENTRY( NtUserOpenWindowStation ) \
|
||||
SYSCALL_ENTRY( NtUserPeekMessage ) \
|
||||
SYSCALL_ENTRY( NtUserPerMonitorDPIPhysicalToLogicalPoint ) \
|
||||
SYSCALL_ENTRY( NtUserPostMessage ) \
|
||||
SYSCALL_ENTRY( NtUserPostThreadMessage ) \
|
||||
SYSCALL_ENTRY( NtUserQueryInputContext ) \
|
||||
|
|
|
@ -3100,6 +3100,14 @@ NTSTATUS WINAPI wow64_NtUserPeekMessage( UINT *args )
|
|||
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 )
|
||||
{
|
||||
HWND hwnd = get_handle( &args );
|
||||
|
|
|
@ -788,6 +788,7 @@ BOOL WINAPI NtUserOpenClipboard( HWND hwnd, ULONG unk );
|
|||
HDESK WINAPI NtUserOpenDesktop( OBJECT_ATTRIBUTES *attr, DWORD flags, 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 NtUserPerMonitorDPIPhysicalToLogicalPoint( HWND hwnd, POINT *pt );
|
||||
BOOL WINAPI NtUserPostMessage( HWND hwnd, 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 );
|
||||
|
|
Loading…
Reference in a new issue