Ignore relative mouse inputs from non-mouse tools

Apparently this can happen for the SPen on Android 12
This commit is contained in:
Cameron Gutman 2022-02-12 19:50:59 -06:00
parent f39bf61b04
commit c0f8001627

View File

@ -96,7 +96,7 @@ public class AndroidNativePointerCaptureProvider extends AndroidPointerIconCaptu
// SOURCE_TOUCHPAD will have relative axes populated iff our view has pointer capture.
// See https://developer.android.com/reference/android/view/View#requestPointerCapture()
int eventSource = event.getSource();
return eventSource == InputDevice.SOURCE_MOUSE_RELATIVE ||
return (eventSource == InputDevice.SOURCE_MOUSE_RELATIVE && event.getToolType(0) == MotionEvent.TOOL_TYPE_MOUSE) ||
(eventSource == InputDevice.SOURCE_TOUCHPAD && targetView.hasPointerCapture());
}