[PATCH v3 4/4] server: Implement WM_INPUT / RIM_TYPEHID message dispatch.
Rémi Bernon
rbernon at codeweavers.com
Mon May 17 03:36:09 CDT 2021
The messages are of variable size and carry the corresponding HID report
data after each RAWINPUT struct.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/user32/message.c | 9 +++++++++
dlls/user32/rawinput.c | 15 +++++++++++++++
dlls/user32/user_private.h | 2 ++
server/queue.c | 1 +
server/trace.c | 1 +
5 files changed, 28 insertions(+)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 71d0be8913e..a80fb8c57ea 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -3254,6 +3254,14 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
hid_usage_page = ((USAGE *)rawinput->data.hid.bRawData)[0];
hid_usage = ((USAGE *)rawinput->data.hid.bRawData)[1];
}
+ if (input->u.hi.uMsg == WM_INPUT)
+ {
+ if (!rawinput_device_get_usages( rawinput->header.hDevice, &hid_usage_page, &hid_usage ))
+ {
+ WARN( "unable to get HID usages for device %p\n", rawinput->header.hDevice );
+ return STATUS_INVALID_HANDLE;
+ }
+ }
}
SERVER_START_REQ( send_hardware_message )
@@ -3283,6 +3291,7 @@ NTSTATUS send_hardware_message( HWND hwnd, const INPUT *input, const RAWINPUT *r
req->input.hw.lparam = MAKELONG( input->u.hi.wParamL, input->u.hi.wParamH );
switch (input->u.hi.uMsg)
{
+ case WM_INPUT:
case WM_INPUT_DEVICE_CHANGE:
req->input.hw.rawinput.type = rawinput->header.dwType;
switch (rawinput->header.dwType)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index 716047b4599..103f2bb8a55 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -267,6 +267,21 @@ static struct device *find_device_from_handle(HANDLE handle)
}
+BOOL rawinput_device_get_usages(HANDLE handle, USAGE *usage_page, USAGE *usage)
+{
+ struct device *device;
+
+ *usage_page = *usage = 0;
+
+ if (!(device = find_device_from_handle(handle))) return FALSE;
+ if (device->info.dwType != RIM_TYPEHID) return FALSE;
+
+ *usage_page = device->info.u.hid.usUsagePage;
+ *usage = device->info.u.hid.usUsage;
+ return TRUE;
+}
+
+
struct rawinput_thread_data *rawinput_thread_data(void)
{
struct user_thread_info *thread_info = get_user_thread_info();
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index 974d18be482..96cc01af2e9 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -28,6 +28,7 @@
#include "winuser.h"
#include "winreg.h"
#include "winternl.h"
+#include "hidusage.h"
#include "wine/heap.h"
#define GET_WORD(ptr) (*(const WORD *)(ptr))
@@ -239,6 +240,7 @@ struct tagWND;
struct hardware_msg_data;
extern BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data);
+extern BOOL rawinput_device_get_usages(HANDLE handle, USAGE *usage_page, USAGE *usage);
extern struct rawinput_thread_data *rawinput_thread_data(void);
extern void keyboard_init(void) DECLSPEC_HIDDEN;
diff --git a/server/queue.c b/server/queue.c
index ebbe4049ae8..3e6050686ae 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1994,6 +1994,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
switch (input->hw.msg)
{
+ case WM_INPUT:
case WM_INPUT_DEVICE_CHANGE:
raw_msg.foreground = NULL;
raw_msg.desktop = NULL;
diff --git a/server/trace.c b/server/trace.c
index 3cb601e774d..9b552454cf6 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -440,6 +440,7 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input )
dump_uint64( ",lparam=", &input->hw.lparam );
switch (input->hw.msg)
{
+ case WM_INPUT:
case WM_INPUT_DEVICE_CHANGE:
dump_rawinput( ",rawinput=", &input->hw.rawinput );
}
--
2.31.0
More information about the wine-devel
mailing list