Do not recurse over IOHIDElement children.
This commit is contained in:
parent
1a96c294ee
commit
fec6f187d1
@ -67,10 +67,11 @@ static void addJoystickElement(_GLFWjoydevice* joystick, IOHIDElementRef element
|
|||||||
usagePage = IOHIDElementGetUsagePage(elementRef);
|
usagePage = IOHIDElementGetUsagePage(elementRef);
|
||||||
usage = IOHIDElementGetUsage(elementRef);
|
usage = IOHIDElementGetUsage(elementRef);
|
||||||
|
|
||||||
if ((elementType == kIOHIDElementTypeInput_Axis) ||
|
if ((elementType != kIOHIDElementTypeInput_Axis) &&
|
||||||
(elementType == kIOHIDElementTypeInput_Button) ||
|
(elementType != kIOHIDElementTypeInput_Button) &&
|
||||||
(elementType == kIOHIDElementTypeInput_Misc))
|
(elementType != kIOHIDElementTypeInput_Misc))
|
||||||
{
|
return;
|
||||||
|
|
||||||
switch (usagePage)
|
switch (usagePage)
|
||||||
{
|
{
|
||||||
case kHIDPage_GenericDesktop:
|
case kHIDPage_GenericDesktop:
|
||||||
@ -114,19 +115,6 @@ static void addJoystickElement(_GLFWjoydevice* joystick, IOHIDElementRef element
|
|||||||
element->minReport = IOHIDElementGetLogicalMin(elementRef);
|
element->minReport = IOHIDElementGetLogicalMin(elementRef);
|
||||||
element->maxReport = IOHIDElementGetLogicalMax(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
|
// Adds an element to the specified joystick
|
||||||
|
Loading…
Reference in New Issue
Block a user