Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
bd0cd09e
Commit
bd0cd09e
authored
Mar 30, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Implement SetProcessDpiAwarenessContext().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ff7961e1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
3 deletions
+54
-3
sysparams.c
dlls/user32/sysparams.c
+25
-2
sysparams.c
dlls/user32/tests/sysparams.c
+26
-0
user32.spec
dlls/user32/user32.spec
+2
-1
winuser.h
include/winuser.h
+1
-0
No files found.
dlls/user32/sysparams.c
View file @
bd0cd09e
...
...
@@ -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
TRU
E
;
/* FIXME: should default to FALSE when not set */
return
dpi_awareness
!=
DPI_AWARENESS_CONTEXT_UNAWAR
E
;
}
/***********************************************************************
...
...
dlls/user32/tests/sysparams.c
View file @
bd0cd09e
...
...
@@ -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
);
...
...
dlls/user32/user32.spec
View file @
bd0cd09e
...
...
@@ -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)
...
...
include/winuser.h
View file @
bd0cd09e
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment