user32: Implement Get/SetProcessDpiAwarenessInternal().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4a6a7655e1
commit
9fa96f5433
|
@ -1,3 +1,3 @@
|
|||
@ stub GetDpiForMonitorInternal
|
||||
@ stub GetProcessDpiAwarenessInternal
|
||||
@ stub SetProcessDpiAwarenessInternal
|
||||
@ stdcall GetProcessDpiAwarenessInternal(long ptr) user32.GetProcessDpiAwarenessInternal
|
||||
@ stdcall SetProcessDpiAwarenessInternal(long) user32.SetProcessDpiAwarenessInternal
|
||||
|
|
|
@ -2963,6 +2963,37 @@ BOOL WINAPI SetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT context )
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* GetProcessDpiAwarenessInternal (USER32.@)
|
||||
*/
|
||||
BOOL WINAPI GetProcessDpiAwarenessInternal( HANDLE process, DPI_AWARENESS *awareness )
|
||||
{
|
||||
if (process && process != GetCurrentProcess())
|
||||
{
|
||||
WARN( "not supported on other process %p\n", process );
|
||||
*awareness = DPI_AWARENESS_UNAWARE;
|
||||
}
|
||||
else *awareness = GetAwarenessFromDpiAwarenessContext( dpi_awareness );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* SetProcessDpiAwarenessInternal (USER32.@)
|
||||
*/
|
||||
BOOL WINAPI SetProcessDpiAwarenessInternal( DPI_AWARENESS awareness )
|
||||
{
|
||||
static const DPI_AWARENESS_CONTEXT contexts[3] = { DPI_AWARENESS_CONTEXT_UNAWARE,
|
||||
DPI_AWARENESS_CONTEXT_SYSTEM_AWARE,
|
||||
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE };
|
||||
|
||||
if (awareness < DPI_AWARENESS_UNAWARE || awareness > DPI_AWARENESS_PER_MONITOR_AWARE)
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
return SetProcessDpiAwarenessContext( contexts[awareness] );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AreDpiAwarenessContextsEqual (USER32.@)
|
||||
*/
|
||||
|
|
|
@ -42,6 +42,8 @@ static LONG (WINAPI *pChangeDisplaySettingsExA)(LPCSTR, LPDEVMODEA, HWND, DWORD,
|
|||
static BOOL (WINAPI *pIsProcessDPIAware)(void);
|
||||
static BOOL (WINAPI *pSetProcessDPIAware)(void);
|
||||
static BOOL (WINAPI *pSetProcessDpiAwarenessContext)(DPI_AWARENESS_CONTEXT);
|
||||
static BOOL (WINAPI *pGetProcessDpiAwarenessInternal)(HANDLE,DPI_AWARENESS*);
|
||||
static BOOL (WINAPI *pSetProcessDpiAwarenessInternal)(DPI_AWARENESS);
|
||||
static DPI_AWARENESS_CONTEXT (WINAPI *pGetThreadDpiAwarenessContext)(void);
|
||||
static DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT);
|
||||
static DPI_AWARENESS_CONTEXT (WINAPI *pGetWindowDpiAwarenessContext)(HWND);
|
||||
|
@ -3027,6 +3029,23 @@ static void test_dpi_aware(void)
|
|||
ret = pSetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_UNAWARE );
|
||||
ok( !ret, "got %d\n", ret );
|
||||
ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError() );
|
||||
|
||||
ret = pSetProcessDpiAwarenessInternal( DPI_AWARENESS_INVALID );
|
||||
ok( !ret, "got %d\n", ret );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
|
||||
ret = pSetProcessDpiAwarenessInternal( DPI_AWARENESS_UNAWARE );
|
||||
ok( !ret, "got %d\n", ret );
|
||||
ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError() );
|
||||
ret = pGetProcessDpiAwarenessInternal( 0, &awareness );
|
||||
ok( ret, "got %d\n", ret );
|
||||
ok( awareness == DPI_AWARENESS_SYSTEM_AWARE, "wrong value %d\n", awareness );
|
||||
ret = pGetProcessDpiAwarenessInternal( GetCurrentProcess(), &awareness );
|
||||
ok( ret, "got %d\n", ret );
|
||||
ok( awareness == DPI_AWARENESS_SYSTEM_AWARE, "wrong value %d\n", awareness );
|
||||
ret = pGetProcessDpiAwarenessInternal( (HANDLE)0xdeadbeef, &awareness );
|
||||
ok( ret, "got %d\n", ret );
|
||||
ok( awareness == DPI_AWARENESS_UNAWARE, "wrong value %d\n", awareness );
|
||||
|
||||
ret = pIsProcessDPIAware();
|
||||
ok(ret, "got %d\n", ret);
|
||||
context = pGetThreadDpiAwarenessContext();
|
||||
|
@ -3140,6 +3159,8 @@ START_TEST(sysparams)
|
|||
pIsProcessDPIAware = (void*)GetProcAddress(hdll, "IsProcessDPIAware");
|
||||
pSetProcessDPIAware = (void*)GetProcAddress(hdll, "SetProcessDPIAware");
|
||||
pSetProcessDpiAwarenessContext = (void*)GetProcAddress(hdll, "SetProcessDpiAwarenessContext");
|
||||
pGetProcessDpiAwarenessInternal = (void*)GetProcAddress(hdll, "GetProcessDpiAwarenessInternal");
|
||||
pSetProcessDpiAwarenessInternal = (void*)GetProcAddress(hdll, "SetProcessDpiAwarenessInternal");
|
||||
pGetThreadDpiAwarenessContext = (void*)GetProcAddress(hdll, "GetThreadDpiAwarenessContext");
|
||||
pSetThreadDpiAwarenessContext = (void*)GetProcAddress(hdll, "SetThreadDpiAwarenessContext");
|
||||
pGetWindowDpiAwarenessContext = (void*)GetProcAddress(hdll, "GetWindowDpiAwarenessContext");
|
||||
|
|
|
@ -353,6 +353,7 @@
|
|||
@ stdcall GetPhysicalCursorPos(ptr)
|
||||
@ stdcall GetPriorityClipboardFormat(ptr long)
|
||||
@ stdcall GetProcessDefaultLayout(ptr)
|
||||
@ stdcall GetProcessDpiAwarenessInternal(long ptr)
|
||||
@ stdcall GetProcessWindowStation()
|
||||
@ stdcall GetProgmanWindow ()
|
||||
@ stdcall GetPropA(long str)
|
||||
|
@ -676,6 +677,7 @@
|
|||
@ stdcall SetProcessDPIAware()
|
||||
@ stdcall SetProcessDefaultLayout(long)
|
||||
@ stdcall SetProcessDpiAwarenessContext(long)
|
||||
@ stdcall SetProcessDpiAwarenessInternal(long)
|
||||
@ stdcall SetProcessWindowStation(long)
|
||||
@ stdcall SetProgmanWindow (long)
|
||||
@ stdcall SetPropA(long str long)
|
||||
|
|
|
@ -3747,6 +3747,7 @@ WINUSERAPI HWND WINAPI GetParent(HWND);
|
|||
WINUSERAPI BOOL WINAPI GetPhysicalCursorPos(POINT*);
|
||||
WINUSERAPI INT WINAPI GetPriorityClipboardFormat(UINT*,INT);
|
||||
WINUSERAPI BOOL WINAPI GetProcessDefaultLayout(DWORD*);
|
||||
WINUSERAPI BOOL WINAPI GetProcessDpiAwarenessInternal(HANDLE,DPI_AWARENESS*);
|
||||
WINUSERAPI HANDLE WINAPI GetPropA(HWND,LPCSTR);
|
||||
WINUSERAPI HANDLE WINAPI GetPropW(HWND,LPCWSTR);
|
||||
#define GetProp WINELIB_NAME_AW(GetProp)
|
||||
|
@ -4067,6 +4068,7 @@ WINUSERAPI BOOL WINAPI SetPhysicalCursorPos(INT,INT);
|
|||
WINUSERAPI BOOL WINAPI SetProcessDPIAware(void);
|
||||
WINUSERAPI BOOL WINAPI SetProcessDefaultLayout(DWORD);
|
||||
WINUSERAPI BOOL WINAPI SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT);
|
||||
WINUSERAPI BOOL WINAPI SetProcessDpiAwarenessInternal(DPI_AWARENESS);
|
||||
WINUSERAPI BOOL WINAPI SetProcessWindowStation(HWINSTA);
|
||||
WINUSERAPI BOOL WINAPI SetPropA(HWND,LPCSTR,HANDLE);
|
||||
WINUSERAPI BOOL WINAPI SetPropW(HWND,LPCWSTR,HANDLE);
|
||||
|
|
Loading…
Reference in New Issue