Avoid tons of redundant calls to InputEvent.getSource()

This commit is contained in:
Cameron Gutman
2021-07-17 14:01:12 -05:00
parent 5350651d6f
commit 04545ecbb0
2 changed files with 20 additions and 16 deletions

View File

@@ -41,8 +41,9 @@ public class AndroidNativePointerCaptureProvider extends AndroidPointerIconCaptu
// SOURCE_MOUSE_RELATIVE is how SOURCE_MOUSE appears when our view has pointer capture.
// SOURCE_TOUCHPAD will have relative axes populated iff our view has pointer capture.
// See https://developer.android.com/reference/android/view/View#requestPointerCapture()
return event.getSource() == InputDevice.SOURCE_MOUSE_RELATIVE ||
(event.getSource() == InputDevice.SOURCE_TOUCHPAD && targetView.hasPointerCapture());
int eventSource = event.getSource();
return eventSource == InputDevice.SOURCE_MOUSE_RELATIVE ||
(eventSource == InputDevice.SOURCE_TOUCHPAD && targetView.hasPointerCapture());
}
@Override