scrcpy/server/src/main/java/com/genymobile/scrcpy
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
..
wrappers Adapt ClipboardManager for Android 13 2022-12-21 13:28:22 +01:00
Binary.java Add conversion from float to fixed-point i16 2022-08-28 15:23:08 +02:00
CleanUp.java Make ServiceManager and Settings methods static 2022-10-02 17:57:35 +02:00
CodecOption.java Pass server parameters as key=value pairs 2021-11-24 21:23:20 +01:00
Command.java Add fallback to get DisplayInfo 2022-09-25 16:22:51 +02:00
Controller.java Force mouse source when --forward-all-clicks 2022-12-22 11:26:26 +01:00
ControlMessage.java Use precise scrolling values 2022-08-28 15:23:08 +02:00
ControlMessageReader.java Use precise scrolling values 2022-08-28 15:23:08 +02:00
DesktopConnection.java Add server option send_dummy_byte 2022-01-26 11:30:46 +01:00
Device.java Make ServiceManager and Settings methods static 2022-10-02 17:57:35 +02:00
DeviceMessage.java Make the device acknowledge device clipboard 2021-11-23 21:15:05 +01:00
DeviceMessageSender.java Make the device acknowledge device clipboard 2021-11-23 21:15:05 +01:00
DeviceMessageWriter.java Add device clipboard set acknowledgement 2021-11-23 21:15:05 +01:00
DisplayInfo.java Disable input events when necessary 2020-04-16 20:54:00 +02:00
InvalidDisplayIdException.java Add display id parameter 2020-04-02 21:02:52 +02:00
InvalidEncoderException.java List available encoders on invalid name specified 2020-11-08 21:07:20 +01:00
IO.java Add fallback to get DisplayInfo 2022-09-25 16:22:51 +02:00
KeyComposition.java Provide a better URL to document key decomposition 2018-03-07 18:07:02 +01:00
Ln.java Add throwable parameter to Log.w() 2021-11-18 08:37:18 +01:00
Options.java Add option to not power on on start 2022-04-28 19:12:52 +02:00
Point.java Reformat Java code 2019-11-25 17:33:42 +01:00
Pointer.java Inject touch events on the server 2019-10-03 20:05:29 +02:00
PointersState.java Merge mouse and touch events 2019-10-03 20:37:49 +02:00
Position.java Add option to lock video orientation 2020-02-27 21:24:37 +01:00
ScreenEncoder.java Also retry on IllegalArgumentException 2022-02-22 10:27:11 +01:00
ScreenInfo.java Compute screen size without DisplayInfo instance 2022-01-21 18:36:46 +01:00
Server.java Make ServiceManager and Settings methods static 2022-10-02 17:57:35 +02:00
Settings.java Make ServiceManager and Settings methods static 2022-10-02 17:57:35 +02:00
SettingsException.java Report settings errors via Exceptions 2021-11-18 08:37:02 +01:00
Size.java Reformat Java code 2019-11-25 17:33:42 +01:00
StringUtils.java Remove MagicNumber checkstyle 2020-03-28 22:08:16 +01:00
Workarounds.java Remove deprecation warning 2020-10-05 21:09:47 +02:00