[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.
This commit is contained in:
thefiddler 2014-01-05 22:36:01 +01:00
parent 9e223486f6
commit ab85afd5ba

View file

@ -196,22 +196,19 @@ namespace OpenTK.Platform.MacOS
{ {
bool recognized = false; bool recognized = false;
if (NativeMethods.IOHIDDeviceConformsTo(device, HIDPage.GenericDesktop, (int)HIDUsageGD.Mouse) && if (MouseDevices.ContainsKey(device))
MouseDevices.ContainsKey(device))
{ {
RemoveMouse(sender, device); RemoveMouse(sender, device);
recognized = true; recognized = true;
} }
if (NativeMethods.IOHIDDeviceConformsTo(device, HIDPage.GenericDesktop, (int)HIDUsageGD.Keyboard) && if (KeyboardDevices.ContainsKey(device))
KeyboardDevices.ContainsKey(device))
{ {
RemoveKeyboard(sender, device); RemoveKeyboard(sender, device);
recognized = true; recognized = true;
} }
if (NativeMethods.IOHIDDeviceConformsTo(device, HIDPage.GenericDesktop, (int)HIDUsageGD.Joystick) && if (JoystickDevices.ContainsKey(device))
JoystickDevices.ContainsKey(device))
{ {
RemoveJoystick(sender, device); RemoveJoystick(sender, device);
recognized = true; recognized = true;