-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Force mouse source when --forward-all-clicks #3579
Conversation
Given this remark (we could use 2 mice for pinch-to-zoom), I adapted the implementation to also support pinch-to-zoom if |
Here are the test results with --forward-all-clicks done on pixel 6 pro with stock android 13.
For 2,3,4 and 5 the right click works. |
And for all of them, pinch work without |
|
Thank you for your feedback. So it seems to me that this PR is acceptable:
I'm not sure if it is good enough, or if we can do better. Maybe what you suggested here could be better, but I'm a bit afraid of side effects (and complexity). What do you think? |
During last testing session discovered problems with middle mouse button. Let me first figure out what is going on. |
OK. FYI, I will probably release a new version (1.25) soon, especially for #3497. |
Right click and middle click require the source device to be a mouse, not a touchscreen. Therefore, the source device was changed only when a button other than the primary button was pressed (see adc547f). However, this led to inconsistencies between the ACTION_DOWN when a secondary button is pressed (with a mouse as source device) and the matching ACTION_UP when the secondary button is released (with a touchscreen as source device, because then there is no button pressed). To avoid the problem in all cases, force a mouse as source device when --forward-all-clicks is set. Concretely, for mouse events in --forward-all-clicks mode: - device source is set to InputDevice.SOURCE_MOUSE; - motion event toolType is set to MotionEvent.TOOL_TYPE_MOUSE; Otherwise (when --forward-all-clicks is unset, or for real touch events), finger events are injected: - device source is set to InputDevice.SOURCE_TOUCHSCREEN; - motion event toolType is set to MotionEvent.TOOL_TYPE_FINGER. Fixes #3568 <#3568> PR #3579 <#3579> Co-authored-by: Romain Vimont <rom@rom1v.com> Signed-off-by: Romain Vimont <rom@rom1v.com>
Right click and middle click require the source device to be a mouse, not a touchscreen). Therefore, the source device was changed only when a button other than the primary button was pressed (see adc547f).
However, this led to inconsistencies between the
ACTION_DOWN
when a secondary button is pressed (with a mouse as source device) and the matchingACTION_UP
when the secondary button is released (with a touchscreen as source device, because then there is no button pressed).To avoid the problem in all cases, force a mouse as source device when --forward-all-clicks is set. As a consequence, pinch-to-zoom using a virtual finger is disabled in this case.
Concretely, in --forward-all-clicks mode:
InputDevice.SOURCE_MOUSE
;toolType
is set toMotionEvent.TOOL_TYPE_MOUSE
;Otherwise:
For all (virtual or not) finger events:
InputDevice.SOURCE_TOUCHSCREEN
;toolType
is set toMotionEvent.TOOL_TYPE_FINGER
.Fixes #3568
TODO:
--forward-all-clicks
--forward-all-clicks