mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-23 00:36:41 +00:00
Pass-through back button on external devices that don't look like gamepads
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user