Consume unhandled gamepad mouse events to prevent duplicate mouse actions

This commit is contained in:
Cameron Gutman
2023-10-07 23:04:36 -05:00
parent 0e3b472f78
commit 229eff49fb

View File

@@ -1623,16 +1623,17 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
switch (event.getActionMasked()) { switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
context.inputMap |= ControllerPacket.TOUCHPAD_FLAG; context.inputMap |= ControllerPacket.TOUCHPAD_FLAG;
sendControllerInputPacket(context);
break; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_CANCEL:
context.inputMap &= ~ControllerPacket.TOUCHPAD_FLAG; context.inputMap &= ~ControllerPacket.TOUCHPAD_FLAG;
sendControllerInputPacket(context);
break; break;
default: default:
return false; break;
} }
sendControllerInputPacket(context);
return !prefConfig.gamepadTouchpadAsMouse; return !prefConfig.gamepadTouchpadAsMouse;
} }