win32u: Move NtUserGetDpiForMonitor 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:
parent
d08808d8f3
commit
b877c78ec5
|
@ -3328,30 +3328,6 @@ UINT WINAPI GetDpiForSystem(void)
|
||||||
return system_dpi;
|
return system_dpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* GetDpiForMonitorInternal (USER32.@)
|
|
||||||
*/
|
|
||||||
BOOL WINAPI GetDpiForMonitorInternal( HMONITOR monitor, UINT type, UINT *x, UINT *y )
|
|
||||||
{
|
|
||||||
if (type > 2)
|
|
||||||
{
|
|
||||||
SetLastError( ERROR_BAD_ARGUMENTS );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!x || !y)
|
|
||||||
{
|
|
||||||
SetLastError( ERROR_INVALID_ADDRESS );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
switch (GetAwarenessFromDpiAwarenessContext( GetThreadDpiAwarenessContext() ))
|
|
||||||
{
|
|
||||||
case DPI_AWARENESS_UNAWARE: *x = *y = USER_DEFAULT_SCREEN_DPI; break;
|
|
||||||
case DPI_AWARENESS_SYSTEM_AWARE: *x = *y = system_dpi; break;
|
|
||||||
default: *x = *y = get_monitor_dpi( monitor ); break;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* GetThreadDpiAwarenessContext (USER32.@)
|
* GetThreadDpiAwarenessContext (USER32.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -298,7 +298,7 @@
|
||||||
@ stdcall GetDlgItemTextA(long long ptr long)
|
@ stdcall GetDlgItemTextA(long long ptr long)
|
||||||
@ stdcall GetDlgItemTextW(long long ptr long)
|
@ stdcall GetDlgItemTextW(long long ptr long)
|
||||||
@ stdcall GetDoubleClickTime()
|
@ stdcall GetDoubleClickTime()
|
||||||
@ stdcall GetDpiForMonitorInternal(long long ptr ptr)
|
@ stdcall GetDpiForMonitorInternal(long long ptr ptr) NtUserGetDpiForMonitor
|
||||||
@ stdcall GetDpiForSystem()
|
@ stdcall GetDpiForSystem()
|
||||||
@ stdcall GetDpiForWindow(long)
|
@ stdcall GetDpiForWindow(long)
|
||||||
@ stdcall GetFocus()
|
@ stdcall GetFocus()
|
||||||
|
|
|
@ -112,6 +112,7 @@ static void * const syscalls[] =
|
||||||
NtUserGetClipboardSequenceNumber,
|
NtUserGetClipboardSequenceNumber,
|
||||||
NtUserGetClipboardViewer,
|
NtUserGetClipboardViewer,
|
||||||
NtUserGetCursor,
|
NtUserGetCursor,
|
||||||
|
NtUserGetDpiForMonitor,
|
||||||
NtUserGetKeyState,
|
NtUserGetKeyState,
|
||||||
NtUserGetKeyboardLayout,
|
NtUserGetKeyboardLayout,
|
||||||
NtUserGetKeyboardLayoutName,
|
NtUserGetKeyboardLayoutName,
|
||||||
|
|
|
@ -1345,6 +1345,43 @@ RECT get_virtual_screen_rect(void)
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* get_monitor_dpi
|
||||||
|
*/
|
||||||
|
static UINT get_monitor_dpi( HMONITOR monitor )
|
||||||
|
{
|
||||||
|
/* FIXME: use the monitor DPI instead */
|
||||||
|
return system_dpi;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* get_thread_dpi_awareness
|
||||||
|
*/
|
||||||
|
static DPI_AWARENESS get_thread_dpi_awareness(void)
|
||||||
|
{
|
||||||
|
struct user_thread_info *info = get_user_thread_info();
|
||||||
|
ULONG_PTR context = info->dpi_awareness;
|
||||||
|
|
||||||
|
if (!context) context = NtUserGetProcessDpiAwarenessContext( NULL );
|
||||||
|
|
||||||
|
switch (context)
|
||||||
|
{
|
||||||
|
case 0x10:
|
||||||
|
case 0x11:
|
||||||
|
case 0x12:
|
||||||
|
case 0x80000010:
|
||||||
|
case 0x80000011:
|
||||||
|
case 0x80000012:
|
||||||
|
return context & 3;
|
||||||
|
case (ULONG_PTR)DPI_AWARENESS_CONTEXT_UNAWARE:
|
||||||
|
case (ULONG_PTR)DPI_AWARENESS_CONTEXT_SYSTEM_AWARE:
|
||||||
|
case (ULONG_PTR)DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE:
|
||||||
|
return ~context;
|
||||||
|
default:
|
||||||
|
return DPI_AWARENESS_INVALID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* NtUserGetDisplayConfigBufferSizes (win32u.@)
|
* NtUserGetDisplayConfigBufferSizes (win32u.@)
|
||||||
*/
|
*/
|
||||||
|
@ -1764,6 +1801,30 @@ ULONG WINAPI NtUserGetSystemDpiForProcess( HANDLE process )
|
||||||
return system_dpi;
|
return system_dpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* NtUserGetDpiForMonitor (win32u.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI NtUserGetDpiForMonitor( HMONITOR monitor, UINT type, UINT *x, UINT *y )
|
||||||
|
{
|
||||||
|
if (type > 2)
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_BAD_ARGUMENTS );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (!x || !y)
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_INVALID_ADDRESS );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
switch (get_thread_dpi_awareness())
|
||||||
|
{
|
||||||
|
case DPI_AWARENESS_UNAWARE: *x = *y = USER_DEFAULT_SCREEN_DPI; break;
|
||||||
|
case DPI_AWARENESS_SYSTEM_AWARE: *x = *y = system_dpi; break;
|
||||||
|
default: *x = *y = get_monitor_dpi( monitor ); break;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* 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 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -924,7 +924,7 @@
|
||||||
@ stdcall NtUserGetDisplayConfigBufferSizes(long ptr ptr)
|
@ stdcall NtUserGetDisplayConfigBufferSizes(long ptr ptr)
|
||||||
@ stub NtUserGetDoubleClickTime
|
@ stub NtUserGetDoubleClickTime
|
||||||
@ stub NtUserGetDpiForCurrentProcess
|
@ stub NtUserGetDpiForCurrentProcess
|
||||||
@ stub NtUserGetDpiForMonitor
|
@ stdcall -syscall NtUserGetDpiForMonitor(long long ptr ptr)
|
||||||
@ stub NtUserGetExtendedPointerDeviceProperty
|
@ stub NtUserGetExtendedPointerDeviceProperty
|
||||||
@ stub NtUserGetForegroundWindow
|
@ stub NtUserGetForegroundWindow
|
||||||
@ stub NtUserGetGUIThreadInfo
|
@ stub NtUserGetGUIThreadInfo
|
||||||
|
|
|
@ -99,6 +99,7 @@
|
||||||
SYSCALL_ENTRY( NtUserGetClipboardSequenceNumber ) \
|
SYSCALL_ENTRY( NtUserGetClipboardSequenceNumber ) \
|
||||||
SYSCALL_ENTRY( NtUserGetClipboardViewer ) \
|
SYSCALL_ENTRY( NtUserGetClipboardViewer ) \
|
||||||
SYSCALL_ENTRY( NtUserGetCursor ) \
|
SYSCALL_ENTRY( NtUserGetCursor ) \
|
||||||
|
SYSCALL_ENTRY( NtUserGetDpiForMonitor ) \
|
||||||
SYSCALL_ENTRY( NtUserGetKeyState ) \
|
SYSCALL_ENTRY( NtUserGetKeyState ) \
|
||||||
SYSCALL_ENTRY( NtUserGetKeyboardLayout ) \
|
SYSCALL_ENTRY( NtUserGetKeyboardLayout ) \
|
||||||
SYSCALL_ENTRY( NtUserGetKeyboardLayoutName ) \
|
SYSCALL_ENTRY( NtUserGetKeyboardLayoutName ) \
|
||||||
|
|
|
@ -315,3 +315,13 @@ NTSTATUS WINAPI wow64_NtUserGetSystemDpiForProcess( UINT *args )
|
||||||
|
|
||||||
return NtUserGetSystemDpiForProcess( process );
|
return NtUserGetSystemDpiForProcess( process );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS WINAPI wow64_NtUserGetDpiForMonitor( UINT *args )
|
||||||
|
{
|
||||||
|
HMONITOR monitor = get_handle( &args );
|
||||||
|
UINT type = get_ulong( &args );
|
||||||
|
UINT *x = get_ptr( &args );
|
||||||
|
UINT *y = get_ptr( &args );
|
||||||
|
|
||||||
|
return NtUserGetDpiForMonitor( monitor, type, x, y );
|
||||||
|
}
|
||||||
|
|
|
@ -115,6 +115,7 @@ HWND WINAPI NtUserGetClipboardViewer(void);
|
||||||
HCURSOR WINAPI NtUserGetCursor(void);
|
HCURSOR WINAPI NtUserGetCursor(void);
|
||||||
LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_info,
|
LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_info,
|
||||||
UINT32 *num_mode_info );
|
UINT32 *num_mode_info );
|
||||||
|
BOOL WINAPI NtUserGetDpiForMonitor( HMONITOR monitor, UINT type, UINT *x, UINT *y );
|
||||||
INT WINAPI NtUserGetKeyNameText( LONG lparam, WCHAR *buffer, INT size );
|
INT WINAPI NtUserGetKeyNameText( LONG lparam, WCHAR *buffer, INT size );
|
||||||
SHORT WINAPI NtUserGetKeyState( INT vkey );
|
SHORT WINAPI NtUserGetKeyState( INT vkey );
|
||||||
HKL WINAPI NtUserGetKeyboardLayout( DWORD thread_id );
|
HKL WINAPI NtUserGetKeyboardLayout( DWORD thread_id );
|
||||||
|
|
Loading…
Reference in New Issue