Add options to control gamepad touchpad and motion and reorganize input settings

This commit is contained in:
Cameron Gutman
2023-07-09 14:46:46 -05:00
parent 2b8a43ab13
commit e6876926a4
5 changed files with 64 additions and 18 deletions

View File

@@ -1477,6 +1477,11 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
return false;
}
// Bail if the user wants gamepad touchpads to control the mouse
if (prefConfig.gamepadTouchpadAsMouse) {
return false;
}
// Only get a context if one already exists. We want to ensure we don't report non-gamepads.
InputDeviceContext context = inputDeviceContexts.get(event.getDeviceId());
if (context == null) {
@@ -1864,6 +1869,11 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
}
public void handleSetMotionEventState(final short controllerNumber, final byte motionType, short reportRateHz) {
// Don't use motion sensors if the user turned them off
if (!prefConfig.gamepadMotionSensors) {
return;
}
// Report rate is restricted to <= 200 Hz without the HIGH_SAMPLING_RATE_SENSORS permission
reportRateHz = (short) Math.min(200, reportRateHz);