Pass-through back button on external devices that don't look like gamepads

This commit is contained in:
Cameron Gutman
2020-03-01 12:45:00 -08:00
parent ae463a8735
commit 3d0d19e561

View File

@@ -380,9 +380,7 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
} }
// Classify this device as a remote by name if it has no joystick axes // Classify this device as a remote by name if it has no joystick axes
if (getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_X) == null && if (!hasJoystickAxes(dev) && devName.toLowerCase().contains("remote")) {
getMotionRangeForJoystickAxis(dev, MotionEvent.AXIS_Y) == null &&
devName.toLowerCase().contains("remote")) {
return true; return true;
} }
@@ -424,8 +422,11 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
// c) have an internal gamepad but no internal select button (NVIDIA SHIELD Portable) // c) have an internal gamepad but no internal select button (NVIDIA SHIELD Portable)
return !foundInternalGamepad || foundInternalSelect; return !foundInternalGamepad || foundInternalSelect;
} }
else {
return false; // For external devices, we want to pass through the back button if the device
// has no gamepad axes or gamepad buttons.
return !hasJoystickAxes(dev) && !hasGamepadButtons(dev);
}
} }
private InputDeviceContext createInputDeviceContextForDevice(InputDevice dev) { private InputDeviceContext createInputDeviceContextForDevice(InputDevice dev) {