winejoystick.drv: Fix Slider mapping.

Sliders, Dials, and Wheels now map to Z, U (Ry), or V (Rx) depending on
availability. Thus, also add support for up to 3 such HID elements.

Signed-off-by: David Lawrie <david.dljunk@gmail.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
David Lawrie 2016-06-14 20:33:49 -07:00 committed by Alexandre Julliard
parent 5ea6200fc8
commit f457f25b71
1 changed files with 18 additions and 1 deletions

View File

@ -442,8 +442,25 @@ static void collect_joystick_elements(joystick_t* joystick, IOHIDElementRef coll
break;
}
case kHIDUsage_GD_Slider:
TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Slider; ignoring\n");
case kHIDUsage_GD_Dial:
case kHIDUsage_GD_Wheel:
{
/* if one axis is taken, fall to the next until axes are filled */
int possible_axes[3] = {AXIS_Z,AXIS_RY,AXIS_RX};
int axis = 0;
while(axis < 3 && joystick->axes[possible_axes[axis]].element)
axis++;
if (axis == 3)
TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_<axis> (%d)\n ignoring\n", usage);
else
{
TRACE("kIOHIDElementTypeInput_Misc / kHIDUsage_GD_<axis> (%d) axis %d\n", usage, possible_axes[axis]);
joystick->axes[possible_axes[axis]].element = (IOHIDElementRef)CFRetain(child);
joystick->axes[possible_axes[axis]].min_value = IOHIDElementGetLogicalMin(child);
joystick->axes[possible_axes[axis]].max_value = IOHIDElementGetLogicalMax(child);
}
break;
}
default:
FIXME("kIOHIDElementTypeInput_Misc / Unhandled usage %d\n", usage);
break;