Merge pull request #609 from leezer3/RailDriver

Windows HID: Implement generic Consumer device which returns a button collection
This commit is contained in:
Jarl Gullberg 2017-07-28 13:37:42 +02:00 committed by GitHub
commit b84f4e21c7
3 changed files with 11 additions and 1 deletions

View file

@ -141,7 +141,8 @@ namespace OpenTK.Platform.Common
// Consumer electronic devices
internal enum HIDUsageCD
{
ACPan = 0x0238
ACPan = 0x0238,
ConsumerControl = 0x01
}
// Generic desktop usage

View file

@ -2126,6 +2126,14 @@ namespace OpenTK.Platform.Windows
Target = target;
}
public RawInputDevice(HIDUsageCD usage, RawInputDeviceFlags flags, HWND target)
{
UsagePage = HIDPage.Consumer;
Usage = (short)usage;
Flags = flags;
Target = target;
}
public RawInputDevice(HIDUsageSim usage, RawInputDeviceFlags flags, HWND target)
{
UsagePage = HIDPage.Simulation;

View file

@ -194,6 +194,7 @@ namespace OpenTK.Platform.Windows
{
new RawInputDevice(HIDUsageGD.Joystick, RawInputDeviceFlags.DEVNOTIFY | RawInputDeviceFlags.INPUTSINK, window),
new RawInputDevice(HIDUsageGD.GamePad, RawInputDeviceFlags.DEVNOTIFY | RawInputDeviceFlags.INPUTSINK, window),
new RawInputDevice(HIDUsageCD.ConsumerControl, RawInputDeviceFlags.DEVNOTIFY | RawInputDeviceFlags.INPUTSINK, window),
};
if (!Functions.RegisterRawInputDevices(DeviceTypes, DeviceTypes.Length, API.RawInputDeviceSize))