Skip to content

scrcpy reporting hover events with tool type mouse, but click with tool type finger #6103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gmackall opened this issue May 21, 2025 · 1 comment

Comments

@gmackall
Copy link

gmackall commented May 21, 2025

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

pointerProperties[pointerIndex].toolType = MotionEvent.TOOL_TYPE_FINGER;

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 (flutter/flutter#160144)

@rom1v
Copy link
Collaborator

rom1v commented May 22, 2025

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?

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants