Fix mouse jumping on Shield devices when clicking or scrolling

This commit is contained in:
Cameron Gutman 2020-04-23 00:13:19 -07:00
parent 5b86e99138
commit 45ff51c0d2

View File

@ -75,8 +75,10 @@ public class ShieldCaptureProvider extends InputCaptureProvider {
@Override @Override
public boolean eventHasRelativeMouseAxes(MotionEvent event) { public boolean eventHasRelativeMouseAxes(MotionEvent event) {
return event.getAxisValue(AXIS_RELATIVE_X) != 0 || // All mouse events should use relative axes, even if they are zero. This avoids triggering
event.getAxisValue(AXIS_RELATIVE_Y) != 0; // cursor jumps if we get an event with no associated motion, like ACTION_DOWN or ACTION_UP.
return event.getPointerCount() == 1 && event.getActionIndex() == 0 &&
event.getToolType(0) == MotionEvent.TOOL_TYPE_MOUSE;
} }
@Override @Override