user32: Use nameless unions in rawinput.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9f193d5d41
commit
3f3d445383
|
@ -21,8 +21,6 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
|
@ -203,9 +201,9 @@ static void find_devices(void)
|
|||
WARN("Failed to get attributes.\n");
|
||||
|
||||
device->info.dwType = RIM_TYPEHID;
|
||||
device->info.u.hid.dwVendorId = attr.VendorID;
|
||||
device->info.u.hid.dwProductId = attr.ProductID;
|
||||
device->info.u.hid.dwVersionNumber = attr.VersionNumber;
|
||||
device->info.hid.dwVendorId = attr.VendorID;
|
||||
device->info.hid.dwProductId = attr.ProductID;
|
||||
device->info.hid.dwVersionNumber = attr.VersionNumber;
|
||||
|
||||
if (!HidD_GetPreparsedData(device->file, &device->data))
|
||||
WARN("Failed to get preparsed data.\n");
|
||||
|
@ -213,8 +211,8 @@ static void find_devices(void)
|
|||
if (!HidP_GetCaps(device->data, &caps))
|
||||
WARN("Failed to get caps.\n");
|
||||
|
||||
device->info.u.hid.usUsagePage = caps.UsagePage;
|
||||
device->info.u.hid.usUsage = caps.Usage;
|
||||
device->info.hid.usUsagePage = caps.UsagePage;
|
||||
device->info.hid.usUsage = caps.Usage;
|
||||
}
|
||||
|
||||
SetupDiDestroyDeviceInfoList(set);
|
||||
|
@ -229,7 +227,7 @@ static void find_devices(void)
|
|||
continue;
|
||||
|
||||
device->info.dwType = RIM_TYPEMOUSE;
|
||||
device->info.u.mouse = mouse_info;
|
||||
device->info.mouse = mouse_info;
|
||||
}
|
||||
|
||||
SetupDiDestroyDeviceInfoList(set);
|
||||
|
@ -244,7 +242,7 @@ static void find_devices(void)
|
|||
continue;
|
||||
|
||||
device->info.dwType = RIM_TYPEKEYBOARD;
|
||||
device->info.u.keyboard = keyboard_info;
|
||||
device->info.keyboard = keyboard_info;
|
||||
}
|
||||
|
||||
SetupDiDestroyDeviceInfoList(set);
|
||||
|
@ -276,8 +274,8 @@ BOOL rawinput_device_get_usages(HANDLE handle, USAGE *usage_page, USAGE *usage)
|
|||
if (!(device = find_device_from_handle(handle))) return FALSE;
|
||||
if (device->info.dwType != RIM_TYPEHID) return FALSE;
|
||||
|
||||
*usage_page = device->info.u.hid.usUsagePage;
|
||||
*usage = device->info.u.hid.usUsage;
|
||||
*usage_page = device->info.hid.usUsagePage;
|
||||
*usage = device->info.hid.usUsage;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -317,36 +315,36 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms
|
|||
rawinput->header.wParam = 0;
|
||||
|
||||
rawinput->data.mouse.usFlags = MOUSE_MOVE_RELATIVE;
|
||||
rawinput->data.mouse.u.s.usButtonFlags = 0;
|
||||
rawinput->data.mouse.u.s.usButtonData = 0;
|
||||
rawinput->data.mouse.usButtonFlags = 0;
|
||||
rawinput->data.mouse.usButtonData = 0;
|
||||
for (i = 1; i < ARRAY_SIZE(button_flags); ++i)
|
||||
{
|
||||
if (msg_data->flags & (1 << i))
|
||||
rawinput->data.mouse.u.s.usButtonFlags |= button_flags[i];
|
||||
rawinput->data.mouse.usButtonFlags |= button_flags[i];
|
||||
}
|
||||
if (msg_data->flags & MOUSEEVENTF_WHEEL)
|
||||
{
|
||||
rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_WHEEL;
|
||||
rawinput->data.mouse.u.s.usButtonData = msg_data->rawinput.mouse.data;
|
||||
rawinput->data.mouse.usButtonFlags |= RI_MOUSE_WHEEL;
|
||||
rawinput->data.mouse.usButtonData = msg_data->rawinput.mouse.data;
|
||||
}
|
||||
if (msg_data->flags & MOUSEEVENTF_HWHEEL)
|
||||
{
|
||||
rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_HORIZONTAL_WHEEL;
|
||||
rawinput->data.mouse.u.s.usButtonData = msg_data->rawinput.mouse.data;
|
||||
rawinput->data.mouse.usButtonFlags |= RI_MOUSE_HORIZONTAL_WHEEL;
|
||||
rawinput->data.mouse.usButtonData = msg_data->rawinput.mouse.data;
|
||||
}
|
||||
if (msg_data->flags & MOUSEEVENTF_XDOWN)
|
||||
{
|
||||
if (msg_data->rawinput.mouse.data == XBUTTON1)
|
||||
rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_BUTTON_4_DOWN;
|
||||
rawinput->data.mouse.usButtonFlags |= RI_MOUSE_BUTTON_4_DOWN;
|
||||
else if (msg_data->rawinput.mouse.data == XBUTTON2)
|
||||
rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_BUTTON_5_DOWN;
|
||||
rawinput->data.mouse.usButtonFlags |= RI_MOUSE_BUTTON_5_DOWN;
|
||||
}
|
||||
if (msg_data->flags & MOUSEEVENTF_XUP)
|
||||
{
|
||||
if (msg_data->rawinput.mouse.data == XBUTTON1)
|
||||
rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_BUTTON_4_UP;
|
||||
rawinput->data.mouse.usButtonFlags |= RI_MOUSE_BUTTON_4_UP;
|
||||
else if (msg_data->rawinput.mouse.data == XBUTTON2)
|
||||
rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_BUTTON_5_UP;
|
||||
rawinput->data.mouse.usButtonFlags |= RI_MOUSE_BUTTON_5_UP;
|
||||
}
|
||||
|
||||
rawinput->data.mouse.ulRawButtons = 0;
|
||||
|
|
Loading…
Reference in New Issue