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>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define NONAMELESSUNION
|
|
||||||
#define NONAMELESSSTRUCT
|
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
|
@ -203,9 +201,9 @@ static void find_devices(void)
|
||||||
WARN("Failed to get attributes.\n");
|
WARN("Failed to get attributes.\n");
|
||||||
|
|
||||||
device->info.dwType = RIM_TYPEHID;
|
device->info.dwType = RIM_TYPEHID;
|
||||||
device->info.u.hid.dwVendorId = attr.VendorID;
|
device->info.hid.dwVendorId = attr.VendorID;
|
||||||
device->info.u.hid.dwProductId = attr.ProductID;
|
device->info.hid.dwProductId = attr.ProductID;
|
||||||
device->info.u.hid.dwVersionNumber = attr.VersionNumber;
|
device->info.hid.dwVersionNumber = attr.VersionNumber;
|
||||||
|
|
||||||
if (!HidD_GetPreparsedData(device->file, &device->data))
|
if (!HidD_GetPreparsedData(device->file, &device->data))
|
||||||
WARN("Failed to get preparsed data.\n");
|
WARN("Failed to get preparsed data.\n");
|
||||||
|
@ -213,8 +211,8 @@ static void find_devices(void)
|
||||||
if (!HidP_GetCaps(device->data, &caps))
|
if (!HidP_GetCaps(device->data, &caps))
|
||||||
WARN("Failed to get caps.\n");
|
WARN("Failed to get caps.\n");
|
||||||
|
|
||||||
device->info.u.hid.usUsagePage = caps.UsagePage;
|
device->info.hid.usUsagePage = caps.UsagePage;
|
||||||
device->info.u.hid.usUsage = caps.Usage;
|
device->info.hid.usUsage = caps.Usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetupDiDestroyDeviceInfoList(set);
|
SetupDiDestroyDeviceInfoList(set);
|
||||||
|
@ -229,7 +227,7 @@ static void find_devices(void)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
device->info.dwType = RIM_TYPEMOUSE;
|
device->info.dwType = RIM_TYPEMOUSE;
|
||||||
device->info.u.mouse = mouse_info;
|
device->info.mouse = mouse_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetupDiDestroyDeviceInfoList(set);
|
SetupDiDestroyDeviceInfoList(set);
|
||||||
|
@ -244,7 +242,7 @@ static void find_devices(void)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
device->info.dwType = RIM_TYPEKEYBOARD;
|
device->info.dwType = RIM_TYPEKEYBOARD;
|
||||||
device->info.u.keyboard = keyboard_info;
|
device->info.keyboard = keyboard_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetupDiDestroyDeviceInfoList(set);
|
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 = find_device_from_handle(handle))) return FALSE;
|
||||||
if (device->info.dwType != RIM_TYPEHID) return FALSE;
|
if (device->info.dwType != RIM_TYPEHID) return FALSE;
|
||||||
|
|
||||||
*usage_page = device->info.u.hid.usUsagePage;
|
*usage_page = device->info.hid.usUsagePage;
|
||||||
*usage = device->info.u.hid.usUsage;
|
*usage = device->info.hid.usUsage;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,36 +315,36 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms
|
||||||
rawinput->header.wParam = 0;
|
rawinput->header.wParam = 0;
|
||||||
|
|
||||||
rawinput->data.mouse.usFlags = MOUSE_MOVE_RELATIVE;
|
rawinput->data.mouse.usFlags = MOUSE_MOVE_RELATIVE;
|
||||||
rawinput->data.mouse.u.s.usButtonFlags = 0;
|
rawinput->data.mouse.usButtonFlags = 0;
|
||||||
rawinput->data.mouse.u.s.usButtonData = 0;
|
rawinput->data.mouse.usButtonData = 0;
|
||||||
for (i = 1; i < ARRAY_SIZE(button_flags); ++i)
|
for (i = 1; i < ARRAY_SIZE(button_flags); ++i)
|
||||||
{
|
{
|
||||||
if (msg_data->flags & (1 << 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)
|
if (msg_data->flags & MOUSEEVENTF_WHEEL)
|
||||||
{
|
{
|
||||||
rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_WHEEL;
|
rawinput->data.mouse.usButtonFlags |= RI_MOUSE_WHEEL;
|
||||||
rawinput->data.mouse.u.s.usButtonData = msg_data->rawinput.mouse.data;
|
rawinput->data.mouse.usButtonData = msg_data->rawinput.mouse.data;
|
||||||
}
|
}
|
||||||
if (msg_data->flags & MOUSEEVENTF_HWHEEL)
|
if (msg_data->flags & MOUSEEVENTF_HWHEEL)
|
||||||
{
|
{
|
||||||
rawinput->data.mouse.u.s.usButtonFlags |= RI_MOUSE_HORIZONTAL_WHEEL;
|
rawinput->data.mouse.usButtonFlags |= RI_MOUSE_HORIZONTAL_WHEEL;
|
||||||
rawinput->data.mouse.u.s.usButtonData = msg_data->rawinput.mouse.data;
|
rawinput->data.mouse.usButtonData = msg_data->rawinput.mouse.data;
|
||||||
}
|
}
|
||||||
if (msg_data->flags & MOUSEEVENTF_XDOWN)
|
if (msg_data->flags & MOUSEEVENTF_XDOWN)
|
||||||
{
|
{
|
||||||
if (msg_data->rawinput.mouse.data == XBUTTON1)
|
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)
|
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->flags & MOUSEEVENTF_XUP)
|
||||||
{
|
{
|
||||||
if (msg_data->rawinput.mouse.data == XBUTTON1)
|
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)
|
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;
|
rawinput->data.mouse.ulRawButtons = 0;
|
||||||
|
|
Loading…
Reference in New Issue