Do not recurse over IOHIDElement children.

This commit is contained in:
Aaron Jacobs 2015-06-23 13:14:07 -07:00 committed by Camilla Berglund
parent 1a96c294ee
commit fec6f187d1
1 changed files with 40 additions and 52 deletions

View File

@ -67,10 +67,11 @@ static void addJoystickElement(_GLFWjoydevice* joystick, IOHIDElementRef element
usagePage = IOHIDElementGetUsagePage(elementRef);
usage = IOHIDElementGetUsage(elementRef);
if ((elementType == kIOHIDElementTypeInput_Axis) ||
(elementType == kIOHIDElementTypeInput_Button) ||
(elementType == kIOHIDElementTypeInput_Misc))
{
if ((elementType != kIOHIDElementTypeInput_Axis) &&
(elementType != kIOHIDElementTypeInput_Button) &&
(elementType != kIOHIDElementTypeInput_Misc))
return;
switch (usagePage)
{
case kHIDPage_GenericDesktop:
@ -114,19 +115,6 @@ static void addJoystickElement(_GLFWjoydevice* joystick, IOHIDElementRef element
element->minReport = IOHIDElementGetLogicalMin(elementRef);
element->maxReport = IOHIDElementGetLogicalMax(elementRef);
}
}
else
{
CFArrayRef array = IOHIDElementGetChildren(elementRef);
if (array)
{
if (CFGetTypeID(array) == CFArrayGetTypeID())
{
CFRange range = { 0, CFArrayGetCount(array) };
CFArrayApplyFunction(array, range, getElementsCFArrayHandler, joystick);
}
}
}
}
// Adds an element to the specified joystick