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
2068b73d
Commit
2068b73d
authored
Aug 27, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Process hardware messages in physical coordinates.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c33615dc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
22 deletions
+49
-22
message.c
dlls/user32/message.c
+21
-10
sysparams.c
dlls/user32/sysparams.c
+26
-12
win.h
dlls/user32/win.h
+2
-0
No files found.
dlls/user32/message.c
View file @
2068b73d
...
@@ -2388,6 +2388,7 @@ static BOOL process_rawinput_message( MSG *msg, const struct hardware_msg_data *
...
@@ -2388,6 +2388,7 @@ static BOOL process_rawinput_message( MSG *msg, const struct hardware_msg_data *
}
}
msg
->
lParam
=
(
LPARAM
)
rawinput
;
msg
->
lParam
=
(
LPARAM
)
rawinput
;
msg
->
pt
=
point_phys_to_win_dpi
(
msg
->
hwnd
,
msg
->
pt
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -2463,6 +2464,7 @@ static BOOL process_keyboard_message( MSG *msg, UINT hw_id, HWND hwnd_filter,
...
@@ -2463,6 +2464,7 @@ static BOOL process_keyboard_message( MSG *msg, UINT hw_id, HWND hwnd_filter,
return
FALSE
;
return
FALSE
;
}
}
accept_hardware_message
(
hw_id
,
remove
);
accept_hardware_message
(
hw_id
,
remove
);
msg
->
pt
=
point_phys_to_win_dpi
(
msg
->
hwnd
,
msg
->
pt
);
if
(
remove
&&
msg
->
message
==
WM_KEYDOWN
)
if
(
remove
&&
msg
->
message
==
WM_KEYDOWN
)
if
(
ImmProcessKey
(
msg
->
hwnd
,
GetKeyboardLayout
(
0
),
msg
->
wParam
,
msg
->
lParam
,
0
)
)
if
(
ImmProcessKey
(
msg
->
hwnd
,
GetKeyboardLayout
(
0
),
msg
->
wParam
,
msg
->
lParam
,
0
)
)
...
@@ -2520,6 +2522,9 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H
...
@@ -2520,6 +2522,9 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H
return
FALSE
;
return
FALSE
;
}
}
msg
->
pt
=
point_phys_to_win_dpi
(
msg
->
hwnd
,
msg
->
pt
);
SetThreadDpiAwarenessContext
(
GetWindowDpiAwarenessContext
(
msg
->
hwnd
));
/* FIXME: is this really the right place for this hook? */
/* FIXME: is this really the right place for this hook? */
event
.
message
=
msg
->
message
;
event
.
message
=
msg
->
message
;
event
.
time
=
msg
->
time
;
event
.
time
=
msg
->
time
;
...
@@ -2693,17 +2698,22 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H
...
@@ -2693,17 +2698,22 @@ static BOOL process_mouse_message( MSG *msg, UINT hw_id, ULONG_PTR extra_info, H
static
BOOL
process_hardware_message
(
MSG
*
msg
,
UINT
hw_id
,
const
struct
hardware_msg_data
*
msg_data
,
static
BOOL
process_hardware_message
(
MSG
*
msg
,
UINT
hw_id
,
const
struct
hardware_msg_data
*
msg_data
,
HWND
hwnd_filter
,
UINT
first
,
UINT
last
,
BOOL
remove
)
HWND
hwnd_filter
,
UINT
first
,
UINT
last
,
BOOL
remove
)
{
{
if
(
msg
->
message
==
WM_INPUT
)
DPI_AWARENESS_CONTEXT
context
;
return
process_rawinput_message
(
msg
,
msg_data
)
;
BOOL
ret
=
FALSE
;
if
(
is_keyboard_message
(
msg
->
message
))
/* hardware messages are always in physical coords */
return
process_keyboard_message
(
msg
,
hw_id
,
hwnd_filter
,
first
,
last
,
remove
);
context
=
SetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE
);
if
(
is_mouse_message
(
msg
->
message
))
if
(
msg
->
message
==
WM_INPUT
)
return
process_mouse_message
(
msg
,
hw_id
,
msg_data
->
info
,
hwnd_filter
,
first
,
last
,
remove
);
ret
=
process_rawinput_message
(
msg
,
msg_data
);
else
if
(
is_keyboard_message
(
msg
->
message
))
ERR
(
"unknown message type %x
\n
"
,
msg
->
message
);
ret
=
process_keyboard_message
(
msg
,
hw_id
,
hwnd_filter
,
first
,
last
,
remove
);
return
FALSE
;
else
if
(
is_mouse_message
(
msg
->
message
))
ret
=
process_mouse_message
(
msg
,
hw_id
,
msg_data
->
info
,
hwnd_filter
,
first
,
last
,
remove
);
else
ERR
(
"unknown message type %x
\n
"
,
msg
->
message
);
SetThreadDpiAwarenessContext
(
context
);
return
ret
;
}
}
...
@@ -2938,7 +2948,8 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
...
@@ -2938,7 +2948,8 @@ static BOOL peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, UINT flags
continue
;
/* ignore it */
continue
;
/* ignore it */
}
}
*
msg
=
info
.
msg
;
*
msg
=
info
.
msg
;
thread_info
->
GetMessagePosVal
=
MAKELONG
(
info
.
msg
.
pt
.
x
,
info
.
msg
.
pt
.
y
);
msg
->
pt
=
point_phys_to_win_dpi
(
info
.
msg
.
hwnd
,
info
.
msg
.
pt
);
thread_info
->
GetMessagePosVal
=
MAKELONG
(
msg
->
pt
.
x
,
msg
->
pt
.
y
);
thread_info
->
GetMessageTimeVal
=
info
.
msg
.
time
;
thread_info
->
GetMessageTimeVal
=
info
.
msg
.
time
;
thread_info
->
GetMessageExtraInfoVal
=
0
;
thread_info
->
GetMessageExtraInfoVal
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
...
...
dlls/user32/sysparams.c
View file @
2068b73d
...
@@ -3235,6 +3235,22 @@ POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to )
...
@@ -3235,6 +3235,22 @@ POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to )
}
}
/**********************************************************************
/**********************************************************************
* point_win_to_phys_dpi
*/
POINT
point_win_to_phys_dpi
(
HWND
hwnd
,
POINT
pt
)
{
return
map_dpi_point
(
pt
,
GetDpiForWindow
(
hwnd
),
get_win_monitor_dpi
(
hwnd
)
);
}
/**********************************************************************
* point_phys_to_win_dpi
*/
POINT
point_phys_to_win_dpi
(
HWND
hwnd
,
POINT
pt
)
{
return
map_dpi_point
(
pt
,
get_win_monitor_dpi
(
hwnd
),
GetDpiForWindow
(
hwnd
));
}
/**********************************************************************
* point_win_to_thread_dpi
* point_win_to_thread_dpi
*/
*/
POINT
point_win_to_thread_dpi
(
HWND
hwnd
,
POINT
pt
)
POINT
point_win_to_thread_dpi
(
HWND
hwnd
,
POINT
pt
)
...
@@ -3475,13 +3491,11 @@ DPI_AWARENESS_CONTEXT WINAPI SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT
...
@@ -3475,13 +3491,11 @@ DPI_AWARENESS_CONTEXT WINAPI SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT
*/
*/
BOOL
WINAPI
LogicalToPhysicalPointForPerMonitorDPI
(
HWND
hwnd
,
POINT
*
pt
)
BOOL
WINAPI
LogicalToPhysicalPointForPerMonitorDPI
(
HWND
hwnd
,
POINT
*
pt
)
{
{
UINT
dpi
=
GetDpiForWindow
(
hwnd
);
RECT
rect
;
RECT
rect
;
GetWindowRect
(
hwnd
,
&
rect
)
;
if
(
!
GetWindowRect
(
hwnd
,
&
rect
))
return
FALSE
;
if
(
pt
->
x
<
rect
.
left
||
pt
->
y
<
rect
.
top
||
pt
->
x
>
rect
.
right
||
pt
->
y
>
rect
.
bottom
)
return
FALSE
;
if
(
pt
->
x
<
rect
.
left
||
pt
->
y
<
rect
.
top
||
pt
->
x
>
rect
.
right
||
pt
->
y
>
rect
.
bottom
)
return
FALSE
;
pt
->
x
=
MulDiv
(
pt
->
x
,
system_dpi
,
dpi
);
*
pt
=
point_win_to_phys_dpi
(
hwnd
,
*
pt
);
pt
->
y
=
MulDiv
(
pt
->
y
,
system_dpi
,
dpi
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -3491,18 +3505,18 @@ BOOL WINAPI LogicalToPhysicalPointForPerMonitorDPI( HWND hwnd, POINT *pt )
...
@@ -3491,18 +3505,18 @@ BOOL WINAPI LogicalToPhysicalPointForPerMonitorDPI( HWND hwnd, POINT *pt )
BOOL
WINAPI
PhysicalToLogicalPointForPerMonitorDPI
(
HWND
hwnd
,
POINT
*
pt
)
BOOL
WINAPI
PhysicalToLogicalPointForPerMonitorDPI
(
HWND
hwnd
,
POINT
*
pt
)
{
{
DPI_AWARENESS_CONTEXT
context
;
DPI_AWARENESS_CONTEXT
context
;
UINT
dpi
=
GetDpiForWindow
(
hwnd
);
RECT
rect
;
RECT
rect
;
BOOL
ret
=
FALSE
;
/* get window rect in physical coords */
context
=
SetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE
);
context
=
SetThreadDpiAwarenessContext
(
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE
);
GetWindowRect
(
hwnd
,
&
rect
);
if
(
GetWindowRect
(
hwnd
,
&
rect
)
&&
pt
->
x
>=
rect
.
left
&&
pt
->
y
>=
rect
.
top
&&
pt
->
x
<=
rect
.
right
&&
pt
->
y
<=
rect
.
bottom
)
{
*
pt
=
point_phys_to_win_dpi
(
hwnd
,
*
pt
);
ret
=
TRUE
;
}
SetThreadDpiAwarenessContext
(
context
);
SetThreadDpiAwarenessContext
(
context
);
return
ret
;
if
(
pt
->
x
<
rect
.
left
||
pt
->
y
<
rect
.
top
||
pt
->
x
>
rect
.
right
||
pt
->
y
>
rect
.
bottom
)
return
FALSE
;
pt
->
x
=
MulDiv
(
pt
->
x
,
dpi
,
system_dpi
);
pt
->
y
=
MulDiv
(
pt
->
y
,
dpi
,
system_dpi
);
return
TRUE
;
}
}
struct
monitor_enum_info
struct
monitor_enum_info
...
...
dlls/user32/win.h
View file @
2068b73d
...
@@ -132,6 +132,8 @@ extern UINT get_monitor_dpi( HMONITOR monitor ) DECLSPEC_HIDDEN;
...
@@ -132,6 +132,8 @@ extern UINT get_monitor_dpi( HMONITOR monitor ) DECLSPEC_HIDDEN;
extern
UINT
get_win_monitor_dpi
(
HWND
hwnd
)
DECLSPEC_HIDDEN
;
extern
UINT
get_win_monitor_dpi
(
HWND
hwnd
)
DECLSPEC_HIDDEN
;
extern
UINT
get_thread_dpi
(
void
)
DECLSPEC_HIDDEN
;
extern
UINT
get_thread_dpi
(
void
)
DECLSPEC_HIDDEN
;
extern
POINT
map_dpi_point
(
POINT
pt
,
UINT
dpi_from
,
UINT
dpi_to
)
DECLSPEC_HIDDEN
;
extern
POINT
map_dpi_point
(
POINT
pt
,
UINT
dpi_from
,
UINT
dpi_to
)
DECLSPEC_HIDDEN
;
extern
POINT
point_win_to_phys_dpi
(
HWND
hwnd
,
POINT
pt
)
DECLSPEC_HIDDEN
;
extern
POINT
point_phys_to_win_dpi
(
HWND
hwnd
,
POINT
pt
)
DECLSPEC_HIDDEN
;
extern
POINT
point_win_to_thread_dpi
(
HWND
hwnd
,
POINT
pt
)
DECLSPEC_HIDDEN
;
extern
POINT
point_win_to_thread_dpi
(
HWND
hwnd
,
POINT
pt
)
DECLSPEC_HIDDEN
;
extern
POINT
point_thread_to_win_dpi
(
HWND
hwnd
,
POINT
pt
)
DECLSPEC_HIDDEN
;
extern
POINT
point_thread_to_win_dpi
(
HWND
hwnd
,
POINT
pt
)
DECLSPEC_HIDDEN
;
extern
RECT
map_dpi_rect
(
RECT
rect
,
UINT
dpi_from
,
UINT
dpi_to
)
DECLSPEC_HIDDEN
;
extern
RECT
map_dpi_rect
(
RECT
rect
,
UINT
dpi_from
,
UINT
dpi_to
)
DECLSPEC_HIDDEN
;
...
...
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