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
39f0bbff
Commit
39f0bbff
authored
May 02, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Set the thread DPI awareness to the window's when calling a window procedure.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
487599e7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
25 deletions
+42
-25
message.c
dlls/user.exe16/message.c
+3
-0
sysparams.c
dlls/user32/tests/sysparams.c
+33
-25
winproc.c
dlls/user32/winproc.c
+6
-0
No files found.
dlls/user.exe16/message.c
View file @
39f0bbff
...
...
@@ -228,6 +228,7 @@ WNDPROC16 WINPROC_GetProc16( WNDPROC proc, BOOL unicode )
static
LRESULT
call_window_proc16
(
HWND16
hwnd
,
UINT16
msg
,
WPARAM16
wParam
,
LPARAM
lParam
,
LRESULT
*
result
,
void
*
arg
)
{
DPI_AWARENESS_CONTEXT
awareness
;
WNDPROC16
func
=
arg
;
int
index
=
winproc_to_index
(
func
);
CONTEXT
context
;
...
...
@@ -281,6 +282,7 @@ static LRESULT call_window_proc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPA
}
}
awareness
=
SetThreadDpiAwarenessContext
(
GetWindowDpiAwarenessContext
(
HWND_32
(
hwnd
)
));
args
.
params
[
4
]
=
hwnd
;
args
.
params
[
3
]
=
msg
;
args
.
params
[
2
]
=
wParam
;
...
...
@@ -288,6 +290,7 @@ static LRESULT call_window_proc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPA
args
.
params
[
0
]
=
LOWORD
(
lParam
);
WOWCallback16Ex
(
0
,
WCB16_REGS
,
sizeof
(
args
.
params
)
+
size
,
&
args
,
(
DWORD
*
)
&
context
);
*
result
=
MAKELONG
(
LOWORD
(
context
.
Eax
),
LOWORD
(
context
.
Edx
)
);
SetThreadDpiAwarenessContext
(
awareness
);
return
*
result
;
}
...
...
dlls/user32/tests/sysparams.c
View file @
39f0bbff
...
...
@@ -3512,11 +3512,22 @@ static void test_dpi_context(void)
ReleaseDC
(
0
,
hdc
);
}
static
LRESULT
CALLBACK
dpi_winproc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wp
,
LPARAM
lp
)
{
DPI_AWARENESS_CONTEXT
ctx
=
pGetWindowDpiAwarenessContext
(
hwnd
);
DPI_AWARENESS_CONTEXT
ctx2
=
pGetThreadDpiAwarenessContext
();
ok
(
pGetAwarenessFromDpiAwarenessContext
(
ctx
)
==
pGetAwarenessFromDpiAwarenessContext
(
ctx2
),
"msg %04x wrong awareness %p / %p
\n
"
,
msg
,
ctx
,
ctx2
);
return
DefWindowProcA
(
hwnd
,
msg
,
wp
,
lp
);
}
static
void
test_dpi_window
(
void
)
{
DPI_AWARENESS_CONTEXT
context
,
orig
;
DPI_AWARENESS
awareness
;
ULONG_PTR
i
,
j
;
HWND
hwnd
;
MSG
msg
=
{
0
,
WM_USER
+
1
,
0
,
0
};
if
(
!
pGetWindowDpiAwarenessContext
)
{
...
...
@@ -3524,31 +3535,25 @@ static void test_dpi_window(void)
return
;
}
orig
=
pSetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT_UNAWARE
);
hwnd
=
CreateWindowA
(
"SysParamsTestClass"
,
"Test System Parameters Application"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
100
,
100
,
0
,
0
,
GetModuleHandleA
(
0
),
NULL
);
ok
(
hwnd
!=
0
,
"failed to create window
\n
"
);
context
=
pGetWindowDpiAwarenessContext
(
hwnd
);
awareness
=
pGetAwarenessFromDpiAwarenessContext
(
context
);
ok
(
awareness
==
DPI_AWARENESS_UNAWARE
,
"wrong awareness %u
\n
"
,
awareness
);
DestroyWindow
(
hwnd
);
pSetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT_SYSTEM_AWARE
);
hwnd
=
CreateWindowA
(
"SysParamsTestClass"
,
"Test System Parameters Application"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
100
,
100
,
0
,
0
,
GetModuleHandleA
(
0
),
NULL
);
ok
(
hwnd
!=
0
,
"failed to create window
\n
"
);
context
=
pGetWindowDpiAwarenessContext
(
hwnd
);
awareness
=
pGetAwarenessFromDpiAwarenessContext
(
context
);
ok
(
awareness
==
DPI_AWARENESS_SYSTEM_AWARE
,
"wrong awareness %u
\n
"
,
awareness
);
DestroyWindow
(
hwnd
);
pSetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE
);
hwnd
=
CreateWindowA
(
"SysParamsTestClass"
,
"Test System Parameters Application"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
100
,
100
,
0
,
0
,
GetModuleHandleA
(
0
),
NULL
);
ok
(
hwnd
!=
0
,
"failed to create window
\n
"
);
context
=
pGetWindowDpiAwarenessContext
(
hwnd
);
awareness
=
pGetAwarenessFromDpiAwarenessContext
(
context
);
ok
(
awareness
==
DPI_AWARENESS_PER_MONITOR_AWARE
,
"wrong awareness %u
\n
"
,
awareness
);
DestroyWindow
(
hwnd
);
for
(
i
=
DPI_AWARENESS_UNAWARE
;
i
<=
DPI_AWARENESS_PER_MONITOR_AWARE
;
i
++
)
{
pSetThreadDpiAwarenessContext
(
(
DPI_AWARENESS_CONTEXT
)
~
i
);
hwnd
=
CreateWindowA
(
"DpiTestClass"
,
"Test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
100
,
100
,
0
,
0
,
GetModuleHandleA
(
0
),
NULL
);
ok
(
hwnd
!=
0
,
"failed to create window
\n
"
);
context
=
pGetWindowDpiAwarenessContext
(
hwnd
);
awareness
=
pGetAwarenessFromDpiAwarenessContext
(
context
);
ok
(
awareness
==
i
,
"%lu: wrong awareness %u
\n
"
,
i
,
awareness
);
msg
.
hwnd
=
hwnd
;
for
(
j
=
DPI_AWARENESS_UNAWARE
;
j
<=
DPI_AWARENESS_PER_MONITOR_AWARE
;
j
++
)
{
pSetThreadDpiAwarenessContext
(
(
DPI_AWARENESS_CONTEXT
)
~
j
);
SendMessageA
(
hwnd
,
WM_USER
,
0
,
0
);
DispatchMessageA
(
&
msg
);
CallWindowProcA
(
dpi_winproc
,
hwnd
,
WM_USER
+
2
,
0
,
0
);
}
DestroyWindow
(
hwnd
);
}
SetLastError
(
0xdeadbeef
);
context
=
pGetWindowDpiAwarenessContext
(
(
HWND
)
0xdeadbeef
);
...
...
@@ -3634,6 +3639,9 @@ START_TEST(sysparams)
wc
.
cbClsExtra
=
0
;
wc
.
cbWndExtra
=
0
;
RegisterClassA
(
&
wc
);
wc
.
lpszClassName
=
"DpiTestClass"
;
wc
.
lpfnWndProc
=
dpi_winproc
;
RegisterClassA
(
&
wc
);
ghTestWnd
=
CreateWindowA
(
"SysParamsTestClass"
,
"Test System Parameters Application"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
100
,
100
,
0
,
0
,
hInstance
,
NULL
);
...
...
dlls/user32/winproc.c
View file @
39f0bbff
...
...
@@ -233,6 +233,7 @@ static WPARAM map_wparam_char_WtoA( WPARAM wParam, DWORD len )
/* call a 32-bit window procedure */
static
LRESULT
call_window_proc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wp
,
LPARAM
lp
,
LRESULT
*
result
,
void
*
arg
)
{
DPI_AWARENESS_CONTEXT
context
;
WNDPROC
proc
=
arg
;
USER_CheckNotLock
();
...
...
@@ -241,7 +242,9 @@ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, LRES
TRACE_
(
relay
)(
"
\1
Call window proc %p (hwnd=%p,msg=%s,wp=%08lx,lp=%08lx)
\n
"
,
proc
,
hwnd
,
SPY_GetMsgName
(
msg
,
hwnd
),
wp
,
lp
);
context
=
SetThreadDpiAwarenessContext
(
GetWindowDpiAwarenessContext
(
hwnd
));
*
result
=
WINPROC_wrapper
(
proc
,
hwnd
,
msg
,
wp
,
lp
);
SetThreadDpiAwarenessContext
(
context
);
TRACE_
(
relay
)(
"
\1
Ret window proc %p (hwnd=%p,msg=%s,wp=%08lx,lp=%08lx) retval=%08lx
\n
"
,
proc
,
hwnd
,
SPY_GetMsgName
(
msg
,
hwnd
),
wp
,
lp
,
*
result
);
...
...
@@ -251,6 +254,7 @@ static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, LRES
/* call a 32-bit dialog procedure */
static
LRESULT
call_dialog_proc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wp
,
LPARAM
lp
,
LRESULT
*
result
,
void
*
arg
)
{
DPI_AWARENESS_CONTEXT
context
;
WNDPROC
proc
=
arg
;
LRESULT
ret
;
...
...
@@ -260,8 +264,10 @@ static LRESULT call_dialog_proc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, LRES
TRACE_
(
relay
)(
"
\1
Call dialog proc %p (hwnd=%p,msg=%s,wp=%08lx,lp=%08lx)
\n
"
,
proc
,
hwnd
,
SPY_GetMsgName
(
msg
,
hwnd
),
wp
,
lp
);
context
=
SetThreadDpiAwarenessContext
(
GetWindowDpiAwarenessContext
(
hwnd
));
ret
=
WINPROC_wrapper
(
proc
,
hwnd
,
msg
,
wp
,
lp
);
*
result
=
GetWindowLongPtrW
(
hwnd
,
DWLP_MSGRESULT
);
SetThreadDpiAwarenessContext
(
context
);
TRACE_
(
relay
)(
"
\1
Ret dialog proc %p (hwnd=%p,msg=%s,wp=%08lx,lp=%08lx) retval=%08lx result=%08lx
\n
"
,
proc
,
hwnd
,
SPY_GetMsgName
(
msg
,
hwnd
),
wp
,
lp
,
ret
,
*
result
);
...
...
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