Updated rawinput patchsets

This is a completely updated rawinput patchsets from Rémi Bernon,
replacing the current user32-rawinput.
This commit is contained in:
Alistair Leslie-Hughes
2019-12-23 20:03:44 +11:00
parent a8cb853708
commit 8218a78955
48 changed files with 4509 additions and 1595 deletions

View File

@@ -0,0 +1,44 @@
From a4256a564e309ad44a8aa8e8571c69444de20bf9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 19 Dec 2019 19:00:21 +0100
Subject: [PATCH 1/4] dinput8/tests: Add test for DISCL_EXCLUSIVE flag
interaction with rawinput.
---
dlls/dinput8/tests/device.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
index 42ba78707c6..845146af023 100644
--- a/dlls/dinput8/tests/device.c
+++ b/dlls/dinput8/tests/device.c
@@ -759,6 +759,26 @@ static void test_mouse_keyboard(void)
todo_wine
ok(raw_devices_count == 1, "Unexpected raw devices registered: %d\n", raw_devices_count);
+ IDirectInputDevice8_SetCooperativeLevel(di_mouse, hwnd, DISCL_FOREGROUND|DISCL_EXCLUSIVE);
+ IDirectInputDevice8_SetCooperativeLevel(di_keyboard, hwnd, DISCL_FOREGROUND|DISCL_EXCLUSIVE);
+
+ hr = IDirectInputDevice8_Acquire(di_keyboard);
+ ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+ hr = IDirectInputDevice8_Acquire(di_mouse);
+ ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+ raw_devices_count = ARRAY_SIZE(raw_devices);
+ memset(raw_devices, 0, sizeof(raw_devices));
+ hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
+ ok(hr == 3, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
+ todo_wine
+ ok(raw_devices[0].dwFlags == (RIDEV_CAPTUREMOUSE|RIDEV_NOLEGACY), "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
+ todo_wine
+ ok(raw_devices[2].dwFlags == (RIDEV_NOHOTKEYS|RIDEV_NOLEGACY), "Unexpected raw device flags: %x\n", raw_devices[1].dwFlags);
+ hr = IDirectInputDevice8_Unacquire(di_keyboard);
+ ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+ hr = IDirectInputDevice8_Unacquire(di_mouse);
+ ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+
raw_devices_count = ARRAY_SIZE(raw_devices);
hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
todo_wine
--
2.24.1

View File

@@ -0,0 +1,75 @@
From c39bb27347442d2d229d6e851c17094c086411d6 Mon Sep 17 00:00:00 2001
From: Derek Lesho <dereklesho52@Gmail.com>
Date: Tue, 25 Jun 2019 16:23:02 -0400
Subject: [PATCH 2/4] user32: Add support for RIDEV_NOLEGACY flag in
RegisterRawInputDevices.
---
dlls/user32/rawinput.c | 2 +-
server/queue.c | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index 3792360b057..8cf9f8ebf62 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -283,7 +283,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(RAWINPUTDEVICE *devices, U
TRACE("device %u: page %#x, usage %#x, flags %#x, target %p.\n",
i, devices[i].usUsagePage, devices[i].usUsage,
devices[i].dwFlags, devices[i].hwndTarget);
- if (devices[i].dwFlags & ~RIDEV_REMOVE)
+ if (devices[i].dwFlags & ~(RIDEV_REMOVE|RIDEV_NOLEGACY))
FIXME("Unhandled flags %#x for device %u.\n", devices[i].dwFlags, i);
d[i].usage_page = devices[i].usUsagePage;
diff --git a/server/queue.c b/server/queue.c
index 8a1bbfff5aa..f5dc06100d1 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -427,6 +427,9 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y )
static const struct hw_msg_source source = { IMDT_UNAVAILABLE, IMO_SYSTEM };
struct message *msg;
+ if (current->process->rawinput_mouse &&
+ current->process->rawinput_mouse->flags & RIDEV_NOLEGACY) return;
+
if (!(msg = alloc_hardware_message( 0, source, get_tick_count() ))) return;
msg->msg = WM_MOUSEMOVE;
@@ -1793,6 +1796,7 @@ done:
static int queue_mouse_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input,
unsigned int origin, struct msg_queue *sender, unsigned int req_flags )
{
+ const struct rawinput_device *device;
struct hardware_msg_data *msg_data;
struct rawinput_message raw_msg;
struct message *msg;
@@ -1866,6 +1870,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
if (!(req_flags & SEND_HWMSG_WINDOW))
return 0;
+ if ((device = current->process->rawinput_mouse) && (device->flags & RIDEV_NOLEGACY))
+ return 0;
for (i = 0; i < ARRAY_SIZE( messages ); i++)
{
@@ -1901,6 +1907,7 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
unsigned int origin, struct msg_queue *sender, unsigned int req_flags )
{
struct hw_msg_source source = { IMDT_KEYBOARD, origin };
+ const struct rawinput_device *device;
struct hardware_msg_data *msg_data;
struct rawinput_message raw_msg;
struct message *msg;
@@ -1996,6 +2003,8 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
if (!(req_flags & SEND_HWMSG_WINDOW))
return 0;
+ if ((device = current->process->rawinput_kbd) && (device->flags & RIDEV_NOLEGACY))
+ return 0;
if (!(msg = alloc_hardware_message( input->kbd.info, source, time ))) return 0;
msg_data = msg->data;
--
2.24.1

View File

@@ -0,0 +1,28 @@
From 1372e0e8582eeb423aa65deab17c52f4f5e153d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 19 Dec 2019 19:00:50 +0100
Subject: [PATCH 3/4] dinput: Set RIDEV_INPUTSINK flag only when
DISCL_BACKGROUND is requested.
---
dlls/dinput/dinput_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index 9e3b9f48250..ef92a7d7c50 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -1960,7 +1960,9 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
{
if (acquired)
{
- dev->raw_device.dwFlags = RIDEV_INPUTSINK;
+ dev->raw_device.dwFlags = 0;
+ if (dev->dwCoopLevel & DISCL_BACKGROUND)
+ dev->raw_device.dwFlags |= RIDEV_INPUTSINK;
dev->raw_device.hwndTarget = di_em_win;
}
else
--
2.24.1

View File

@@ -0,0 +1,40 @@
From 68898282e49228e9a26328373b4cd661a86d7672 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 19 Dec 2019 19:30:49 +0100
Subject: [PATCH 4/4] dinput: Set correct rawinput flags for DISCL_EXCLUSIVE.
---
dlls/dinput/dinput_main.c | 4 ++++
dlls/dinput8/tests/device.c | 1 -
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index ef92a7d7c50..6a74b6da500 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -1963,6 +1963,10 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
dev->raw_device.dwFlags = 0;
if (dev->dwCoopLevel & DISCL_BACKGROUND)
dev->raw_device.dwFlags |= RIDEV_INPUTSINK;
+ if ((dev->dwCoopLevel & DISCL_EXCLUSIVE) && dev->raw_device.usUsage == 2)
+ dev->raw_device.dwFlags |= (RIDEV_CAPTUREMOUSE|RIDEV_NOLEGACY);
+ if ((dev->dwCoopLevel & DISCL_EXCLUSIVE) && dev->raw_device.usUsage == 6)
+ dev->raw_device.dwFlags |= (RIDEV_NOHOTKEYS|RIDEV_NOLEGACY);
dev->raw_device.hwndTarget = di_em_win;
}
else
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
index 845146af023..31220db220a 100644
--- a/dlls/dinput8/tests/device.c
+++ b/dlls/dinput8/tests/device.c
@@ -770,7 +770,6 @@ static void test_mouse_keyboard(void)
memset(raw_devices, 0, sizeof(raw_devices));
hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
ok(hr == 3, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
- todo_wine
ok(raw_devices[0].dwFlags == (RIDEV_CAPTUREMOUSE|RIDEV_NOLEGACY), "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
todo_wine
ok(raw_devices[2].dwFlags == (RIDEV_NOHOTKEYS|RIDEV_NOLEGACY), "Unexpected raw device flags: %x\n", raw_devices[1].dwFlags);
--
2.24.1

View File

@@ -0,0 +1 @@
Depends: user32-rawinput-mouse