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
478814ed
Commit
478814ed
authored
Apr 02, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Implement Get/SetThreadDpiAwarenessContext().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c440af11
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
2 deletions
+64
-2
sysparams.c
dlls/user32/sysparams.c
+21
-2
sysparams.c
dlls/user32/tests/sysparams.c
+40
-0
user32.spec
dlls/user32/user32.spec
+1
-0
user_private.h
dlls/user32/user_private.h
+1
-0
winuser.h
include/winuser.h
+1
-0
No files found.
dlls/user32/sysparams.c
View file @
478814ed
...
...
@@ -3042,12 +3042,31 @@ UINT WINAPI GetDpiForWindow( HWND hwnd )
}
/**********************************************************************
* GetThreadDpiAwarenessContext (USER32.@)
*/
DPI_AWARENESS_CONTEXT
WINAPI
GetThreadDpiAwarenessContext
(
void
)
{
struct
user_thread_info
*
info
=
get_user_thread_info
();
if
(
info
->
dpi_awareness
)
return
info
->
dpi_awareness
;
if
(
dpi_awareness
)
return
dpi_awareness
;
return
DPI_AWARENESS_CONTEXT_SYSTEM_AWARE
;
/* FIXME: should default to unaware */
}
/**********************************************************************
* SetThreadDpiAwarenessContext (USER32.@)
*/
DPI_AWARENESS_CONTEXT
WINAPI
SetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT
context
)
{
FIXME
(
"(%p): stub
\n
"
,
context
);
return
NULL
;
DPI_AWARENESS_CONTEXT
prev
=
GetThreadDpiAwarenessContext
();
if
(
!
IsValidDpiAwarenessContext
(
context
))
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
get_user_thread_info
()
->
dpi_awareness
=
context
;
return
prev
;
}
/**********************************************************************
...
...
dlls/user32/tests/sysparams.c
View file @
478814ed
...
...
@@ -42,6 +42,9 @@ 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
DPI_AWARENESS_CONTEXT
(
WINAPI
*
pGetThreadDpiAwarenessContext
)(
void
);
static
DPI_AWARENESS_CONTEXT
(
WINAPI
*
pSetThreadDpiAwarenessContext
)(
DPI_AWARENESS_CONTEXT
);
static
DPI_AWARENESS
(
WINAPI
*
pGetAwarenessFromDpiAwarenessContext
)(
DPI_AWARENESS_CONTEXT
);
static
BOOL
strict
;
static
int
dpi
,
real_dpi
;
...
...
@@ -2998,6 +3001,13 @@ static void test_dpi_aware(void)
if
(
pSetProcessDpiAwarenessContext
)
{
DPI_AWARENESS
awareness
;
DPI_AWARENESS_CONTEXT
context
;
context
=
pGetThreadDpiAwarenessContext
();
awareness
=
pGetAwarenessFromDpiAwarenessContext
(
context
);
todo_wine
ok
(
awareness
==
DPI_AWARENESS_UNAWARE
,
"wrong awareness %u
\n
"
,
awareness
);
SetLastError
(
0xdeadbeef
);
ret
=
pSetProcessDpiAwarenessContext
(
NULL
);
ok
(
!
ret
,
"got %d
\n
"
,
ret
);
...
...
@@ -3018,7 +3028,34 @@ static void test_dpi_aware(void)
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"wrong error %u
\n
"
,
GetLastError
()
);
ret
=
pIsProcessDPIAware
();
ok
(
ret
,
"got %d
\n
"
,
ret
);
context
=
pGetThreadDpiAwarenessContext
();
awareness
=
pGetAwarenessFromDpiAwarenessContext
(
context
);
ok
(
awareness
==
DPI_AWARENESS_SYSTEM_AWARE
,
"wrong awareness %u
\n
"
,
awareness
);
SetLastError
(
0xdeadbeef
);
context
=
pSetThreadDpiAwarenessContext
(
0
);
ok
(
!
context
,
"got %p
\n
"
,
context
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
context
=
pSetThreadDpiAwarenessContext
(
(
DPI_AWARENESS_CONTEXT
)
-
5
);
ok
(
!
context
,
"got %p
\n
"
,
context
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
context
=
pSetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT_UNAWARE
);
awareness
=
pGetAwarenessFromDpiAwarenessContext
(
context
);
ok
(
awareness
==
DPI_AWARENESS_SYSTEM_AWARE
,
"wrong awareness %u
\n
"
,
awareness
);
context
=
pGetThreadDpiAwarenessContext
();
awareness
=
pGetAwarenessFromDpiAwarenessContext
(
context
);
ok
(
awareness
==
DPI_AWARENESS_UNAWARE
,
"wrong awareness %u
\n
"
,
awareness
);
context
=
pSetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE
);
awareness
=
pGetAwarenessFromDpiAwarenessContext
(
context
);
ok
(
awareness
==
DPI_AWARENESS_UNAWARE
,
"wrong awareness %u
\n
"
,
awareness
);
context
=
pGetThreadDpiAwarenessContext
();
awareness
=
pGetAwarenessFromDpiAwarenessContext
(
context
);
ok
(
awareness
==
DPI_AWARENESS_PER_MONITOR_AWARE
,
"wrong awareness %u
\n
"
,
awareness
);
context
=
pSetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT_SYSTEM_AWARE
);
awareness
=
pGetAwarenessFromDpiAwarenessContext
(
context
);
ok
(
awareness
==
DPI_AWARENESS_PER_MONITOR_AWARE
,
"wrong awareness %u
\n
"
,
awareness
);
}
else
win_skip
(
"SetProcessDPIAware not supported
\n
"
);
ret
=
pSetProcessDPIAware
();
ok
(
ret
,
"got %d
\n
"
,
ret
);
...
...
@@ -3045,6 +3082,9 @@ START_TEST(sysparams)
pIsProcessDPIAware
=
(
void
*
)
GetProcAddress
(
hdll
,
"IsProcessDPIAware"
);
pSetProcessDPIAware
=
(
void
*
)
GetProcAddress
(
hdll
,
"SetProcessDPIAware"
);
pSetProcessDpiAwarenessContext
=
(
void
*
)
GetProcAddress
(
hdll
,
"SetProcessDpiAwarenessContext"
);
pGetThreadDpiAwarenessContext
=
(
void
*
)
GetProcAddress
(
hdll
,
"GetThreadDpiAwarenessContext"
);
pSetThreadDpiAwarenessContext
=
(
void
*
)
GetProcAddress
(
hdll
,
"SetThreadDpiAwarenessContext"
);
pGetAwarenessFromDpiAwarenessContext
=
(
void
*
)
GetProcAddress
(
hdll
,
"GetAwarenessFromDpiAwarenessContext"
);
hInstance
=
GetModuleHandleA
(
NULL
);
hdc
=
GetDC
(
0
);
...
...
dlls/user32/user32.spec
View file @
478814ed
...
...
@@ -379,6 +379,7 @@
@ stdcall GetTabbedTextExtentW(long wstr long long ptr)
@ stdcall GetTaskmanWindow ()
@ stdcall GetThreadDesktop(long)
@ stdcall GetThreadDpiAwarenessContext()
@ stdcall GetTitleBarInfo(long ptr)
@ stdcall GetTopWindow(long)
@ stdcall GetTouchInputInfo(long long ptr long)
...
...
dlls/user32/user_private.h
View file @
478814ed
...
...
@@ -169,6 +169,7 @@ struct wm_char_mapping_data
/* no attempt is made to keep the layout compatible with the Windows one */
struct
user_thread_info
{
DPI_AWARENESS_CONTEXT
dpi_awareness
;
/* DPI awareness context */
HANDLE
server_queue
;
/* Handle to server-side queue */
DWORD
wake_mask
;
/* Current queue wake mask */
DWORD
changed_mask
;
/* Current queue changed mask */
...
...
include/winuser.h
View file @
478814ed
...
...
@@ -3766,6 +3766,7 @@ WINUSERAPI DWORD WINAPI GetTabbedTextExtentW(HDC,LPCWSTR,INT,INT,const INT
#define GetTabbedTextExtent WINELIB_NAME_AW(GetTabbedTextExtent)
WINUSERAPI
BOOL
WINAPI
GetTitleBarInfo
(
HWND
,
PTITLEBARINFO
);
WINUSERAPI
HDESK
WINAPI
GetThreadDesktop
(
DWORD
);
WINUSERAPI
DPI_AWARENESS_CONTEXT
WINAPI
GetThreadDpiAwarenessContext
(
void
);
WINUSERAPI
HWND
WINAPI
GetTopWindow
(
HWND
);
WINUSERAPI
BOOL
WINAPI
GetTouchInputInfo
(
HTOUCHINPUT
,
UINT
,
TOUCHINPUT
*
,
int
);
WINUSERAPI
BOOL
WINAPI
GetUpdateRect
(
HWND
,
LPRECT
,
BOOL
);
...
...
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