mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-03-08 10:10:00 +00:00
[Win] Reduce duplication in device enumeration
This commit is contained in:
parent
e38fc0dff7
commit
f6b382c929
|
@ -174,6 +174,20 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
#endregion
|
||||
|
||||
#region GetDeviceList
|
||||
|
||||
public static RawInputDeviceList[] GetDeviceList()
|
||||
{
|
||||
int count = WinRawInput.DeviceCount;
|
||||
RawInputDeviceList[] ridl = new RawInputDeviceList[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
ridl[i] = new RawInputDeviceList();
|
||||
Functions.GetRawInputDeviceList(ridl, ref count, API.RawInputDeviceListSize);
|
||||
return ridl;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override IKeyboardDriver2 KeyboardDriver
|
||||
{
|
||||
get { return keyboard_driver; }
|
||||
|
|
|
@ -80,14 +80,8 @@ namespace OpenTK.Platform.Windows
|
|||
mice[i] = state;
|
||||
}
|
||||
|
||||
int count = WinRawInput.DeviceCount;
|
||||
RawInputDeviceList[] ridl = new RawInputDeviceList[count];
|
||||
for (int i = 0; i < count; i++)
|
||||
ridl[i] = new RawInputDeviceList();
|
||||
Functions.GetRawInputDeviceList(ridl, ref count, API.RawInputDeviceListSize);
|
||||
|
||||
// Discover mouse devices
|
||||
foreach (RawInputDeviceList dev in ridl)
|
||||
foreach (RawInputDeviceList dev in WinRawInput.GetDeviceList())
|
||||
{
|
||||
ContextHandle id = new ContextHandle(dev.Device);
|
||||
if (rawids.ContainsKey(id))
|
||||
|
|
Loading…
Reference in a new issue