user32: Implement SetProcessDpiAwarenessContext().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ff7961e152
commit
bd0cd09e69
|
@ -2942,6 +2942,28 @@ BOOL WINAPI EnumDisplaySettingsExW(LPCWSTR lpszDeviceName, DWORD iModeNum,
|
|||
return USER_Driver->pEnumDisplaySettingsEx(lpszDeviceName, iModeNum, lpDevMode, dwFlags);
|
||||
}
|
||||
|
||||
|
||||
static DPI_AWARENESS_CONTEXT dpi_awareness;
|
||||
|
||||
/**********************************************************************
|
||||
* SetProcessDpiAwarenessContext (USER32.@)
|
||||
*/
|
||||
BOOL WINAPI SetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT context )
|
||||
{
|
||||
if (!IsValidDpiAwarenessContext( context ))
|
||||
{
|
||||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
if (InterlockedCompareExchangePointer( (void **)&dpi_awareness, context, NULL ))
|
||||
{
|
||||
SetLastError( ERROR_ACCESS_DENIED );
|
||||
return FALSE;
|
||||
}
|
||||
TRACE( "set to %p\n", context );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AreDpiAwarenessContextsEqual (USER32.@)
|
||||
*/
|
||||
|
@ -2980,6 +3002,7 @@ BOOL WINAPI IsValidDpiAwarenessContext( DPI_AWARENESS_CONTEXT context )
|
|||
BOOL WINAPI SetProcessDPIAware(void)
|
||||
{
|
||||
TRACE("\n");
|
||||
InterlockedCompareExchangePointer( (void **)&dpi_awareness, DPI_AWARENESS_CONTEXT_SYSTEM_AWARE, NULL );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2988,8 +3011,8 @@ BOOL WINAPI SetProcessDPIAware(void)
|
|||
*/
|
||||
BOOL WINAPI IsProcessDPIAware(void)
|
||||
{
|
||||
TRACE("returning TRUE\n");
|
||||
return TRUE;
|
||||
/* FIXME: should default to FALSE when not set */
|
||||
return dpi_awareness != DPI_AWARENESS_CONTEXT_UNAWARE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
static LONG (WINAPI *pChangeDisplaySettingsExA)(LPCSTR, LPDEVMODEA, HWND, DWORD, LPVOID);
|
||||
static BOOL (WINAPI *pIsProcessDPIAware)(void);
|
||||
static BOOL (WINAPI *pSetProcessDPIAware)(void);
|
||||
static BOOL (WINAPI *pSetProcessDpiAwarenessContext)(DPI_AWARENESS_CONTEXT);
|
||||
|
||||
static BOOL strict;
|
||||
static int dpi, real_dpi;
|
||||
|
@ -2995,6 +2996,30 @@ static void test_dpi_aware(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pSetProcessDpiAwarenessContext)
|
||||
{
|
||||
SetLastError( 0xdeadbeef );
|
||||
ret = pSetProcessDpiAwarenessContext( NULL );
|
||||
ok( !ret, "got %d\n", ret );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ret = pSetProcessDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)-5 );
|
||||
ok( !ret, "got %d\n", ret );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
|
||||
ret = pSetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_SYSTEM_AWARE );
|
||||
ok( ret, "got %d\n", ret );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ret = pSetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_SYSTEM_AWARE );
|
||||
ok( !ret, "got %d\n", ret );
|
||||
ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError() );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ret = pSetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_UNAWARE );
|
||||
ok( !ret, "got %d\n", ret );
|
||||
ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError() );
|
||||
ret = pIsProcessDPIAware();
|
||||
ok(ret, "got %d\n", ret);
|
||||
}
|
||||
|
||||
ret = pSetProcessDPIAware();
|
||||
ok(ret, "got %d\n", ret);
|
||||
|
||||
|
@ -3019,6 +3044,7 @@ START_TEST(sysparams)
|
|||
pChangeDisplaySettingsExA = (void*)GetProcAddress(hdll, "ChangeDisplaySettingsExA");
|
||||
pIsProcessDPIAware = (void*)GetProcAddress(hdll, "IsProcessDPIAware");
|
||||
pSetProcessDPIAware = (void*)GetProcAddress(hdll, "SetProcessDPIAware");
|
||||
pSetProcessDpiAwarenessContext = (void*)GetProcAddress(hdll, "SetProcessDpiAwarenessContext");
|
||||
|
||||
hInstance = GetModuleHandleA( NULL );
|
||||
hdc = GetDC(0);
|
||||
|
|
|
@ -671,8 +671,9 @@
|
|||
@ stdcall SetMessageQueue(long)
|
||||
@ stdcall SetParent(long long)
|
||||
@ stdcall SetPhysicalCursorPos(long long)
|
||||
@ stdcall SetProcessDefaultLayout(long)
|
||||
@ stdcall SetProcessDPIAware()
|
||||
@ stdcall SetProcessDefaultLayout(long)
|
||||
@ stdcall SetProcessDpiAwarenessContext(long)
|
||||
@ stdcall SetProcessWindowStation(long)
|
||||
@ stdcall SetProgmanWindow (long)
|
||||
@ stdcall SetPropA(long str long)
|
||||
|
|
|
@ -4064,6 +4064,7 @@ WINUSERAPI HWND WINAPI SetParent(HWND,HWND);
|
|||
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 SetProcessWindowStation(HWINSTA);
|
||||
WINUSERAPI BOOL WINAPI SetPropA(HWND,LPCSTR,HANDLE);
|
||||
WINUSERAPI BOOL WINAPI SetPropW(HWND,LPCWSTR,HANDLE);
|
||||
|
|
Loading…
Reference in New Issue