Rémi Bernon : user32: Update rawinput devices on WM_INPUT_DEVICE_CHANGE reception.
Alexandre Julliard
julliard at winehq.org
Wed Dec 15 14:25:57 CST 2021
Module: wine
Branch: master
Commit: 6a30f12eeffb2a80d2f2579e5f37dd088fbb25f3
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6a30f12eeffb2a80d2f2579e5f37dd088fbb25f3
Author: Rémi Bernon <rbernon at codeweavers.com>
Date: Tue Dec 14 21:24:22 2021 +0100
user32: Update rawinput devices on WM_INPUT_DEVICE_CHANGE reception.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51282
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/message.c | 4 +++-
dlls/user32/rawinput.c | 8 +++++---
dlls/user32/user_private.h | 1 +
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 03fa42f0ae5..d7dbc64d796 100644
--- a/dlls/user32/message.c
+++ b/dlls/user32/message.c
@@ -2290,7 +2290,9 @@ static BOOL process_rawinput_message( MSG *msg, UINT hw_id, const struct hardwar
{
struct rawinput_thread_data *thread_data = rawinput_thread_data();
- if (msg->message == WM_INPUT)
+ if (msg->message == WM_INPUT_DEVICE_CHANGE)
+ rawinput_update_device_list();
+ else
{
thread_data->buffer->header.dwSize = RAWINPUT_BUFFER_SIZE;
if (!rawinput_from_hardware_message( thread_data->buffer, msg_data )) return FALSE;
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index 3a316024656..2660874d12c 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -168,7 +168,7 @@ static struct device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface)
return device;
}
-static void find_devices(void)
+void rawinput_update_device_list(void)
{
SP_DEVICE_INTERFACE_DATA iface = { sizeof(iface) };
struct device *device;
@@ -178,6 +178,8 @@ static void find_devices(void)
HDEVINFO set;
DWORD idx;
+ TRACE("\n");
+
HidD_GetHidGuid(&hid_guid);
EnterCriticalSection(&rawinput_devices_cs);
@@ -259,7 +261,7 @@ static struct device *find_device_from_handle(HANDLE handle)
for (i = 0; i < rawinput_devices_count; ++i)
if (rawinput_devices[i].handle == handle)
return rawinput_devices + i;
- find_devices();
+ rawinput_update_device_list();
for (i = 0; i < rawinput_devices_count; ++i)
if (rawinput_devices[i].handle == handle)
return rawinput_devices + i;
@@ -432,7 +434,7 @@ UINT WINAPI GetRawInputDeviceList(RAWINPUTDEVICELIST *devices, UINT *device_coun
return ~0U;
}
- find_devices();
+ rawinput_update_device_list();
if (!devices)
{
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index 96704ac68ae..6923ddb2906 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -160,6 +160,7 @@ struct hardware_msg_data;
extern BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_msg_data *msg_data);
extern BOOL rawinput_device_get_usages(HANDLE handle, USAGE *usage_page, USAGE *usage);
extern struct rawinput_thread_data *rawinput_thread_data(void);
+extern void rawinput_update_device_list(void);
extern void create_offscreen_window_surface( const RECT *visible_rect, struct window_surface **surface ) DECLSPEC_HIDDEN;
More information about the wine-cvs
mailing list