Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
262ad90d
Commit
262ad90d
authored
Jun 25, 2020
by
Rémi Bernon
Committed by
Alexandre Julliard
Jun 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Introduce rawinput_from_hardware_message helper.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
083cb5c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
95 deletions
+109
-95
message.c
dlls/user32/message.c
+1
-95
rawinput.c
dlls/user32/rawinput.c
+105
-0
user_private.h
dlls/user32/user_private.h
+3
-0
No files found.
dlls/user32/message.c
View file @
262ad90d
...
...
@@ -2295,102 +2295,8 @@ static BOOL process_rawinput_message( MSG *msg, const struct hardware_msg_data *
if
(
!
(
rawinput
=
thread_info
->
rawinput
))
return
FALSE
;
}
rawinput
->
header
.
dwType
=
msg_data
->
rawinput
.
type
;
if
(
msg_data
->
rawinput
.
type
==
RIM_TYPEMOUSE
)
{
static
const
unsigned
int
button_flags
[]
=
{
0
,
/* MOUSEEVENTF_MOVE */
RI_MOUSE_LEFT_BUTTON_DOWN
,
/* MOUSEEVENTF_LEFTDOWN */
RI_MOUSE_LEFT_BUTTON_UP
,
/* MOUSEEVENTF_LEFTUP */
RI_MOUSE_RIGHT_BUTTON_DOWN
,
/* MOUSEEVENTF_RIGHTDOWN */
RI_MOUSE_RIGHT_BUTTON_UP
,
/* MOUSEEVENTF_RIGHTUP */
RI_MOUSE_MIDDLE_BUTTON_DOWN
,
/* MOUSEEVENTF_MIDDLEDOWN */
RI_MOUSE_MIDDLE_BUTTON_UP
,
/* MOUSEEVENTF_MIDDLEUP */
};
unsigned
int
i
;
rawinput
->
header
.
dwSize
=
FIELD_OFFSET
(
RAWINPUT
,
data
)
+
sizeof
(
RAWMOUSE
);
rawinput
->
header
.
hDevice
=
WINE_MOUSE_HANDLE
;
rawinput
->
header
.
wParam
=
0
;
rawinput
->
data
.
mouse
.
usFlags
=
MOUSE_MOVE_RELATIVE
;
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
=
0
;
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonData
=
0
;
for
(
i
=
1
;
i
<
ARRAY_SIZE
(
button_flags
);
++
i
)
{
if
(
msg_data
->
flags
&
(
1
<<
i
))
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
button_flags
[
i
];
}
if
(
msg_data
->
flags
&
MOUSEEVENTF_WHEEL
)
{
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
RI_MOUSE_WHEEL
;
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonData
=
msg_data
->
rawinput
.
mouse
.
data
;
}
if
(
msg_data
->
flags
&
MOUSEEVENTF_HWHEEL
)
{
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
RI_MOUSE_HORIZONTAL_WHEEL
;
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonData
=
msg_data
->
rawinput
.
mouse
.
data
;
}
if
(
msg_data
->
flags
&
MOUSEEVENTF_XDOWN
)
{
if
(
msg_data
->
rawinput
.
mouse
.
data
==
XBUTTON1
)
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
RI_MOUSE_BUTTON_4_DOWN
;
else
if
(
msg_data
->
rawinput
.
mouse
.
data
==
XBUTTON2
)
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
RI_MOUSE_BUTTON_5_DOWN
;
}
if
(
msg_data
->
flags
&
MOUSEEVENTF_XUP
)
{
if
(
msg_data
->
rawinput
.
mouse
.
data
==
XBUTTON1
)
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
RI_MOUSE_BUTTON_4_UP
;
else
if
(
msg_data
->
rawinput
.
mouse
.
data
==
XBUTTON2
)
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
RI_MOUSE_BUTTON_5_UP
;
}
rawinput
->
data
.
mouse
.
ulRawButtons
=
0
;
rawinput
->
data
.
mouse
.
lLastX
=
msg_data
->
rawinput
.
mouse
.
x
;
rawinput
->
data
.
mouse
.
lLastY
=
msg_data
->
rawinput
.
mouse
.
y
;
rawinput
->
data
.
mouse
.
ulExtraInformation
=
msg_data
->
info
;
}
else
if
(
msg_data
->
rawinput
.
type
==
RIM_TYPEKEYBOARD
)
{
rawinput
->
header
.
dwSize
=
FIELD_OFFSET
(
RAWINPUT
,
data
)
+
sizeof
(
RAWKEYBOARD
);
rawinput
->
header
.
hDevice
=
WINE_KEYBOARD_HANDLE
;
rawinput
->
header
.
wParam
=
0
;
rawinput
->
data
.
keyboard
.
MakeCode
=
msg_data
->
rawinput
.
kbd
.
scan
;
rawinput
->
data
.
keyboard
.
Flags
=
msg_data
->
flags
&
KEYEVENTF_KEYUP
?
RI_KEY_BREAK
:
RI_KEY_MAKE
;
if
(
msg_data
->
flags
&
KEYEVENTF_EXTENDEDKEY
)
rawinput
->
data
.
keyboard
.
Flags
|=
RI_KEY_E0
;
rawinput
->
data
.
keyboard
.
Reserved
=
0
;
switch
(
msg_data
->
rawinput
.
kbd
.
vkey
)
{
case
VK_LSHIFT
:
case
VK_RSHIFT
:
rawinput
->
data
.
keyboard
.
VKey
=
VK_SHIFT
;
rawinput
->
data
.
keyboard
.
Flags
&=
~
RI_KEY_E0
;
break
;
case
VK_LCONTROL
:
case
VK_RCONTROL
:
rawinput
->
data
.
keyboard
.
VKey
=
VK_CONTROL
;
break
;
case
VK_LMENU
:
case
VK_RMENU
:
rawinput
->
data
.
keyboard
.
VKey
=
VK_MENU
;
break
;
default:
rawinput
->
data
.
keyboard
.
VKey
=
msg_data
->
rawinput
.
kbd
.
vkey
;
break
;
}
rawinput
->
data
.
keyboard
.
Message
=
msg_data
->
rawinput
.
kbd
.
message
;
rawinput
->
data
.
keyboard
.
ExtraInformation
=
msg_data
->
info
;
}
else
{
FIXME
(
"Unhandled rawinput type %#x.
\n
"
,
msg_data
->
rawinput
.
type
);
if
(
!
rawinput_from_hardware_message
(
rawinput
,
msg_data
))
return
FALSE
;
}
msg
->
lParam
=
(
LPARAM
)
rawinput
;
msg
->
pt
=
point_phys_to_win_dpi
(
msg
->
hwnd
,
msg
->
pt
);
...
...
dlls/user32/rawinput.c
View file @
262ad90d
...
...
@@ -23,6 +23,7 @@
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
...
...
@@ -221,6 +222,110 @@ static void find_devices(void)
LeaveCriticalSection
(
&
rawinput_devices_cs
);
}
BOOL
rawinput_from_hardware_message
(
RAWINPUT
*
rawinput
,
const
struct
hardware_msg_data
*
msg_data
)
{
rawinput
->
header
.
dwType
=
msg_data
->
rawinput
.
type
;
if
(
msg_data
->
rawinput
.
type
==
RIM_TYPEMOUSE
)
{
static
const
unsigned
int
button_flags
[]
=
{
0
,
/* MOUSEEVENTF_MOVE */
RI_MOUSE_LEFT_BUTTON_DOWN
,
/* MOUSEEVENTF_LEFTDOWN */
RI_MOUSE_LEFT_BUTTON_UP
,
/* MOUSEEVENTF_LEFTUP */
RI_MOUSE_RIGHT_BUTTON_DOWN
,
/* MOUSEEVENTF_RIGHTDOWN */
RI_MOUSE_RIGHT_BUTTON_UP
,
/* MOUSEEVENTF_RIGHTUP */
RI_MOUSE_MIDDLE_BUTTON_DOWN
,
/* MOUSEEVENTF_MIDDLEDOWN */
RI_MOUSE_MIDDLE_BUTTON_UP
,
/* MOUSEEVENTF_MIDDLEUP */
};
unsigned
int
i
;
rawinput
->
header
.
dwSize
=
FIELD_OFFSET
(
RAWINPUT
,
data
)
+
sizeof
(
RAWMOUSE
);
rawinput
->
header
.
hDevice
=
WINE_MOUSE_HANDLE
;
rawinput
->
header
.
wParam
=
0
;
rawinput
->
data
.
mouse
.
usFlags
=
MOUSE_MOVE_RELATIVE
;
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
=
0
;
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonData
=
0
;
for
(
i
=
1
;
i
<
ARRAY_SIZE
(
button_flags
);
++
i
)
{
if
(
msg_data
->
flags
&
(
1
<<
i
))
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
button_flags
[
i
];
}
if
(
msg_data
->
flags
&
MOUSEEVENTF_WHEEL
)
{
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
RI_MOUSE_WHEEL
;
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonData
=
msg_data
->
rawinput
.
mouse
.
data
;
}
if
(
msg_data
->
flags
&
MOUSEEVENTF_HWHEEL
)
{
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
RI_MOUSE_HORIZONTAL_WHEEL
;
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonData
=
msg_data
->
rawinput
.
mouse
.
data
;
}
if
(
msg_data
->
flags
&
MOUSEEVENTF_XDOWN
)
{
if
(
msg_data
->
rawinput
.
mouse
.
data
==
XBUTTON1
)
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
RI_MOUSE_BUTTON_4_DOWN
;
else
if
(
msg_data
->
rawinput
.
mouse
.
data
==
XBUTTON2
)
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
RI_MOUSE_BUTTON_5_DOWN
;
}
if
(
msg_data
->
flags
&
MOUSEEVENTF_XUP
)
{
if
(
msg_data
->
rawinput
.
mouse
.
data
==
XBUTTON1
)
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
RI_MOUSE_BUTTON_4_UP
;
else
if
(
msg_data
->
rawinput
.
mouse
.
data
==
XBUTTON2
)
rawinput
->
data
.
mouse
.
u
.
s
.
usButtonFlags
|=
RI_MOUSE_BUTTON_5_UP
;
}
rawinput
->
data
.
mouse
.
ulRawButtons
=
0
;
rawinput
->
data
.
mouse
.
lLastX
=
msg_data
->
rawinput
.
mouse
.
x
;
rawinput
->
data
.
mouse
.
lLastY
=
msg_data
->
rawinput
.
mouse
.
y
;
rawinput
->
data
.
mouse
.
ulExtraInformation
=
msg_data
->
info
;
}
else
if
(
msg_data
->
rawinput
.
type
==
RIM_TYPEKEYBOARD
)
{
rawinput
->
header
.
dwSize
=
FIELD_OFFSET
(
RAWINPUT
,
data
)
+
sizeof
(
RAWKEYBOARD
);
rawinput
->
header
.
hDevice
=
WINE_KEYBOARD_HANDLE
;
rawinput
->
header
.
wParam
=
0
;
rawinput
->
data
.
keyboard
.
MakeCode
=
msg_data
->
rawinput
.
kbd
.
scan
;
rawinput
->
data
.
keyboard
.
Flags
=
msg_data
->
flags
&
KEYEVENTF_KEYUP
?
RI_KEY_BREAK
:
RI_KEY_MAKE
;
if
(
msg_data
->
flags
&
KEYEVENTF_EXTENDEDKEY
)
rawinput
->
data
.
keyboard
.
Flags
|=
RI_KEY_E0
;
rawinput
->
data
.
keyboard
.
Reserved
=
0
;
switch
(
msg_data
->
rawinput
.
kbd
.
vkey
)
{
case
VK_LSHIFT
:
case
VK_RSHIFT
:
rawinput
->
data
.
keyboard
.
VKey
=
VK_SHIFT
;
rawinput
->
data
.
keyboard
.
Flags
&=
~
RI_KEY_E0
;
break
;
case
VK_LCONTROL
:
case
VK_RCONTROL
:
rawinput
->
data
.
keyboard
.
VKey
=
VK_CONTROL
;
break
;
case
VK_LMENU
:
case
VK_RMENU
:
rawinput
->
data
.
keyboard
.
VKey
=
VK_MENU
;
break
;
default:
rawinput
->
data
.
keyboard
.
VKey
=
msg_data
->
rawinput
.
kbd
.
vkey
;
break
;
}
rawinput
->
data
.
keyboard
.
Message
=
msg_data
->
rawinput
.
kbd
.
message
;
rawinput
->
data
.
keyboard
.
ExtraInformation
=
msg_data
->
info
;
}
else
{
FIXME
(
"Unhandled rawinput type %#x.
\n
"
,
msg_data
->
rawinput
.
type
);
return
FALSE
;
}
return
TRUE
;
}
/***********************************************************************
* GetRawInputDeviceList (USER32.@)
*/
...
...
dlls/user32/user_private.h
View file @
262ad90d
...
...
@@ -230,6 +230,9 @@ extern HMODULE user32_module DECLSPEC_HIDDEN;
struct
dce
;
struct
tagWND
;
struct
hardware_msg_data
;
extern
BOOL
rawinput_from_hardware_message
(
RAWINPUT
*
rawinput
,
const
struct
hardware_msg_data
*
msg_data
);
extern
void
CLIPBOARD_ReleaseOwner
(
HWND
hwnd
)
DECLSPEC_HIDDEN
;
extern
BOOL
FOCUS_MouseActivate
(
HWND
hwnd
)
DECLSPEC_HIDDEN
;
extern
BOOL
set_capture_window
(
HWND
hwnd
,
UINT
gui_flags
,
HWND
*
prev_ret
)
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