user32: Rename the "hid_device" structure to "device".

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-04-09 17:32:41 -05:00 committed by Alexandre Julliard
parent 353c16f0d6
commit 9e195ba9a6
1 changed files with 19 additions and 20 deletions

View File

@ -39,7 +39,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(rawinput); WINE_DEFAULT_DEBUG_CHANNEL(rawinput);
struct hid_device struct device
{ {
WCHAR *path; WCHAR *path;
HANDLE file; HANDLE file;
@ -47,7 +47,7 @@ struct hid_device
PHIDP_PREPARSED_DATA data; PHIDP_PREPARSED_DATA data;
}; };
static struct hid_device *hid_devices; static struct device *hid_devices;
static unsigned int hid_devices_count, hid_devices_max; static unsigned int hid_devices_count, hid_devices_max;
static CRITICAL_SECTION hid_devices_cs; static CRITICAL_SECTION hid_devices_cs;
@ -86,10 +86,10 @@ static BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int
return TRUE; return TRUE;
} }
static struct hid_device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface) static struct device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface)
{ {
SP_DEVICE_INTERFACE_DETAIL_DATA_W *detail; SP_DEVICE_INTERFACE_DETAIL_DATA_W *detail;
struct hid_device *device; struct device *device;
HANDLE file; HANDLE file;
WCHAR *path; WCHAR *path;
DWORD size; DWORD size;
@ -147,7 +147,7 @@ static void find_hid_devices(void)
static ULONGLONG last_check; static ULONGLONG last_check;
SP_DEVICE_INTERFACE_DATA iface = { sizeof(iface) }; SP_DEVICE_INTERFACE_DATA iface = { sizeof(iface) };
struct hid_device *device; struct device *device;
HIDD_ATTRIBUTES attr; HIDD_ATTRIBUTES attr;
HIDP_CAPS caps; HIDP_CAPS caps;
GUID hid_guid; GUID hid_guid;
@ -398,7 +398,7 @@ UINT WINAPI GetRawInputDeviceInfoA(HANDLE device, UINT command, void *data, UINT
/*********************************************************************** /***********************************************************************
* GetRawInputDeviceInfoW (USER32.@) * GetRawInputDeviceInfoW (USER32.@)
*/ */
UINT WINAPI GetRawInputDeviceInfoW(HANDLE device, UINT command, void *data, UINT *data_size) UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT *data_size)
{ {
/* FIXME: Most of this is made up. */ /* FIXME: Most of this is made up. */
static const WCHAR keyboard_name[] = {'\\','\\','?','\\','W','I','N','E','_','K','E','Y','B','O','A','R','D',0}; static const WCHAR keyboard_name[] = {'\\','\\','?','\\','W','I','N','E','_','K','E','Y','B','O','A','R','D',0};
@ -407,12 +407,12 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE device, UINT command, void *data, UINT
static const RID_DEVICE_INFO_MOUSE mouse_info = {1, 5, 0, FALSE}; static const RID_DEVICE_INFO_MOUSE mouse_info = {1, 5, 0, FALSE};
RID_DEVICE_INFO info; RID_DEVICE_INFO info;
struct hid_device *hid_device = device; struct device *device = handle;
const void *to_copy; const void *to_copy;
UINT to_copy_bytes, avail_bytes; UINT to_copy_bytes, avail_bytes;
TRACE("device %p, command %#x, data %p, data_size %p.\n", TRACE("handle %p, command %#x, data %p, data_size %p.\n",
device, command, data, data_size); handle, command, data, data_size);
if (!data_size) return ~0U; if (!data_size) return ~0U;
@ -427,20 +427,20 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE device, UINT command, void *data, UINT
case RIDI_DEVICENAME: case RIDI_DEVICENAME:
/* for RIDI_DEVICENAME, data_size is in characters, not bytes */ /* for RIDI_DEVICENAME, data_size is in characters, not bytes */
avail_bytes = *data_size * sizeof(WCHAR); avail_bytes = *data_size * sizeof(WCHAR);
if (device == WINE_MOUSE_HANDLE) if (handle == WINE_MOUSE_HANDLE)
{ {
*data_size = ARRAY_SIZE(mouse_name); *data_size = ARRAY_SIZE(mouse_name);
to_copy = mouse_name; to_copy = mouse_name;
} }
else if (device == WINE_KEYBOARD_HANDLE) else if (handle == WINE_KEYBOARD_HANDLE)
{ {
*data_size = ARRAY_SIZE(keyboard_name); *data_size = ARRAY_SIZE(keyboard_name);
to_copy = keyboard_name; to_copy = keyboard_name;
} }
else else
{ {
*data_size = strlenW(hid_device->path) + 1; *data_size = strlenW(device->path) + 1;
to_copy = hid_device->path; to_copy = device->path;
} }
to_copy_bytes = *data_size * sizeof(WCHAR); to_copy_bytes = *data_size * sizeof(WCHAR);
break; break;
@ -448,12 +448,12 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE device, UINT command, void *data, UINT
case RIDI_DEVICEINFO: case RIDI_DEVICEINFO:
avail_bytes = *data_size; avail_bytes = *data_size;
info.cbSize = sizeof(info); info.cbSize = sizeof(info);
if (device == WINE_MOUSE_HANDLE) if (handle == WINE_MOUSE_HANDLE)
{ {
info.dwType = RIM_TYPEMOUSE; info.dwType = RIM_TYPEMOUSE;
info.u.mouse = mouse_info; info.u.mouse = mouse_info;
} }
else if (device == WINE_KEYBOARD_HANDLE) else if (handle == WINE_KEYBOARD_HANDLE)
{ {
info.dwType = RIM_TYPEKEYBOARD; info.dwType = RIM_TYPEKEYBOARD;
info.u.keyboard = keyboard_info; info.u.keyboard = keyboard_info;
@ -461,7 +461,7 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE device, UINT command, void *data, UINT
else else
{ {
info.dwType = RIM_TYPEHID; info.dwType = RIM_TYPEHID;
info.u.hid = hid_device->info; info.u.hid = device->info;
} }
to_copy_bytes = sizeof(info); to_copy_bytes = sizeof(info);
*data_size = to_copy_bytes; *data_size = to_copy_bytes;
@ -470,8 +470,7 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE device, UINT command, void *data, UINT
case RIDI_PREPARSEDDATA: case RIDI_PREPARSEDDATA:
avail_bytes = *data_size; avail_bytes = *data_size;
if (device == WINE_MOUSE_HANDLE || if (handle == WINE_MOUSE_HANDLE || handle == WINE_KEYBOARD_HANDLE)
device == WINE_KEYBOARD_HANDLE)
{ {
to_copy_bytes = 0; to_copy_bytes = 0;
*data_size = 0; *data_size = 0;
@ -479,9 +478,9 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE device, UINT command, void *data, UINT
} }
else else
{ {
to_copy_bytes = ((WINE_HIDP_PREPARSED_DATA*)hid_device->data)->dwSize; to_copy_bytes = ((WINE_HIDP_PREPARSED_DATA*)device->data)->dwSize;
*data_size = to_copy_bytes; *data_size = to_copy_bytes;
to_copy = hid_device->data; to_copy = device->data;
} }
break; break;