scrcpy reporting hover events with tool type mouse, but click with tool type finger
Hi, I have a question about how scrcpy delivers MotionEvents
https://github.com/Genymobile/scrcpy/blob/c5ed2cfc28ee7c7b59b11eb4db1258ac1c633bff/server/src/main/java/com/genymobile/scrcpy/control/Controller.java#L408C68-L408C83
https://github.com/Genymobile/scrcpy/blob/c5ed2cfc28ee7c7b59b11eb4db1258ac1c633bff/server/src/main/java/com/genymobile/scrcpy/control/Controller.java#L413
In particular, why does scrcpy deliver mouse clicks as originating from a TOOL_TYPE_FINGER, (or more generally MotionEvents that are not of type MotionEvent.ACTION_HOVER_MOVE, and therefore continue to the else case)? Is this intentional?
My motivation for asking is that I'm wondering how Flutter should handle these inputs from scrcpy, as it is currently the source of a bug (https://github.com/flutter/flutter/issues/160144)
In particular, why does scrcpy deliver mouse clicks as originating from a
TOOL_TYPE_FINGER, (or more generallyMotionEventsthat are not of typeMotionEvent.ACTION_HOVER_MOVE, and therefore continue to the else case)? Is this intentional?
Yes. The root cause is that when the user uses the computer mouse, we really want to inject events as if they originated from a finger, not a mouse, because the behavior is different. For example, the selection vs scroll is different with a mouse and a finger. And in some games, the mouse just does not work.
But at the same time, secondary clicks (right or middle click) and hover, which require a mouse type, must still work. So there is no perfect solution.
More details in these commits:
- c7b1d0ea9af8bb9603ec8f713f1a5fbf3f628b6a
- 6808288823239b0f3a76f9be377e4de82e91b35a
- 773c23fda298fd3dace4ded5a89e8716d3c0fc76
- 51fee79bf50b124223523eb51c437c1267c2724a
Thanks for the clarification! Closing as I've gotten the info I need, we will adjust to handle the potential different tool types here