mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Rebase against 447bce4117a58910690a0d2610ebcbdd49ae9127.
This commit is contained in:
parent
46420edcd0
commit
bc6c681225
@ -1,4 +1,4 @@
|
||||
From dd7df362ecf1c3a7483e930dd9b9c8519db47aba Mon Sep 17 00:00:00 2001
|
||||
From f058e0e1425aab869a1a7d0db0446944af9bc8d6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 5 Aug 2017 03:39:55 +0200
|
||||
Subject: [PATCH] ntdll: Implement process token elevation through manifests.
|
||||
@ -74,7 +74,7 @@ index 6290cbcb4e6..9a8f13901b2 100644
|
||||
RemoveEntryList( &wm->ldr.InLoadOrderLinks );
|
||||
InsertHeadList( &peb->LdrData->InLoadOrderModuleList, &wm->ldr.InLoadOrderLinks );
|
||||
diff --git a/server/process.c b/server/process.c
|
||||
index 406167e825b..5d1248d7c4d 100644
|
||||
index 7875db09801..d7334ffc959 100644
|
||||
--- a/server/process.c
|
||||
+++ b/server/process.c
|
||||
@@ -1086,6 +1086,14 @@ int set_process_debug_flag( struct process *process, int flag )
|
||||
@ -93,7 +93,7 @@ index 406167e825b..5d1248d7c4d 100644
|
||||
DECL_HANDLER(new_process)
|
||||
{
|
||||
diff --git a/server/process.h b/server/process.h
|
||||
index fb29f21cb12..d0b7ec4987b 100644
|
||||
index 3944a67d571..3cbf70fda21 100644
|
||||
--- a/server/process.h
|
||||
+++ b/server/process.h
|
||||
@@ -129,6 +129,7 @@ extern void kill_console_processes( struct thread *renderer, int exit_code );
|
||||
@ -103,12 +103,12 @@ index fb29f21cb12..d0b7ec4987b 100644
|
||||
+extern void replace_process_token( struct process *process, struct token *token );
|
||||
|
||||
/* console functions */
|
||||
extern void inherit_console( struct thread *parent_thread, struct process *parent,
|
||||
extern obj_handle_t inherit_console( struct thread *parent_thread, struct process *parent,
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index dbc80b2d673..ed60a8da7df 100644
|
||||
index b84d1d10004..65bcb99d486 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -3567,6 +3567,13 @@ struct handle_info
|
||||
@@ -3526,6 +3526,13 @@ struct handle_info
|
||||
@END
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "03e9de4920173d3fa955cf28a8d2b60bd3b06261"
|
||||
echo "447bce4117a58910690a0d2610ebcbdd49ae9127"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -5356,29 +5356,18 @@ fi
|
||||
# | * [#42675] Overwatch: Phantom mouse input / view pulled up to ceiling
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/dinput/device_private.h, dlls/dinput/dinput_main.c, dlls/dinput/dinput_private.h, dlls/dinput/mouse.c,
|
||||
# | dlls/dinput8/tests/device.c, dlls/user32/input.c, dlls/user32/rawinput.c, dlls/user32/user32.spec,
|
||||
# | dlls/wineandroid.drv/keyboard.c, dlls/wineandroid.drv/window.c, dlls/winemac.drv/ime.c, dlls/winemac.drv/keyboard.c,
|
||||
# | dlls/winemac.drv/mouse.c, dlls/winex11.drv/event.c, dlls/winex11.drv/keyboard.c, dlls/winex11.drv/mouse.c,
|
||||
# | dlls/winex11.drv/x11drv.h, dlls/winex11.drv/x11drv_main.c, include/winuser.h, server/protocol.def, server/queue.c
|
||||
# | * dlls/user32/input.c, dlls/user32/user32.spec, dlls/wineandroid.drv/keyboard.c, dlls/wineandroid.drv/window.c,
|
||||
# | dlls/winemac.drv/ime.c, dlls/winemac.drv/keyboard.c, dlls/winemac.drv/mouse.c, dlls/winex11.drv/event.c,
|
||||
# | dlls/winex11.drv/keyboard.c, dlls/winex11.drv/mouse.c, dlls/winex11.drv/x11drv.h, dlls/winex11.drv/x11drv_main.c,
|
||||
# | include/winuser.h, server/protocol.def, server/queue.c
|
||||
# |
|
||||
if test "$enable_user32_rawinput_mouse" -eq 1; then
|
||||
patch_apply user32-rawinput-mouse/0001-user32-Implement-GetRegisteredRawInputDevices.patch
|
||||
patch_apply user32-rawinput-mouse/0002-dinput8-tests-Add-DISCL_EXCLUSIVE-rawinput-test.patch
|
||||
patch_apply user32-rawinput-mouse/0003-dinput8-Add-support-for-rawinput-based-devices.patch
|
||||
patch_apply user32-rawinput-mouse/0004-dinput8-Use-rawinput-interface-for-mouse-device.patch
|
||||
patch_apply user32-rawinput-mouse/0005-dinput8-Stop-using-LL-hooks-for-mouse-devices.patch
|
||||
patch_apply user32-rawinput-mouse/0006-server-Add-send_hardware_message-flags-for-rawinput-.patch
|
||||
patch_apply user32-rawinput-mouse/0007-user32-Add-__wine_send_input-flags-to-hint-raw-input.patch
|
||||
patch_apply user32-rawinput-mouse/0008-winex11.drv-Advertise-XInput2-version-2.1-support.patch
|
||||
patch_apply user32-rawinput-mouse/0009-winex11.drv-Keep-track-of-pointer-and-device-button-.patch
|
||||
patch_apply user32-rawinput-mouse/0010-winex11.drv-Listen-to-RawMotion-and-RawButton-events.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Rémi Bernon", "user32: Implement GetRegisteredRawInputDevices.", 1 },';
|
||||
printf '%s\n' '+ { "Rémi Bernon", "dinput8/tests: Add DISCL_EXCLUSIVE / rawinput test.", 1 },';
|
||||
printf '%s\n' '+ { "Rémi Bernon", "dinput8: Add support for rawinput based devices.", 1 },';
|
||||
printf '%s\n' '+ { "Rémi Bernon", "dinput8: Use rawinput interface for mouse device.", 1 },';
|
||||
printf '%s\n' '+ { "Rémi Bernon", "dinput8: Stop using LL hooks for mouse devices.", 1 },';
|
||||
printf '%s\n' '+ { "Rémi Bernon", "server: Add send_hardware_message flags for rawinput translation.", 1 },';
|
||||
printf '%s\n' '+ { "Rémi Bernon", "user32: Add __wine_send_input flags to hint raw input translation.", 1 },';
|
||||
printf '%s\n' '+ { "Rémi Bernon", "winex11.drv: Advertise XInput2 version 2.1 support.", 1 },';
|
||||
|
@ -1,204 +0,0 @@
|
||||
From 731ba2fb44187652810a106fe369d6b557ec039f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Mon, 26 Aug 2019 16:06:58 +0200
|
||||
Subject: [PATCH] user32: Implement GetRegisteredRawInputDevices.
|
||||
|
||||
---
|
||||
dlls/dinput8/tests/device.c | 13 ---------
|
||||
dlls/user32/rawinput.c | 55 +++++++++++++++++++++++++++++++++++--
|
||||
server/protocol.def | 6 ++++
|
||||
server/queue.c | 24 ++++++++++++++++
|
||||
4 files changed, 83 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
|
||||
index 39c635f2fb9..328174e5796 100644
|
||||
--- a/dlls/dinput8/tests/device.c
|
||||
+++ b/dlls/dinput8/tests/device.c
|
||||
@@ -602,7 +602,6 @@ static void test_mouse_keyboard(void)
|
||||
|
||||
raw_devices_count = ARRAY_SIZE(raw_devices);
|
||||
GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
|
||||
- todo_wine
|
||||
ok(raw_devices_count == 0, "Unexpected raw devices registered: %d\n", raw_devices_count);
|
||||
|
||||
hr = IDirectInputDevice8_Acquire(di_keyboard);
|
||||
@@ -624,7 +623,6 @@ static void test_mouse_keyboard(void)
|
||||
ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
|
||||
raw_devices_count = ARRAY_SIZE(raw_devices);
|
||||
GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
|
||||
- todo_wine
|
||||
ok(raw_devices_count == 0, "Unexpected raw devices registered: %d\n", raw_devices_count);
|
||||
|
||||
if (raw_devices[0].hwndTarget != NULL)
|
||||
@@ -662,7 +660,6 @@ static void test_mouse_keyboard(void)
|
||||
ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
|
||||
raw_devices_count = ARRAY_SIZE(raw_devices);
|
||||
GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
|
||||
- todo_wine
|
||||
ok(raw_devices_count == 0, "Unexpected raw devices registered: %d\n", raw_devices_count);
|
||||
|
||||
/* expect dinput8 to take over any activated raw input devices */
|
||||
@@ -689,26 +686,18 @@ static void test_mouse_keyboard(void)
|
||||
raw_devices_count = ARRAY_SIZE(raw_devices);
|
||||
memset(raw_devices, 0, sizeof(raw_devices));
|
||||
hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
|
||||
- todo_wine
|
||||
ok(hr == 3, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
|
||||
- todo_wine
|
||||
ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
|
||||
- todo_wine
|
||||
ok(raw_devices[0].usUsage == 2, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
|
||||
todo_wine
|
||||
ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
|
||||
todo_wine
|
||||
ok(raw_devices[0].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
|
||||
- todo_wine
|
||||
ok(raw_devices[1].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[1].usUsagePage);
|
||||
- todo_wine
|
||||
ok(raw_devices[1].usUsage == 5, "Unexpected raw device usage: %x\n", raw_devices[1].usUsage);
|
||||
ok(raw_devices[1].dwFlags == 0, "Unexpected raw device flags: %x\n", raw_devices[1].dwFlags);
|
||||
- todo_wine
|
||||
ok(raw_devices[1].hwndTarget == hwnd, "Unexpected raw device target: %p\n", raw_devices[1].hwndTarget);
|
||||
- todo_wine
|
||||
ok(raw_devices[2].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[1].usUsagePage);
|
||||
- todo_wine
|
||||
ok(raw_devices[2].usUsage == 6, "Unexpected raw device usage: %x\n", raw_devices[1].usUsage);
|
||||
todo_wine
|
||||
ok(raw_devices[2].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[1].dwFlags);
|
||||
@@ -727,12 +716,10 @@ static void test_mouse_keyboard(void)
|
||||
hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
|
||||
todo_wine
|
||||
ok(hr == 1, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
|
||||
- todo_wine
|
||||
ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
|
||||
todo_wine
|
||||
ok(raw_devices[0].usUsage == 5, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
|
||||
ok(raw_devices[0].dwFlags == 0, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
|
||||
- todo_wine
|
||||
ok(raw_devices[0].hwndTarget == hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
|
||||
|
||||
IDirectInputDevice8_Release(di_mouse);
|
||||
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
|
||||
index b5af008e885..43da5248faf 100644
|
||||
--- a/dlls/user32/rawinput.c
|
||||
+++ b/dlls/user32/rawinput.c
|
||||
@@ -732,14 +732,65 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
|
||||
return *data_size;
|
||||
}
|
||||
|
||||
+static int compare_raw_input_devices(const void *ap, const void *bp)
|
||||
+{
|
||||
+ const RAWINPUTDEVICE a = *(const RAWINPUTDEVICE *)ap;
|
||||
+ const RAWINPUTDEVICE b = *(const RAWINPUTDEVICE *)bp;
|
||||
+
|
||||
+ if (a.usUsagePage != b.usUsagePage) return a.usUsagePage - b.usUsagePage;
|
||||
+ if (a.usUsage != b.usUsage) return a.usUsage - b.usUsage;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/***********************************************************************
|
||||
* GetRegisteredRawInputDevices (USER32.@)
|
||||
*/
|
||||
UINT WINAPI DECLSPEC_HOTPATCH GetRegisteredRawInputDevices(RAWINPUTDEVICE *devices, UINT *device_count, UINT size)
|
||||
{
|
||||
- FIXME("devices %p, device_count %p, size %u stub!\n", devices, device_count, size);
|
||||
+ struct rawinput_device *d = NULL;
|
||||
+ unsigned int count = ~0U;
|
||||
|
||||
- return 0;
|
||||
+ TRACE("devices %p, device_count %p, size %u\n", devices, device_count, size);
|
||||
+
|
||||
+ if (!device_count)
|
||||
+ {
|
||||
+ SetLastError(ERROR_INVALID_PARAMETER);
|
||||
+ return ~0U;
|
||||
+ }
|
||||
+
|
||||
+ if (devices && !(d = HeapAlloc( GetProcessHeap(), 0, *device_count * sizeof(*d) )))
|
||||
+ return ~0U;
|
||||
+
|
||||
+ SERVER_START_REQ( get_rawinput_devices )
|
||||
+ {
|
||||
+ if (d)
|
||||
+ wine_server_set_reply( req, d, *device_count * sizeof(*d) );
|
||||
+
|
||||
+ if (wine_server_call( req ))
|
||||
+ goto done;
|
||||
+
|
||||
+ if (!d || reply->device_count > *device_count)
|
||||
+ {
|
||||
+ *device_count = reply->device_count;
|
||||
+ SetLastError( ERROR_INSUFFICIENT_BUFFER );
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
+ for (count = 0; count < reply->device_count; ++count)
|
||||
+ {
|
||||
+ devices[count].usUsagePage = d[count].usage_page;
|
||||
+ devices[count].usUsage = d[count].usage;
|
||||
+ devices[count].dwFlags = d[count].flags;
|
||||
+ devices[count].hwndTarget = wine_server_ptr_handle(d[count].target);
|
||||
+ }
|
||||
+ }
|
||||
+ SERVER_END_REQ;
|
||||
+
|
||||
+ qsort(devices, count, sizeof(*devices), compare_raw_input_devices);
|
||||
+
|
||||
+done:
|
||||
+ if (d) HeapFree( GetProcessHeap(), 0, d );
|
||||
+ return count;
|
||||
}
|
||||
|
||||
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index 6416306c0a1..56fda14932d 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -3899,6 +3899,12 @@ struct handle_info
|
||||
VARARG(devices,rawinput_devices);
|
||||
@END
|
||||
|
||||
+/* Retrieve the list of registered rawinput devices */
|
||||
+@REQ(get_rawinput_devices)
|
||||
+@REPLY
|
||||
+ unsigned int device_count;
|
||||
+ VARARG(devices,rawinput_devices);
|
||||
+@END
|
||||
|
||||
/* Create a new job object */
|
||||
@REQ(create_job)
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index 432885f9e4c..ff9e703d1ff 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -3283,3 +3283,27 @@ DECL_HANDLER(update_rawinput_devices)
|
||||
e = find_rawinput_device( 1, 6 );
|
||||
current->process->rawinput_kbd = e ? &e->device : NULL;
|
||||
}
|
||||
+
|
||||
+DECL_HANDLER(get_rawinput_devices)
|
||||
+{
|
||||
+ unsigned int device_count = list_count(¤t->process->rawinput_devices);
|
||||
+ struct rawinput_device *devices;
|
||||
+ struct rawinput_device_entry *e;
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ reply->device_count = device_count;
|
||||
+ if (get_reply_max_size() / sizeof (*devices) < device_count)
|
||||
+ return;
|
||||
+
|
||||
+ if (!(devices = mem_alloc( device_count * sizeof (*devices) )))
|
||||
+ {
|
||||
+ set_error( STATUS_NO_MEMORY );
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ i = 0;
|
||||
+ LIST_FOR_EACH_ENTRY( e, ¤t->process->rawinput_devices, struct rawinput_device_entry, entry )
|
||||
+ devices[i++] = e->device;
|
||||
+
|
||||
+ set_reply_data_ptr( devices, device_count * sizeof (*devices) );
|
||||
+}
|
||||
--
|
||||
2.27.0
|
||||
|
@ -1,43 +0,0 @@
|
||||
From bf43da52a7e4716fef9c99b731d530543948d3ac 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] dinput8/tests: Add DISCL_EXCLUSIVE / rawinput test.
|
||||
|
||||
---
|
||||
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 328174e5796..6fe9a635510 100644
|
||||
--- a/dlls/dinput8/tests/device.c
|
||||
+++ b/dlls/dinput8/tests/device.c
|
||||
@@ -712,6 +712,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.27.0
|
||||
|
@ -1,172 +0,0 @@
|
||||
From 11344cc9631192fa0bb5a3d90f5956c09ec67991 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Mon, 26 Aug 2019 16:06:59 +0200
|
||||
Subject: [PATCH] dinput8: Add support for rawinput based devices.
|
||||
|
||||
This adds a global message window that will receive WM_INPUT messages.
|
||||
|
||||
Devices that use rawinput will conflict with any rawinput device
|
||||
registered outside of dinput, as exposed by the unit tests.
|
||||
---
|
||||
dlls/dinput/device_private.h | 3 ++
|
||||
dlls/dinput/dinput_main.c | 80 ++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 83 insertions(+)
|
||||
|
||||
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h
|
||||
index fe5644f21c7..2fac4f0e61e 100644
|
||||
--- a/dlls/dinput/device_private.h
|
||||
+++ b/dlls/dinput/device_private.h
|
||||
@@ -69,6 +69,9 @@ struct IDirectInputDeviceImpl
|
||||
HWND win;
|
||||
int acquired;
|
||||
|
||||
+ BOOL use_raw_input; /* use raw input instead of low-level messages */
|
||||
+ RAWINPUTDEVICE raw_device; /* raw device to (un)register */
|
||||
+
|
||||
LPDIDEVICEOBJECTDATA data_queue; /* buffer for 'GetDeviceData'. */
|
||||
int queue_len; /* valid size of the queue */
|
||||
int queue_head; /* position to write new event into queue */
|
||||
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
|
||||
index 2e561502406..d0937d35e5b 100644
|
||||
--- a/dlls/dinput/dinput_main.c
|
||||
+++ b/dlls/dinput/dinput_main.c
|
||||
@@ -97,6 +97,10 @@ static const struct dinput_device *dinput_devices[] =
|
||||
|
||||
HINSTANCE DINPUT_instance;
|
||||
|
||||
+static ATOM di_em_win_class;
|
||||
+static const WCHAR di_em_winW[] = {'D','I','E','m','W','i','n',0};
|
||||
+static HWND di_em_win;
|
||||
+
|
||||
static BOOL check_hook_thread(void);
|
||||
static CRITICAL_SECTION dinput_hook_crit;
|
||||
static struct list direct_input_list = LIST_INIT( direct_input_list );
|
||||
@@ -637,6 +641,47 @@ static HRESULT WINAPI IDirectInputWImpl_QueryInterface(LPDIRECTINPUT7W iface, RE
|
||||
return IDirectInputAImpl_QueryInterface( &This->IDirectInput7A_iface, riid, ppobj );
|
||||
}
|
||||
|
||||
+static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
+{
|
||||
+ IDirectInputDeviceImpl *dev;
|
||||
+ RAWINPUT ri;
|
||||
+ UINT size = sizeof(ri);
|
||||
+ int rim = GET_RAWINPUT_CODE_WPARAM(wparam);
|
||||
+
|
||||
+ TRACE( "%p %d %lx %lx\n", hwnd, msg, wparam, lparam );
|
||||
+
|
||||
+ if (msg == WM_INPUT && (rim == RIM_INPUT || rim == RIM_INPUTSINK))
|
||||
+ {
|
||||
+ if (GetRawInputData( (HRAWINPUT)lparam, RID_INPUT, &ri, &size, sizeof(RAWINPUTHEADER) ) > sizeof(ri))
|
||||
+ WARN( "Unable to read raw input data\n" );
|
||||
+ }
|
||||
+
|
||||
+ return DefWindowProcW(hwnd, msg, wparam, lparam);
|
||||
+}
|
||||
+
|
||||
+static void register_di_em_win_class(void)
|
||||
+{
|
||||
+ static WNDCLASSEXW class;
|
||||
+
|
||||
+ ZeroMemory(&class, sizeof(class));
|
||||
+ class.cbSize = sizeof(class);
|
||||
+ class.lpfnWndProc = di_em_win_wndproc;
|
||||
+ class.hInstance = DINPUT_instance;
|
||||
+ class.lpszClassName = di_em_winW;
|
||||
+
|
||||
+ if (!(di_em_win_class = RegisterClassExW( &class )))
|
||||
+ WARN( "Unable to register message window class\n" );
|
||||
+}
|
||||
+
|
||||
+static void unregister_di_em_win_class(void)
|
||||
+{
|
||||
+ if (!di_em_win_class)
|
||||
+ return;
|
||||
+
|
||||
+ if (!UnregisterClassW( MAKEINTRESOURCEW( di_em_win_class ), DINPUT_instance ))
|
||||
+ WARN( "Unable to unregister message window class\n" );
|
||||
+}
|
||||
+
|
||||
static HRESULT initialize_directinput_instance(IDirectInputImpl *This, DWORD dwVersion)
|
||||
{
|
||||
if (!This->initialized)
|
||||
@@ -1668,11 +1713,13 @@ static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam )
|
||||
EnterCriticalSection( &dinput_hook_crit );
|
||||
LIST_FOR_EACH_ENTRY( dev, &acquired_mouse_list, IDirectInputDeviceImpl, entry )
|
||||
{
|
||||
+ if (dev->use_raw_input) continue;
|
||||
TRACE("calling dinput_mouse_hook (%p %lx %lx)\n", dev, wparam, lparam);
|
||||
skip |= dinput_mouse_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam );
|
||||
}
|
||||
LIST_FOR_EACH_ENTRY( dev, &acquired_keyboard_list, IDirectInputDeviceImpl, entry )
|
||||
{
|
||||
+ if (dev->use_raw_input) continue;
|
||||
TRACE("calling dinput_keyboard_hook (%p %lx %lx)\n", dev, wparam, lparam);
|
||||
skip |= dinput_keyboard_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam );
|
||||
}
|
||||
@@ -1728,6 +1775,9 @@ static DWORD WINAPI hook_thread_proc(void *param)
|
||||
static HHOOK kbd_hook, mouse_hook;
|
||||
MSG msg;
|
||||
|
||||
+ di_em_win = CreateWindowW( MAKEINTRESOURCEW(di_em_win_class), di_em_winW,
|
||||
+ 0, 0, 0, 0, 0, HWND_MESSAGE, 0, DINPUT_instance, NULL );
|
||||
+
|
||||
/* Force creation of the message queue */
|
||||
PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE );
|
||||
SetEvent(param);
|
||||
@@ -1778,6 +1828,9 @@ static DWORD WINAPI hook_thread_proc(void *param)
|
||||
DispatchMessageW(&msg);
|
||||
}
|
||||
|
||||
+ DestroyWindow( di_em_win );
|
||||
+ di_em_win = NULL;
|
||||
+
|
||||
FreeLibraryAndExitThread(DINPUT_instance, 0);
|
||||
}
|
||||
|
||||
@@ -1860,6 +1913,31 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
|
||||
hook_thread_event = NULL;
|
||||
}
|
||||
|
||||
+ if (dev->use_raw_input)
|
||||
+ {
|
||||
+ if (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.dwFlags |= RIDEV_NOLEGACY;
|
||||
+ if ((dev->dwCoopLevel & DISCL_EXCLUSIVE) && dev->raw_device.usUsage == 2)
|
||||
+ dev->raw_device.dwFlags |= RIDEV_CAPTUREMOUSE;
|
||||
+ if ((dev->dwCoopLevel & DISCL_EXCLUSIVE) && dev->raw_device.usUsage == 6)
|
||||
+ dev->raw_device.dwFlags |= RIDEV_NOHOTKEYS;
|
||||
+ dev->raw_device.hwndTarget = di_em_win;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ dev->raw_device.dwFlags = RIDEV_REMOVE;
|
||||
+ dev->raw_device.hwndTarget = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (!RegisterRawInputDevices( &dev->raw_device, 1, sizeof(RAWINPUTDEVICE) ))
|
||||
+ WARN( "Unable to (un)register raw device %x:%x\n", dev->raw_device.usUsagePage, dev->raw_device.usUsage );
|
||||
+ }
|
||||
+
|
||||
if (acquired)
|
||||
hook_change_finished_event = CreateEventW( NULL, FALSE, FALSE, NULL );
|
||||
PostThreadMessageW( hook_thread_id, WM_USER+0x10, 1, (LPARAM)hook_change_finished_event );
|
||||
@@ -1894,9 +1972,11 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved)
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DisableThreadLibraryCalls(inst);
|
||||
DINPUT_instance = inst;
|
||||
+ register_di_em_win_class();
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
if (reserved) break;
|
||||
+ unregister_di_em_win_class();
|
||||
DeleteCriticalSection(&dinput_hook_crit);
|
||||
break;
|
||||
}
|
||||
--
|
||||
2.27.0
|
||||
|
@ -1,210 +0,0 @@
|
||||
From 73273d9d13a1cbf6eff1e1e26164f9db11d00377 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Mon, 26 Aug 2019 16:06:59 +0200
|
||||
Subject: [PATCH] dinput8: Use rawinput interface for mouse device.
|
||||
|
||||
---
|
||||
dlls/dinput/dinput_main.c | 10 ++++
|
||||
dlls/dinput/dinput_private.h | 1 +
|
||||
dlls/dinput/mouse.c | 90 ++++++++++++++++++++++++++++++++++++
|
||||
dlls/dinput8/tests/device.c | 11 ++---
|
||||
4 files changed, 104 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
|
||||
index d0937d35e5b..c333ed7d3d0 100644
|
||||
--- a/dlls/dinput/dinput_main.c
|
||||
+++ b/dlls/dinput/dinput_main.c
|
||||
@@ -654,6 +654,16 @@ static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR
|
||||
{
|
||||
if (GetRawInputData( (HRAWINPUT)lparam, RID_INPUT, &ri, &size, sizeof(RAWINPUTHEADER) ) > sizeof(ri))
|
||||
WARN( "Unable to read raw input data\n" );
|
||||
+ else if (ri.header.dwType == RIM_TYPEMOUSE)
|
||||
+ {
|
||||
+ EnterCriticalSection( &dinput_hook_crit );
|
||||
+ LIST_FOR_EACH_ENTRY( dev, &acquired_mouse_list, IDirectInputDeviceImpl, entry )
|
||||
+ {
|
||||
+ if (!dev->use_raw_input) continue;
|
||||
+ dinput_mouse_rawinput_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam, &ri );
|
||||
+ }
|
||||
+ LeaveCriticalSection( &dinput_hook_crit );
|
||||
+ }
|
||||
}
|
||||
|
||||
return DefWindowProcW(hwnd, msg, wparam, lparam);
|
||||
diff --git a/dlls/dinput/dinput_private.h b/dlls/dinput/dinput_private.h
|
||||
index 06a439d6a41..c0c88da9674 100644
|
||||
--- a/dlls/dinput/dinput_private.h
|
||||
+++ b/dlls/dinput/dinput_private.h
|
||||
@@ -73,6 +73,7 @@ extern void dinput_hooks_acquire_device(LPDIRECTINPUTDEVICE8W iface);
|
||||
extern void dinput_hooks_unacquire_device(LPDIRECTINPUTDEVICE8W iface);
|
||||
extern int dinput_mouse_hook(LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam);
|
||||
extern int dinput_keyboard_hook(LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam);
|
||||
+extern void dinput_mouse_rawinput_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam, RAWINPUT *raw );
|
||||
|
||||
extern void check_dinput_hooks(LPDIRECTINPUTDEVICE8W, BOOL) DECLSPEC_HIDDEN;
|
||||
extern void check_dinput_events(void) DECLSPEC_HIDDEN;
|
||||
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
|
||||
index 5e6f34f0eca..429271e8f43 100644
|
||||
--- a/dlls/dinput/mouse.c
|
||||
+++ b/dlls/dinput/mouse.c
|
||||
@@ -239,6 +239,13 @@ static SysMouseImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput)
|
||||
newDevice->base.data_format.wine_df = df;
|
||||
IDirectInput_AddRef(&newDevice->base.dinput->IDirectInput7A_iface);
|
||||
|
||||
+ if (dinput->dwVersion >= 0x0800)
|
||||
+ {
|
||||
+ newDevice->base.use_raw_input = TRUE;
|
||||
+ newDevice->base.raw_device.usUsagePage = 1; /* HID generic device page */
|
||||
+ newDevice->base.raw_device.usUsage = 2; /* HID generic mouse */
|
||||
+ }
|
||||
+
|
||||
return newDevice;
|
||||
|
||||
failed:
|
||||
@@ -306,6 +313,89 @@ const struct dinput_device mouse_device = {
|
||||
* SysMouseA (DInput Mouse support)
|
||||
*/
|
||||
|
||||
+void dinput_mouse_rawinput_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam, RAWINPUT *ri )
|
||||
+{
|
||||
+ SysMouseImpl* This = impl_from_IDirectInputDevice8A(iface);
|
||||
+ POINT rel, pt;
|
||||
+ DWORD seq;
|
||||
+ int i, wdata = 0;
|
||||
+
|
||||
+ static const USHORT mouse_button_flags[] =
|
||||
+ {
|
||||
+ RI_MOUSE_BUTTON_1_DOWN, RI_MOUSE_BUTTON_1_UP,
|
||||
+ RI_MOUSE_BUTTON_2_DOWN, RI_MOUSE_BUTTON_2_UP,
|
||||
+ RI_MOUSE_BUTTON_3_DOWN, RI_MOUSE_BUTTON_3_UP,
|
||||
+ RI_MOUSE_BUTTON_4_DOWN, RI_MOUSE_BUTTON_4_UP,
|
||||
+ RI_MOUSE_BUTTON_5_DOWN, RI_MOUSE_BUTTON_5_UP
|
||||
+ };
|
||||
+
|
||||
+ TRACE("(%p) wp %08lx, lp %08lx\n", iface, wparam, lparam);
|
||||
+
|
||||
+ if (ri->data.mouse.usFlags & MOUSE_VIRTUAL_DESKTOP)
|
||||
+ FIXME( "Unimplemented MOUSE_VIRTUAL_DESKTOP flag\n" );
|
||||
+ if (ri->data.mouse.usFlags & MOUSE_ATTRIBUTES_CHANGED)
|
||||
+ FIXME( "Unimplemented MOUSE_ATTRIBUTES_CHANGED flag\n" );
|
||||
+
|
||||
+ EnterCriticalSection(&This->base.crit);
|
||||
+ seq = This->base.dinput->evsequence++;
|
||||
+
|
||||
+ rel.x = ri->data.mouse.lLastX;
|
||||
+ rel.y = ri->data.mouse.lLastY;
|
||||
+ if (ri->data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE)
|
||||
+ {
|
||||
+ GetCursorPos(&pt);
|
||||
+ rel.x -= pt.x;
|
||||
+ rel.y -= pt.y;
|
||||
+ }
|
||||
+
|
||||
+ This->m_state.lX += rel.x;
|
||||
+ This->m_state.lY += rel.y;
|
||||
+
|
||||
+ if (This->base.data_format.user_df->dwFlags & DIDF_ABSAXIS)
|
||||
+ {
|
||||
+ pt.x = This->m_state.lX;
|
||||
+ pt.y = This->m_state.lY;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ pt = rel;
|
||||
+ }
|
||||
+
|
||||
+ if (rel.x)
|
||||
+ queue_event(iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
||||
+ pt.x, GetCurrentTime(), seq);
|
||||
+
|
||||
+ if (rel.y)
|
||||
+ queue_event(iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
||||
+ pt.y, GetCurrentTime(), seq);
|
||||
+
|
||||
+ if (rel.x || rel.y)
|
||||
+ {
|
||||
+ if ((This->warp_override == WARP_FORCE_ON) ||
|
||||
+ (This->warp_override != WARP_DISABLE && (This->base.dwCoopLevel & DISCL_EXCLUSIVE)))
|
||||
+ This->need_warp = TRUE;
|
||||
+ }
|
||||
+
|
||||
+ if (ri->data.mouse.usButtonFlags & RI_MOUSE_WHEEL)
|
||||
+ {
|
||||
+ This->m_state.lZ += (wdata = (SHORT)ri->data.mouse.usButtonData);
|
||||
+ queue_event(iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
||||
+ wdata, GetCurrentTime(), seq);
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(mouse_button_flags); ++i)
|
||||
+ {
|
||||
+ if (ri->data.mouse.usButtonFlags & mouse_button_flags[i])
|
||||
+ {
|
||||
+ This->m_state.rgbButtons[i / 2] = 0x80 - (i % 2) * 0x80;
|
||||
+ queue_event(iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_BUTTONS_INSTANCE + (i / 2)) | DIDFT_PSHBUTTON,
|
||||
+ This->m_state.rgbButtons[i / 2], GetCurrentTime(), seq);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ LeaveCriticalSection(&This->base.crit);
|
||||
+}
|
||||
+
|
||||
/* low-level mouse hook */
|
||||
int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam )
|
||||
{
|
||||
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
|
||||
index 6fe9a635510..80a7fe26c3b 100644
|
||||
--- a/dlls/dinput8/tests/device.c
|
||||
+++ b/dlls/dinput8/tests/device.c
|
||||
@@ -646,13 +646,9 @@ static void test_mouse_keyboard(void)
|
||||
raw_devices_count = ARRAY_SIZE(raw_devices);
|
||||
memset(raw_devices, 0, sizeof(raw_devices));
|
||||
hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
|
||||
- todo_wine
|
||||
ok(hr == 1, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
|
||||
- todo_wine
|
||||
ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
|
||||
- todo_wine
|
||||
ok(raw_devices[0].usUsage == 2, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
|
||||
- todo_wine
|
||||
ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
|
||||
todo_wine
|
||||
ok(raw_devices[0].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
|
||||
@@ -662,6 +658,9 @@ static void test_mouse_keyboard(void)
|
||||
GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
|
||||
ok(raw_devices_count == 0, "Unexpected raw devices registered: %d\n", raw_devices_count);
|
||||
|
||||
+ if (raw_devices[0].hwndTarget != NULL)
|
||||
+ di_hwnd = raw_devices[0].hwndTarget;
|
||||
+
|
||||
/* expect dinput8 to take over any activated raw input devices */
|
||||
raw_devices[0].usUsagePage = 0x01;
|
||||
raw_devices[0].usUsage = 0x05;
|
||||
@@ -689,9 +688,7 @@ static void test_mouse_keyboard(void)
|
||||
ok(hr == 3, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
|
||||
ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
|
||||
ok(raw_devices[0].usUsage == 2, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
|
||||
- todo_wine
|
||||
ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
|
||||
- todo_wine
|
||||
ok(raw_devices[0].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
|
||||
ok(raw_devices[1].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[1].usUsagePage);
|
||||
ok(raw_devices[1].usUsage == 5, "Unexpected raw device usage: %x\n", raw_devices[1].usUsage);
|
||||
@@ -723,7 +720,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);
|
||||
@@ -737,7 +733,6 @@ static void test_mouse_keyboard(void)
|
||||
todo_wine
|
||||
ok(hr == 1, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
|
||||
ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
|
||||
- todo_wine
|
||||
ok(raw_devices[0].usUsage == 5, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
|
||||
ok(raw_devices[0].dwFlags == 0, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
|
||||
ok(raw_devices[0].hwndTarget == hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
|
||||
--
|
||||
2.27.0
|
||||
|
@ -1,74 +0,0 @@
|
||||
From f34628aa587c0b3f193301145a446dfe792ef8df Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Sat, 6 Jun 2020 11:46:24 +0200
|
||||
Subject: [PATCH] dinput8: Stop using LL hooks for mouse devices.
|
||||
|
||||
LL hooks are heavy and using them cause performance hit with high
|
||||
polling rate mice. We don't need them anymore since we now use rawinput
|
||||
API for mouse device.
|
||||
|
||||
This also uses a separate list for rawinput mouse devices.
|
||||
---
|
||||
dlls/dinput/dinput_main.c | 17 +++++++++++------
|
||||
1 file changed, 11 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
|
||||
index c333ed7d3d0..5e03964f901 100644
|
||||
--- a/dlls/dinput/dinput_main.c
|
||||
+++ b/dlls/dinput/dinput_main.c
|
||||
@@ -105,6 +105,7 @@ static BOOL check_hook_thread(void);
|
||||
static CRITICAL_SECTION dinput_hook_crit;
|
||||
static struct list direct_input_list = LIST_INIT( direct_input_list );
|
||||
static struct list acquired_mouse_list = LIST_INIT( acquired_mouse_list );
|
||||
+static struct list acquired_rawmouse_list = LIST_INIT( acquired_rawmouse_list );
|
||||
static struct list acquired_keyboard_list = LIST_INIT( acquired_keyboard_list );
|
||||
static struct list acquired_device_list = LIST_INIT( acquired_device_list );
|
||||
|
||||
@@ -117,7 +118,7 @@ void dinput_hooks_acquire_device(LPDIRECTINPUTDEVICE8W iface)
|
||||
|
||||
EnterCriticalSection( &dinput_hook_crit );
|
||||
if (IsEqualGUID( &dev->guid, &GUID_SysMouse ))
|
||||
- list_add_tail( &acquired_mouse_list, &dev->entry );
|
||||
+ list_add_tail( dev->use_raw_input ? &acquired_rawmouse_list : &acquired_mouse_list, &dev->entry );
|
||||
else if (IsEqualGUID( &dev->guid, &GUID_SysKeyboard ))
|
||||
list_add_tail( &acquired_keyboard_list, &dev->entry );
|
||||
else
|
||||
@@ -657,11 +658,8 @@ static LRESULT WINAPI di_em_win_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPAR
|
||||
else if (ri.header.dwType == RIM_TYPEMOUSE)
|
||||
{
|
||||
EnterCriticalSection( &dinput_hook_crit );
|
||||
- LIST_FOR_EACH_ENTRY( dev, &acquired_mouse_list, IDirectInputDeviceImpl, entry )
|
||||
- {
|
||||
- if (!dev->use_raw_input) continue;
|
||||
+ LIST_FOR_EACH_ENTRY( dev, &acquired_rawmouse_list, IDirectInputDeviceImpl, entry )
|
||||
dinput_mouse_rawinput_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam, &ri );
|
||||
- }
|
||||
LeaveCriticalSection( &dinput_hook_crit );
|
||||
}
|
||||
}
|
||||
@@ -1723,7 +1721,6 @@ static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam )
|
||||
EnterCriticalSection( &dinput_hook_crit );
|
||||
LIST_FOR_EACH_ENTRY( dev, &acquired_mouse_list, IDirectInputDeviceImpl, entry )
|
||||
{
|
||||
- if (dev->use_raw_input) continue;
|
||||
TRACE("calling dinput_mouse_hook (%p %lx %lx)\n", dev, wparam, lparam);
|
||||
skip |= dinput_mouse_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam );
|
||||
}
|
||||
@@ -1767,6 +1764,14 @@ static LRESULT CALLBACK callwndproc_proc( int code, WPARAM wparam, LPARAM lparam
|
||||
IDirectInputDevice_Unacquire( &dev->IDirectInputDevice8A_iface );
|
||||
}
|
||||
}
|
||||
+ LIST_FOR_EACH_ENTRY_SAFE( dev, next, &acquired_rawmouse_list, IDirectInputDeviceImpl, entry )
|
||||
+ {
|
||||
+ if (msg->hwnd == dev->win && msg->hwnd != foreground)
|
||||
+ {
|
||||
+ TRACE( "%p window is not foreground - unacquiring %p\n", dev->win, dev );
|
||||
+ IDirectInputDevice_Unacquire( &dev->IDirectInputDevice8A_iface );
|
||||
+ }
|
||||
+ }
|
||||
LIST_FOR_EACH_ENTRY_SAFE( dev, next, &acquired_keyboard_list, IDirectInputDeviceImpl, entry )
|
||||
{
|
||||
if (msg->hwnd == dev->win && msg->hwnd != foreground)
|
||||
--
|
||||
2.27.0
|
||||
|
@ -1 +1 @@
|
||||
03e9de4920173d3fa955cf28a8d2b60bd3b06261
|
||||
447bce4117a58910690a0d2610ebcbdd49ae9127
|
||||
|
Loading…
Reference in New Issue
Block a user