Permalink
Browse files

[Mac] Avoid IOHIDDeviceConformsTo call in DeviceRemoved handler

DeviceAdded already checks that devices conform to the desired usage
pages. Checking again in DeviceRemoved is unnecessary - if a device
exists, then it has already passed muster.
  • Loading branch information...
1 parent 9e22348 commit ab85afd5ba58f51f4ee3901e26a4c3b9d36e9041 @thefiddler thefiddler committed Jan 5, 2014
Showing with 3 additions and 6 deletions.
  1. +3 −6 Source/OpenTK/Platform/MacOS/HIDInput.cs
@@ -196,22 +196,19 @@ void DeviceRemoved(IntPtr context, IOReturn res, IntPtr sender, IOHIDDeviceRef d
{
bool recognized = false;
- if (NativeMethods.IOHIDDeviceConformsTo(device, HIDPage.GenericDesktop, (int)HIDUsageGD.Mouse) &&
- MouseDevices.ContainsKey(device))
+ if (MouseDevices.ContainsKey(device))
{
RemoveMouse(sender, device);
recognized = true;
}
- if (NativeMethods.IOHIDDeviceConformsTo(device, HIDPage.GenericDesktop, (int)HIDUsageGD.Keyboard) &&
- KeyboardDevices.ContainsKey(device))
+ if (KeyboardDevices.ContainsKey(device))
{
RemoveKeyboard(sender, device);
recognized = true;
}
- if (NativeMethods.IOHIDDeviceConformsTo(device, HIDPage.GenericDesktop, (int)HIDUsageGD.Joystick) &&
- JoystickDevices.ContainsKey(device))
+ if (JoystickDevices.ContainsKey(device))
{
RemoveJoystick(sender, device);
recognized = true;

0 comments on commit ab85afd

Please sign in to comment.