You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
user32-rawinput-*: Rebase and re-enable.
Thanks to Rémi Bernon for the rebased patch sets.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 668e30532f05ca04015a0f7afd52999cbef9f7f9 Mon Sep 17 00:00:00 2001
|
||||
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.
|
||||
@@ -11,7 +11,7 @@ Subject: [PATCH] user32: Implement GetRegisteredRawInputDevices.
|
||||
4 files changed, 83 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
|
||||
index ea5ab751098..24af7399b84 100644
|
||||
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)
|
||||
@@ -79,10 +79,10 @@ index ea5ab751098..24af7399b84 100644
|
||||
|
||||
IDirectInputDevice8_Release(di_mouse);
|
||||
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
|
||||
index 2465262f74e..7d2034e6594 100644
|
||||
index b5af008e885..43da5248faf 100644
|
||||
--- a/dlls/user32/rawinput.c
|
||||
+++ b/dlls/user32/rawinput.c
|
||||
@@ -522,14 +522,65 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
|
||||
@@ -732,14 +732,65 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
|
||||
return *data_size;
|
||||
}
|
||||
|
||||
@@ -151,12 +151,12 @@ index 2465262f74e..7d2034e6594 100644
|
||||
|
||||
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index 4ab2392771b..17e676950e8 100644
|
||||
index 6416306c0a1..56fda14932d 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -3881,6 +3881,12 @@ struct handle_info
|
||||
#define SET_CURSOR_CLIP 0x08
|
||||
#define SET_CURSOR_NOCLIP 0x10
|
||||
@@ -3899,6 +3899,12 @@ struct handle_info
|
||||
VARARG(devices,rawinput_devices);
|
||||
@END
|
||||
|
||||
+/* Retrieve the list of registered rawinput devices */
|
||||
+@REQ(get_rawinput_devices)
|
||||
@@ -165,13 +165,13 @@ index 4ab2392771b..17e676950e8 100644
|
||||
+ VARARG(devices,rawinput_devices);
|
||||
+@END
|
||||
|
||||
/* Modify the list of registered rawinput devices */
|
||||
@REQ(update_rawinput_devices)
|
||||
/* Create a new job object */
|
||||
@REQ(create_job)
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index 7c6402012ba..46905f3ce41 100644
|
||||
index 432885f9e4c..ff9e703d1ff 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -3193,3 +3193,27 @@ DECL_HANDLER(update_rawinput_devices)
|
||||
@@ -3283,3 +3283,27 @@ DECL_HANDLER(update_rawinput_devices)
|
||||
e = find_rawinput_device( 1, 6 );
|
||||
current->process->rawinput_kbd = e ? &e->device : NULL;
|
||||
}
|
||||
@@ -200,5 +200,5 @@ index 7c6402012ba..46905f3ce41 100644
|
||||
+ set_reply_data_ptr( devices, device_count * sizeof (*devices) );
|
||||
+}
|
||||
--
|
||||
2.26.0
|
||||
2.27.0
|
||||
|
@@ -0,0 +1,43 @@
|
||||
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,19 +1,16 @@
|
||||
From 7d1d098c5c456e1791bae10dd27996a62c7d993a Mon Sep 17 00:00:00 2001
|
||||
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 dinput devices that use raw input
|
||||
interface.
|
||||
Subject: [PATCH] dinput8: Add support for rawinput based devices.
|
||||
|
||||
This adds a global message window that will receive WM_INPUT messages,
|
||||
dispatched to every raw input device event_proc.
|
||||
This adds a global message window that will receive WM_INPUT messages.
|
||||
|
||||
Devices that use raw input interface will not register low-level hooks
|
||||
anymore. They will also conflict with any raw input device registered
|
||||
outside of dinput, as exposed by the unit tests.
|
||||
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 | 98 ++++++++++++++++++++++++++++++++++--
|
||||
2 files changed, 97 insertions(+), 4 deletions(-)
|
||||
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
|
||||
@@ -30,7 +27,7 @@ index fe5644f21c7..2fac4f0e61e 100644
|
||||
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..f7e30606bf4 100644
|
||||
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[] =
|
||||
@@ -44,37 +41,23 @@ index 2e561502406..f7e30606bf4 100644
|
||||
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,61 @@ static HRESULT WINAPI IDirectInputWImpl_QueryInterface(LPDIRECTINPUT7W iface, RE
|
||||
@@ -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;
|
||||
+ IDirectInputImpl *dinput;
|
||||
+ 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)
|
||||
+ if (msg == WM_INPUT && (rim == RIM_INPUT || rim == RIM_INPUTSINK))
|
||||
+ {
|
||||
+ EnterCriticalSection( &dinput_hook_crit );
|
||||
+ LIST_FOR_EACH_ENTRY( dev, &acquired_mouse_list, IDirectInputDeviceImpl, entry )
|
||||
+ {
|
||||
+ if (dev->use_raw_input)
|
||||
+ {
|
||||
+ TRACE("calling dinput_mouse_hook (%p %lx %lx)\n", dev, wparam, lparam);
|
||||
+ dinput_mouse_hook( &dev->IDirectInputDevice8A_iface, GET_RAWINPUT_CODE_WPARAM(wparam), lparam );
|
||||
+ }
|
||||
+ }
|
||||
+ LIST_FOR_EACH_ENTRY( dev, &acquired_keyboard_list, IDirectInputDeviceImpl, entry )
|
||||
+ {
|
||||
+ if (dev->use_raw_input)
|
||||
+ {
|
||||
+ TRACE("calling dinput_keyboard_hook (%p %lx %lx)\n", dev, wparam, lparam);
|
||||
+ dinput_keyboard_hook( &dev->IDirectInputDevice8A_iface, GET_RAWINPUT_CODE_WPARAM(wparam), lparam );
|
||||
+ }
|
||||
+ }
|
||||
+ LeaveCriticalSection( &dinput_hook_crit );
|
||||
+ 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);
|
||||
@@ -106,31 +89,21 @@ index 2e561502406..f7e30606bf4 100644
|
||||
static HRESULT initialize_directinput_instance(IDirectInputImpl *This, DWORD dwVersion)
|
||||
{
|
||||
if (!This->initialized)
|
||||
@@ -1668,13 +1727,19 @@ static LRESULT CALLBACK LL_hook_proc( int code, WPARAM wparam, LPARAM lparam )
|
||||
@@ -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 )
|
||||
{
|
||||
- TRACE("calling dinput_mouse_hook (%p %lx %lx)\n", dev, wparam, lparam);
|
||||
- skip |= dinput_mouse_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam );
|
||||
+ if (!dev->use_raw_input)
|
||||
+ {
|
||||
+ TRACE("calling dinput_mouse_hook (%p %lx %lx)\n", dev, wparam, lparam);
|
||||
+ skip |= dinput_mouse_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam );
|
||||
+ }
|
||||
+ 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 )
|
||||
{
|
||||
- TRACE("calling dinput_keyboard_hook (%p %lx %lx)\n", dev, wparam, lparam);
|
||||
- skip |= dinput_keyboard_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam );
|
||||
+ if (!dev->use_raw_input)
|
||||
+ {
|
||||
+ TRACE("calling dinput_keyboard_hook (%p %lx %lx)\n", dev, wparam, lparam);
|
||||
+ skip |= dinput_keyboard_hook( &dev->IDirectInputDevice8A_iface, wparam, lparam );
|
||||
+ }
|
||||
+ 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 );
|
||||
}
|
||||
LeaveCriticalSection( &dinput_hook_crit );
|
||||
|
||||
@@ -1728,6 +1793,9 @@ static DWORD WINAPI hook_thread_proc(void *param)
|
||||
@@ -1728,6 +1775,9 @@ static DWORD WINAPI hook_thread_proc(void *param)
|
||||
static HHOOK kbd_hook, mouse_hook;
|
||||
MSG msg;
|
||||
|
||||
@@ -140,7 +113,7 @@ index 2e561502406..f7e30606bf4 100644
|
||||
/* Force creation of the message queue */
|
||||
PeekMessageW( &msg, 0, 0, 0, PM_NOREMOVE );
|
||||
SetEvent(param);
|
||||
@@ -1778,6 +1846,9 @@ static DWORD WINAPI hook_thread_proc(void *param)
|
||||
@@ -1778,6 +1828,9 @@ static DWORD WINAPI hook_thread_proc(void *param)
|
||||
DispatchMessageW(&msg);
|
||||
}
|
||||
|
||||
@@ -150,7 +123,7 @@ index 2e561502406..f7e30606bf4 100644
|
||||
FreeLibraryAndExitThread(DINPUT_instance, 0);
|
||||
}
|
||||
|
||||
@@ -1860,6 +1931,23 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
|
||||
@@ -1860,6 +1913,31 @@ void check_dinput_hooks(LPDIRECTINPUTDEVICE8W iface, BOOL acquired)
|
||||
hook_thread_event = NULL;
|
||||
}
|
||||
|
||||
@@ -158,7 +131,15 @@ index 2e561502406..f7e30606bf4 100644
|
||||
+ {
|
||||
+ if (acquired)
|
||||
+ {
|
||||
+ dev->raw_device.dwFlags = RIDEV_INPUTSINK;
|
||||
+ 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
|
||||
@@ -174,7 +155,7 @@ index 2e561502406..f7e30606bf4 100644
|
||||
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 +1982,11 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved)
|
||||
@@ -1894,9 +1972,11 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved)
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DisableThreadLibraryCalls(inst);
|
||||
DINPUT_instance = inst;
|
||||
@@ -187,5 +168,5 @@ index 2e561502406..f7e30606bf4 100644
|
||||
break;
|
||||
}
|
||||
--
|
||||
2.26.2
|
||||
2.27.0
|
||||
|
@@ -0,0 +1,210 @@
|
||||
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
|
||||
|
@@ -0,0 +1,74 @@
|
||||
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,171 +0,0 @@
|
||||
From 38723990a094b598e988408149d1e04dac9b571e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Tue, 12 Nov 2019 12:41:55 +0100
|
||||
Subject: [PATCH] server: Broadcast rawinput message if request flag is
|
||||
SEND_HWMSG_RAWINPUT.
|
||||
|
||||
If the request flag is equal to SEND_HWMSG_RAWINPUT, we broadcast the
|
||||
message to all listening processes -or at least to the foreground
|
||||
process until RIDEV_INPUTSINK is supported.
|
||||
---
|
||||
server/queue.c | 101 +++++++++++++++++++++++++++++++++++++++----------
|
||||
1 file changed, 80 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index 05d7af0206f..e1a01389fcf 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -1596,12 +1596,70 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa
|
||||
return 1;
|
||||
}
|
||||
|
||||
+struct rawinput_message
|
||||
+{
|
||||
+ struct desktop *desktop;
|
||||
+ struct hw_msg_source source;
|
||||
+ unsigned int time;
|
||||
+ struct hardware_msg_data data;
|
||||
+};
|
||||
+
|
||||
+static int queue_rawinput_message( struct process* process, void* user )
|
||||
+{
|
||||
+ const struct rawinput_message* raw_msg = user;
|
||||
+ const struct rawinput_device *device = NULL;
|
||||
+ struct desktop *desktop = NULL;
|
||||
+ struct thread *thread = NULL, *foreground = NULL;
|
||||
+ struct message *msg;
|
||||
+
|
||||
+ if (raw_msg->data.rawinput.type == RIM_TYPEMOUSE)
|
||||
+ device = process->rawinput_mouse;
|
||||
+ else if (raw_msg->data.rawinput.type == RIM_TYPEKEYBOARD)
|
||||
+ device = process->rawinput_kbd;
|
||||
+
|
||||
+ if (!device)
|
||||
+ goto done;
|
||||
+
|
||||
+ if (!(desktop = get_desktop_obj( process, process->desktop, 0 )) ||
|
||||
+ (raw_msg->desktop && desktop != raw_msg->desktop))
|
||||
+ goto done;
|
||||
+
|
||||
+ if (!device->target && !desktop->foreground_input)
|
||||
+ goto done;
|
||||
+
|
||||
+ if (!(thread = get_window_thread( device->target ? device->target : desktop->foreground_input->active )) ||
|
||||
+ process != thread->process)
|
||||
+ goto done;
|
||||
+
|
||||
+ /* FIXME: Implement RIDEV_INPUTSINK */
|
||||
+ if (!desktop->foreground_input || !(foreground = get_window_thread( desktop->foreground_input->active )) ||
|
||||
+ thread->process != foreground->process)
|
||||
+ goto done;
|
||||
+
|
||||
+ if (!(msg = alloc_hardware_message( raw_msg->data.info, raw_msg->source, raw_msg->time )))
|
||||
+ goto done;
|
||||
+
|
||||
+ msg->win = device->target;
|
||||
+ msg->msg = WM_INPUT;
|
||||
+ msg->wparam = RIM_INPUT;
|
||||
+ msg->lparam = 0;
|
||||
+ memcpy( msg->data, &raw_msg->data, sizeof(raw_msg->data) );
|
||||
+
|
||||
+ queue_hardware_message( desktop, msg, 0 );
|
||||
+
|
||||
+done:
|
||||
+ if (foreground) release_object( foreground );
|
||||
+ if (thread) release_object( thread );
|
||||
+ if (desktop) release_object( desktop );
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/* queue a hardware message for a mouse event */
|
||||
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;
|
||||
unsigned int i, time, flags;
|
||||
struct hw_msg_source source = { IMDT_MOUSE, origin };
|
||||
@@ -1651,24 +1709,24 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
y = desktop->cursor.y;
|
||||
}
|
||||
|
||||
- if ((device = current->process->rawinput_mouse) &&
|
||||
- (req_flags & SEND_HWMSG_RAWINPUT))
|
||||
+ if (req_flags & SEND_HWMSG_RAWINPUT)
|
||||
{
|
||||
- if (!(msg = alloc_hardware_message( input->mouse.info, source, time ))) return 0;
|
||||
- msg_data = msg->data;
|
||||
-
|
||||
- msg->win = device->target;
|
||||
- msg->msg = WM_INPUT;
|
||||
- msg->wparam = RIM_INPUT;
|
||||
- msg->lparam = 0;
|
||||
+ raw_msg.desktop = desktop;
|
||||
+ raw_msg.source = source;
|
||||
+ raw_msg.time = time;
|
||||
|
||||
+ msg_data = &raw_msg.data;
|
||||
+ msg_data->info = input->mouse.info;
|
||||
msg_data->flags = flags;
|
||||
msg_data->rawinput.type = RIM_TYPEMOUSE;
|
||||
msg_data->rawinput.mouse.x = x - desktop->cursor.x;
|
||||
msg_data->rawinput.mouse.y = y - desktop->cursor.y;
|
||||
msg_data->rawinput.mouse.data = input->mouse.data;
|
||||
|
||||
- queue_hardware_message( desktop, msg, 0 );
|
||||
+ if (req_flags == SEND_HWMSG_RAWINPUT)
|
||||
+ enum_processes( queue_rawinput_message, &raw_msg );
|
||||
+ else
|
||||
+ queue_rawinput_message( current->process, &raw_msg );
|
||||
}
|
||||
|
||||
if (!(req_flags & SEND_HWMSG_WINDOW))
|
||||
@@ -1708,8 +1766,8 @@ 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;
|
||||
unsigned char vkey = input->kbd.vkey;
|
||||
unsigned int message_code, time;
|
||||
@@ -1781,23 +1839,24 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||||
break;
|
||||
}
|
||||
|
||||
- if ((device = current->process->rawinput_kbd) &&
|
||||
- (req_flags & SEND_HWMSG_RAWINPUT))
|
||||
+ if (req_flags & SEND_HWMSG_RAWINPUT)
|
||||
{
|
||||
- if (!(msg = alloc_hardware_message( input->kbd.info, source, time ))) return 0;
|
||||
- msg_data = msg->data;
|
||||
-
|
||||
- msg->win = device->target;
|
||||
- msg->msg = WM_INPUT;
|
||||
- msg->wparam = RIM_INPUT;
|
||||
+ raw_msg.desktop = desktop;
|
||||
+ raw_msg.source = source;
|
||||
+ raw_msg.time = time;
|
||||
|
||||
+ msg_data = &raw_msg.data;
|
||||
+ msg_data->info = input->kbd.info;
|
||||
msg_data->flags = input->kbd.flags;
|
||||
msg_data->rawinput.type = RIM_TYPEKEYBOARD;
|
||||
msg_data->rawinput.kbd.message = message_code;
|
||||
msg_data->rawinput.kbd.vkey = vkey;
|
||||
msg_data->rawinput.kbd.scan = input->kbd.scan;
|
||||
|
||||
- queue_hardware_message( desktop, msg, 0 );
|
||||
+ if (req_flags == SEND_HWMSG_RAWINPUT)
|
||||
+ enum_processes( queue_rawinput_message, &raw_msg );
|
||||
+ else
|
||||
+ queue_rawinput_message( current->process, &raw_msg );
|
||||
}
|
||||
|
||||
if (!(req_flags & SEND_HWMSG_WINDOW))
|
||||
--
|
||||
2.27.0
|
||||
|
@@ -1,7 +1,7 @@
|
||||
From 430580824e975bbda41884affd3e5fbf104ac6fe Mon Sep 17 00:00:00 2001
|
||||
From 7a3a5195d932de5bc6291458f15fa5400c9777f0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Mon, 26 Aug 2019 14:37:20 +0200
|
||||
Subject: [PATCH 04/12] server: Add send_hardware_message flags for rawinput
|
||||
Subject: [PATCH] server: Add send_hardware_message flags for rawinput
|
||||
translation.
|
||||
|
||||
---
|
||||
@@ -11,10 +11,10 @@ Subject: [PATCH 04/12] server: Add send_hardware_message flags for rawinput
|
||||
3 files changed, 19 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
|
||||
index 340d20e58f9..7d947a98d0f 100644
|
||||
index 1dd43a36a11..f0b95c7fc6c 100644
|
||||
--- a/dlls/user32/input.c
|
||||
+++ b/dlls/user32/input.c
|
||||
@@ -124,7 +124,7 @@ BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
|
||||
@@ -125,7 +125,7 @@ BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
|
||||
*/
|
||||
BOOL CDECL __wine_send_input( HWND hwnd, const INPUT *input )
|
||||
{
|
||||
@@ -23,7 +23,7 @@ index 340d20e58f9..7d947a98d0f 100644
|
||||
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
||||
return !status;
|
||||
}
|
||||
@@ -192,9 +192,9 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
|
||||
@@ -193,9 +193,9 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
|
||||
/* we need to update the coordinates to what the server expects */
|
||||
INPUT input = inputs[i];
|
||||
update_mouse_coords( &input );
|
||||
@@ -36,10 +36,10 @@ index 340d20e58f9..7d947a98d0f 100644
|
||||
if (status)
|
||||
{
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index ae3702b150f..9f9f9197134 100644
|
||||
index 56fda14932d..21de849e5d8 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -2370,6 +2370,8 @@ enum message_type
|
||||
@@ -2339,6 +2339,8 @@ enum message_type
|
||||
VARARG(keystate,bytes); /* global state array for all the keys */
|
||||
@END
|
||||
#define SEND_HWMSG_INJECTED 0x01
|
||||
@@ -49,10 +49,10 @@ index ae3702b150f..9f9f9197134 100644
|
||||
|
||||
/* Get a message from the current queue */
|
||||
diff --git a/server/queue.c b/server/queue.c
|
||||
index af65b5f6b4c..9528453b190 100644
|
||||
index ff9e703d1ff..46ace52f004 100644
|
||||
--- a/server/queue.c
|
||||
+++ b/server/queue.c
|
||||
@@ -1736,7 +1736,7 @@ static int send_hook_ll_message( struct desktop *desktop, struct message *hardwa
|
||||
@@ -1695,7 +1695,7 @@ done:
|
||||
|
||||
/* queue a hardware message for a mouse event */
|
||||
static int queue_mouse_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input,
|
||||
@@ -61,18 +61,18 @@ index af65b5f6b4c..9528453b190 100644
|
||||
{
|
||||
const struct rawinput_device *device;
|
||||
struct hardware_msg_data *msg_data;
|
||||
@@ -1789,7 +1789,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
y = desktop->cursor.y;
|
||||
@@ -1765,7 +1765,8 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
msg_data->rawinput.mouse.y = y - desktop->cursor.y;
|
||||
msg_data->rawinput.mouse.data = input->mouse.data;
|
||||
|
||||
- enum_processes( queue_rawinput_message, &raw_msg );
|
||||
+ if ((req_flags & SEND_HWMSG_RAWINPUT))
|
||||
+ enum_processes( queue_rawinput_message, &raw_msg );
|
||||
release_object( foreground );
|
||||
}
|
||||
|
||||
- if ((device = current->process->rawinput_mouse))
|
||||
+ if ((device = current->process->rawinput_mouse) &&
|
||||
+ (req_flags & SEND_HWMSG_RAWINPUT))
|
||||
{
|
||||
if (!(msg = alloc_hardware_message( input->mouse.info, source, time ))) return 0;
|
||||
msg_data = msg->data;
|
||||
@@ -1808,6 +1809,9 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
queue_hardware_message( desktop, msg, 0 );
|
||||
@@ -1775,6 +1776,9 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ if (!(req_flags & SEND_HWMSG_WINDOW))
|
||||
@@ -81,7 +81,7 @@ index af65b5f6b4c..9528453b190 100644
|
||||
for (i = 0; i < ARRAY_SIZE( messages ); i++)
|
||||
{
|
||||
if (!messages[i]) continue;
|
||||
@@ -1839,7 +1843,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
@@ -1806,7 +1810,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
|
||||
|
||||
/* queue a hardware message for a keyboard event */
|
||||
static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, const hw_input_t *input,
|
||||
@@ -90,18 +90,18 @@ index af65b5f6b4c..9528453b190 100644
|
||||
{
|
||||
struct hw_msg_source source = { IMDT_KEYBOARD, origin };
|
||||
const struct rawinput_device *device;
|
||||
@@ -1915,7 +1919,8 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||||
break;
|
||||
@@ -1899,7 +1903,8 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||||
msg_data->rawinput.kbd.vkey = vkey;
|
||||
msg_data->rawinput.kbd.scan = input->kbd.scan;
|
||||
|
||||
- enum_processes( queue_rawinput_message, &raw_msg );
|
||||
+ if ((req_flags & SEND_HWMSG_RAWINPUT))
|
||||
+ enum_processes( queue_rawinput_message, &raw_msg );
|
||||
release_object( foreground );
|
||||
}
|
||||
|
||||
- if ((device = current->process->rawinput_kbd))
|
||||
+ if ((device = current->process->rawinput_kbd) &&
|
||||
+ (req_flags & SEND_HWMSG_RAWINPUT))
|
||||
{
|
||||
if (!(msg = alloc_hardware_message( input->kbd.info, source, time ))) return 0;
|
||||
msg_data = msg->data;
|
||||
@@ -1933,6 +1938,9 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||||
queue_hardware_message( desktop, msg, 0 );
|
||||
@@ -1909,6 +1914,9 @@ static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, c
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ if (!(req_flags & SEND_HWMSG_WINDOW))
|
||||
@@ -110,7 +110,7 @@ index af65b5f6b4c..9528453b190 100644
|
||||
if (!(msg = alloc_hardware_message( input->kbd.info, source, time ))) return 0;
|
||||
msg_data = msg->data;
|
||||
|
||||
@@ -2494,10 +2502,10 @@ DECL_HANDLER(send_hardware_message)
|
||||
@@ -2465,10 +2473,10 @@ DECL_HANDLER(send_hardware_message)
|
||||
switch (req->input.type)
|
||||
{
|
||||
case INPUT_MOUSE:
|
||||
@@ -124,5 +124,5 @@ index af65b5f6b4c..9528453b190 100644
|
||||
case INPUT_HARDWARE:
|
||||
queue_custom_hardware_message( desktop, req->win, origin, &req->input );
|
||||
--
|
||||
2.24.1
|
||||
2.27.0
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From cb1312120a60b6b70ac45197b0c0ac2ed834fbb6 Mon Sep 17 00:00:00 2001
|
||||
From c74a22af02a816e81bf84b2f80fcd05582e01187 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Mon, 26 Aug 2019 15:20:32 +0200
|
||||
Subject: [PATCH] user32: Add __wine_send_input flags to hint raw input
|
||||
@@ -18,10 +18,10 @@ Subject: [PATCH] user32: Add __wine_send_input flags to hint raw input
|
||||
10 files changed, 17 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
|
||||
index 7d947a98d0f..97a5ada922e 100644
|
||||
index f0b95c7fc6c..150b7de9704 100644
|
||||
--- a/dlls/user32/input.c
|
||||
+++ b/dlls/user32/input.c
|
||||
@@ -122,9 +122,9 @@ BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
|
||||
@@ -123,9 +123,9 @@ BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret )
|
||||
*
|
||||
* Internal SendInput function to allow the graphics driver to inject real events.
|
||||
*/
|
||||
@@ -34,7 +34,7 @@ index 7d947a98d0f..97a5ada922e 100644
|
||||
return !status;
|
||||
}
|
||||
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
|
||||
index c08ad5ff4f9..b59ba381334 100644
|
||||
index d2a14879714..6ffc7d44096 100644
|
||||
--- a/dlls/user32/user32.spec
|
||||
+++ b/dlls/user32/user32.spec
|
||||
@@ -833,5 +833,5 @@
|
||||
@@ -58,10 +58,10 @@ index a0f3257f74b..1af8a98f1f9 100644
|
||||
|
||||
/***********************************************************************
|
||||
diff --git a/dlls/wineandroid.drv/window.c b/dlls/wineandroid.drv/window.c
|
||||
index 2fc258dfd90..d96f001432d 100644
|
||||
index eb05aaf2832..c1e7b000a8f 100644
|
||||
--- a/dlls/wineandroid.drv/window.c
|
||||
+++ b/dlls/wineandroid.drv/window.c
|
||||
@@ -524,7 +524,7 @@ static int process_events( DWORD mask )
|
||||
@@ -521,7 +521,7 @@ static int process_events( DWORD mask )
|
||||
}
|
||||
SERVER_END_REQ;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ index 2fc258dfd90..d96f001432d 100644
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -538,7 +538,7 @@ static int process_events( DWORD mask )
|
||||
@@ -535,7 +535,7 @@ static int process_events( DWORD mask )
|
||||
event->data.kbd.input.u.ki.wVk, event->data.kbd.input.u.ki.wVk,
|
||||
event->data.kbd.input.u.ki.wScan );
|
||||
update_keyboard_lock_state( event->data.kbd.input.u.ki.wVk, event->data.kbd.lock_state );
|
||||
@@ -144,10 +144,10 @@ index 48da12c0292..2a3bed787ab 100644
|
||||
|
||||
|
||||
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
||||
index 8e1eb6d5e0e..96e04509e73 100644
|
||||
index 7f11ba86e49..aaa34d8ff0f 100644
|
||||
--- a/dlls/winex11.drv/mouse.c
|
||||
+++ b/dlls/winex11.drv/mouse.c
|
||||
@@ -659,7 +659,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
|
||||
@@ -657,7 +657,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
|
||||
}
|
||||
input->u.mi.dx += clip_rect.left;
|
||||
input->u.mi.dy += clip_rect.top;
|
||||
@@ -156,7 +156,7 @@ index 8e1eb6d5e0e..96e04509e73 100644
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -699,7 +699,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
|
||||
@@ -697,7 +697,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
|
||||
SERVER_END_REQ;
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ index 8e1eb6d5e0e..96e04509e73 100644
|
||||
}
|
||||
|
||||
#ifdef SONAME_LIBXCURSOR
|
||||
@@ -1645,7 +1645,7 @@ void move_resize_window( HWND hwnd, int dir )
|
||||
@@ -1643,7 +1643,7 @@ void move_resize_window( HWND hwnd, int dir )
|
||||
input.u.mi.dwFlags = button_up_flags[button - 1] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
|
||||
input.u.mi.time = GetTickCount();
|
||||
input.u.mi.dwExtraInfo = 0;
|
||||
@@ -174,7 +174,7 @@ index 8e1eb6d5e0e..96e04509e73 100644
|
||||
}
|
||||
|
||||
while (PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ))
|
||||
@@ -1884,7 +1884,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
@@ -1882,7 +1882,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
TRACE( "pos %d,%d (event %f,%f)\n", input.u.mi.dx, input.u.mi.dy, dx, dy );
|
||||
|
||||
input.type = INPUT_MOUSE;
|
||||
@@ -184,10 +184,10 @@ index 8e1eb6d5e0e..96e04509e73 100644
|
||||
}
|
||||
|
||||
diff --git a/include/winuser.h b/include/winuser.h
|
||||
index 51c73d25c2f..10cebfa97d0 100644
|
||||
index 311b1481be4..4bc18a63e31 100644
|
||||
--- a/include/winuser.h
|
||||
+++ b/include/winuser.h
|
||||
@@ -4389,7 +4389,7 @@ static inline BOOL WINAPI SetRectEmpty(LPRECT rect)
|
||||
@@ -4406,7 +4406,7 @@ static inline BOOL WINAPI SetRectEmpty(LPRECT rect)
|
||||
WORD WINAPI SYSTEM_KillSystemTimer( WORD );
|
||||
|
||||
#ifdef __WINESRC__
|
||||
@@ -197,5 +197,5 @@ index 51c73d25c2f..10cebfa97d0 100644
|
||||
|
||||
#ifdef __cplusplus
|
||||
--
|
||||
2.24.0
|
||||
2.27.0
|
||||
|
@@ -1,7 +1,7 @@
|
||||
From 9038e4871284e636f277be8fc8a2a901049bcaf6 Mon Sep 17 00:00:00 2001
|
||||
From 7440b3f974b66631ee71fa9acafc333e39543174 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Fri, 2 Aug 2019 02:24:32 -0400
|
||||
Subject: [PATCH 07/12] winex11.drv: Advertise XInput2 version 2.1 support.
|
||||
Subject: [PATCH] winex11.drv: Advertise XInput2 version 2.1 support.
|
||||
|
||||
Under XInput2 protocol version < 2.1, RawEvents are not supposed to be
|
||||
sent if a pointer grab is active. However slave device events are still
|
||||
@@ -22,10 +22,10 @@ device events only and get rid of slave device id tracking.
|
||||
2 files changed, 10 insertions(+), 42 deletions(-)
|
||||
|
||||
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
||||
index 96e04509e73..105db08a78a 100644
|
||||
index aaa34d8ff0f..3a4b1198829 100644
|
||||
--- a/dlls/winex11.drv/mouse.c
|
||||
+++ b/dlls/winex11.drv/mouse.c
|
||||
@@ -304,12 +304,16 @@ static void enable_xinput2(void)
|
||||
@@ -302,12 +302,16 @@ static void enable_xinput2(void)
|
||||
|
||||
if (data->xi2_state == xi_unknown)
|
||||
{
|
||||
@@ -45,7 +45,7 @@ index 96e04509e73..105db08a78a 100644
|
||||
}
|
||||
}
|
||||
if (data->xi2_state == xi_unavailable) return;
|
||||
@@ -317,7 +321,7 @@ static void enable_xinput2(void)
|
||||
@@ -315,7 +319,7 @@ static void enable_xinput2(void)
|
||||
|
||||
mask.mask = mask_bits;
|
||||
mask.mask_len = sizeof(mask_bits);
|
||||
@@ -54,7 +54,7 @@ index 96e04509e73..105db08a78a 100644
|
||||
memset( mask_bits, 0, sizeof(mask_bits) );
|
||||
XISetMask( mask_bits, XI_DeviceChanged );
|
||||
XISetMask( mask_bits, XI_RawMotion );
|
||||
@@ -329,16 +333,6 @@ static void enable_xinput2(void)
|
||||
@@ -327,16 +331,6 @@ static void enable_xinput2(void)
|
||||
update_relative_valuators( pointer_info->classes, pointer_info->num_classes );
|
||||
pXIFreeDeviceInfo( pointer_info );
|
||||
|
||||
@@ -71,7 +71,7 @@ index 96e04509e73..105db08a78a 100644
|
||||
data->xi2_state = xi_enabled;
|
||||
#endif
|
||||
}
|
||||
@@ -359,15 +353,12 @@ static void disable_xinput2(void)
|
||||
@@ -357,15 +351,12 @@ static void disable_xinput2(void)
|
||||
|
||||
mask.mask = NULL;
|
||||
mask.mask_len = 0;
|
||||
@@ -88,7 +88,7 @@ index 96e04509e73..105db08a78a 100644
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1801,7 +1792,6 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev )
|
||||
@@ -1799,7 +1790,6 @@ static BOOL X11DRV_DeviceChanged( XGenericEventCookie *xev )
|
||||
if (event->reason != XISlaveSwitch) return FALSE;
|
||||
|
||||
update_relative_valuators( event->classes, event->num_classes );
|
||||
@@ -96,7 +96,7 @@ index 96e04509e73..105db08a78a 100644
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1822,26 +1812,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
@@ -1820,26 +1810,7 @@ static BOOL X11DRV_RawMotion( XGenericEventCookie *xev )
|
||||
if (thread_data->x_rel_valuator.number < 0 || thread_data->y_rel_valuator.number < 0) return FALSE;
|
||||
if (!event->valuators.mask_len) return FALSE;
|
||||
if (thread_data->xi2_state != xi_enabled) return FALSE;
|
||||
@@ -125,10 +125,10 @@ index 96e04509e73..105db08a78a 100644
|
||||
x_rel = &thread_data->x_rel_valuator;
|
||||
y_rel = &thread_data->y_rel_valuator;
|
||||
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
||||
index cca87433264..432dd5909ca 100644
|
||||
index cfce09bf11d..8a02a6ebf94 100644
|
||||
--- a/dlls/winex11.drv/x11drv.h
|
||||
+++ b/dlls/winex11.drv/x11drv.h
|
||||
@@ -340,12 +340,9 @@ struct x11drv_thread_data
|
||||
@@ -339,12 +339,9 @@ struct x11drv_thread_data
|
||||
DWORD clip_reset; /* time when clipping was last reset */
|
||||
HKL kbd_layout; /* active keyboard layout */
|
||||
enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled } xi2_state; /* XInput2 state */
|
||||
@@ -142,5 +142,5 @@ index cca87433264..432dd5909ca 100644
|
||||
|
||||
extern struct x11drv_thread_data *x11drv_init_thread_data(void) DECLSPEC_HIDDEN;
|
||||
--
|
||||
2.24.1
|
||||
2.27.0
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From c65d46aba7d72f8bde0d74b110382a4383dde085 Mon Sep 17 00:00:00 2001
|
||||
From e0245cae5151eddb30eeaed3116697257ce65f22 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Thu, 19 Dec 2019 22:34:44 +0100
|
||||
Subject: [PATCH] winex11.drv: Keep track of pointer and device button
|
||||
@@ -51,7 +51,7 @@ index 2a3bed787ab..37c96c926f4 100644
|
||||
}
|
||||
|
||||
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c
|
||||
index b420f4bbd4b..8691cc01531 100644
|
||||
index 3a4b1198829..26e8b4eea92 100644
|
||||
--- a/dlls/winex11.drv/mouse.c
|
||||
+++ b/dlls/winex11.drv/mouse.c
|
||||
@@ -25,6 +25,9 @@
|
||||
@@ -196,10 +196,10 @@ index b420f4bbd4b..8691cc01531 100644
|
||||
|
||||
xinput2_available = XQueryExtension( gdi_display, "XInputExtension", &xinput2_opcode, &event, &error );
|
||||
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
|
||||
index c2c63278a07..01f36c04862 100644
|
||||
index 8a02a6ebf94..73b1e90f12e 100644
|
||||
--- a/dlls/winex11.drv/x11drv.h
|
||||
+++ b/dlls/winex11.drv/x11drv.h
|
||||
@@ -630,6 +630,7 @@ extern void retry_grab_clipping_window(void) DECLSPEC_HIDDEN;
|
||||
@@ -629,6 +629,7 @@ extern void retry_grab_clipping_window(void) DECLSPEC_HIDDEN;
|
||||
extern BOOL clip_fullscreen_window( HWND hwnd, BOOL reset ) DECLSPEC_HIDDEN;
|
||||
extern void move_resize_window( HWND hwnd, int dir ) DECLSPEC_HIDDEN;
|
||||
extern void X11DRV_InitKeyboard( Display *display ) DECLSPEC_HIDDEN;
|
||||
@@ -220,5 +220,5 @@ index e6e61e801e1..20e829ba64f 100644
|
||||
|
||||
X11DRV_DisplayDevices_Init(FALSE);
|
||||
--
|
||||
2.25.1
|
||||
2.27.0
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From d337c8de3de6a0b7ff16cada895d2490d3240b53 Mon Sep 17 00:00:00 2001
|
||||
From c346568308b37a4bbb7f3edb21bb1097f2ddbc4a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Wed, 11 Sep 2019 10:15:20 +0200
|
||||
Subject: [PATCH] winex11.drv: Listen to RawMotion and RawButton* events in the
|
@@ -1,194 +0,0 @@
|
||||
From 75e4a39ac1bad4b2c69e993b7df3f59d9f2a212c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Mon, 26 Aug 2019 14:08:20 +0200
|
||||
Subject: [PATCH] dinput8: Use raw input interface for dinput8 mouse device.
|
||||
|
||||
---
|
||||
dlls/dinput/mouse.c | 117 +++++++++++++++++++++++++++++++++++-
|
||||
dlls/dinput8/tests/device.c | 10 +--
|
||||
2 files changed, 119 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
|
||||
index 5e6f34f0eca..265a9e0a16a 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:
|
||||
@@ -311,7 +318,115 @@ int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM lparam
|
||||
{
|
||||
MSLLHOOKSTRUCT *hook = (MSLLHOOKSTRUCT *)lparam;
|
||||
SysMouseImpl* This = impl_from_IDirectInputDevice8A(iface);
|
||||
- int wdata = 0, inst_id = -1, ret = 0;
|
||||
+ int wdata = 0, inst_id = -1, ret = 0, i;
|
||||
+
|
||||
+ if (wparam == RIM_INPUT || wparam == RIM_INPUTSINK)
|
||||
+ {
|
||||
+ RAWINPUTHEADER raw_header;
|
||||
+ RAWINPUT raw_input;
|
||||
+ UINT size;
|
||||
+ POINT rel, pt;
|
||||
+
|
||||
+ 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);
|
||||
+
|
||||
+ size = sizeof(raw_header);
|
||||
+ if (GetRawInputData( (HRAWINPUT)lparam, RID_HEADER, &raw_header, &size, sizeof(RAWINPUTHEADER) ) != sizeof(raw_header))
|
||||
+ {
|
||||
+ WARN( "Unable to read raw input data header\n" );
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (raw_header.dwType != RIM_TYPEMOUSE)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (raw_header.dwSize > sizeof(raw_input))
|
||||
+ {
|
||||
+ WARN( "Unexpected size for mouse raw input data\n" );
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ size = raw_header.dwSize;
|
||||
+ if (GetRawInputData( (HRAWINPUT)lparam, RID_INPUT, &raw_input, &size, sizeof(RAWINPUTHEADER) ) != raw_header.dwSize )
|
||||
+ {
|
||||
+ WARN( "Unable to read raw input data\n" );
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (raw_input.data.mouse.usFlags & MOUSE_VIRTUAL_DESKTOP)
|
||||
+ FIXME( "Unimplemented MOUSE_VIRTUAL_DESKTOP flag\n" );
|
||||
+ if (raw_input.data.mouse.usFlags & MOUSE_ATTRIBUTES_CHANGED)
|
||||
+ FIXME( "Unimplemented MOUSE_ATTRIBUTES_CHANGED flag\n" );
|
||||
+
|
||||
+ EnterCriticalSection(&This->base.crit);
|
||||
+
|
||||
+ rel.x = raw_input.data.mouse.lLastX;
|
||||
+ rel.y = raw_input.data.mouse.lLastY;
|
||||
+ if (raw_input.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(), This->base.dinput->evsequence);
|
||||
+
|
||||
+ if (rel.y)
|
||||
+ queue_event(iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
||||
+ pt.y, GetCurrentTime(), This->base.dinput->evsequence);
|
||||
+
|
||||
+ 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 (raw_input.data.mouse.usButtonFlags & RI_MOUSE_WHEEL)
|
||||
+ {
|
||||
+ This->m_state.lZ += (wdata = (SHORT)raw_input.data.mouse.usButtonData);
|
||||
+ queue_event(iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
||||
+ wdata, GetCurrentTime(), This->base.dinput->evsequence);
|
||||
+ ret = This->clipped;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(mouse_button_flags); ++i)
|
||||
+ {
|
||||
+ if (raw_input.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(), This->base.dinput->evsequence);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ LeaveCriticalSection(&This->base.crit);
|
||||
+
|
||||
+ return ret;
|
||||
+ }
|
||||
|
||||
TRACE("msg %lx @ (%d %d)\n", wparam, hook->pt.x, hook->pt.y);
|
||||
|
||||
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
|
||||
index 328174e5796..b0a863f69f5 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);
|
||||
@@ -717,7 +714,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.26.2
|
||||
|
@@ -1,64 +0,0 @@
|
||||
From bc5c3fdd603688460b74c007a1172004a2c8ff30 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
|
||||
Date: Wed, 8 Apr 2020 15:35:32 +0200
|
||||
Subject: [PATCH] dinput: Fix rawinput events sequence number.
|
||||
|
||||
---
|
||||
dlls/dinput/mouse.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
|
||||
index 5a624949867..6480a5adac6 100644
|
||||
--- a/dlls/dinput/mouse.c
|
||||
+++ b/dlls/dinput/mouse.c
|
||||
@@ -333,6 +333,7 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
|
||||
RAWINPUT raw_input;
|
||||
UINT size;
|
||||
POINT rel, pt;
|
||||
+ DWORD seq;
|
||||
|
||||
static const USHORT mouse_button_flags[] =
|
||||
{
|
||||
@@ -374,6 +375,7 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
|
||||
FIXME( "Unimplemented MOUSE_ATTRIBUTES_CHANGED flag\n" );
|
||||
|
||||
EnterCriticalSection(&This->base.crit);
|
||||
+ seq = This->base.dinput->evsequence++;
|
||||
|
||||
rel.x = raw_input.data.mouse.lLastX;
|
||||
rel.y = raw_input.data.mouse.lLastY;
|
||||
@@ -399,11 +401,11 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
|
||||
|
||||
if (rel.x)
|
||||
queue_event(iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_X_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
||||
- pt.x, GetCurrentTime(), This->base.dinput->evsequence);
|
||||
+ pt.x, GetCurrentTime(), seq);
|
||||
|
||||
if (rel.y)
|
||||
queue_event(iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Y_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
||||
- pt.y, GetCurrentTime(), This->base.dinput->evsequence);
|
||||
+ pt.y, GetCurrentTime(), seq);
|
||||
|
||||
if (rel.x || rel.y)
|
||||
{
|
||||
@@ -416,7 +418,7 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
|
||||
{
|
||||
This->m_state.lZ += (wdata = (SHORT)raw_input.data.mouse.usButtonData);
|
||||
queue_event(iface, DIDFT_MAKEINSTANCE(WINE_MOUSE_Z_AXIS_INSTANCE) | DIDFT_RELAXIS,
|
||||
- wdata, GetCurrentTime(), This->base.dinput->evsequence);
|
||||
+ wdata, GetCurrentTime(), seq);
|
||||
ret = This->clipped;
|
||||
}
|
||||
|
||||
@@ -426,7 +428,7 @@ static int dinput_mouse_hook( LPDIRECTINPUTDEVICE8A iface, WPARAM wparam, LPARAM
|
||||
{
|
||||
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(), This->base.dinput->evsequence);
|
||||
+ This->m_state.rgbButtons[i / 2], GetCurrentTime(), seq);
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.26.0
|
||||
|
@@ -1,5 +1,3 @@
|
||||
Fixes: [42631] Mouse drift, jump or don't react to small slow movements in Unity-engine games and Fallout 4 (partly fixed in Unity games, have walkaround in Fallout4 )
|
||||
Fixes: [42675] Overwatch: Phantom mouse input / view pulled up to ceiling
|
||||
Depends: winex11.drv-mouse-coorrds
|
||||
Depends: loader-KeyboardLayouts
|
||||
Disabled: True
|
||||
|
Reference in New Issue
Block a user