scrcpy/app
Pawel Jasinski c7b1d0ea9a Force mouse source when --forward-all-clicks
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
adc547fa6e).

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 <https://github.com/Genymobile/scrcpy/issues/3568>
PR #3579 <https://github.com/Genymobile/scrcpy/pull/3579>

Co-authored-by: Romain Vimont <rom@rom1v.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2022-12-22 11:26:26 +01:00
..
data Add -s auto-completion for zsh 2022-10-12 13:24:43 +02:00
prebuilt-deps Upgrade FFmpeg (5.0.1) for Windows 64-bit 2022-04-28 19:32:14 +02:00
src Force mouse source when --forward-all-clicks 2022-12-22 11:26:26 +01:00
tests Use precise scrolling values 2022-08-28 15:23:08 +02:00
meson.build Build log.c for test_cli 2022-10-19 15:17:43 +02:00
scrcpy-windows.manifest Set DPI awareness for Windows 2021-12-20 19:13:02 +01:00
scrcpy-windows.rc Bump version to 1.24 2022-04-28 20:46:28 +02:00
scrcpy.1 Use current adb port (if any) for --tcpip 2022-12-02 19:09:53 +01:00