[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;
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;