mirror of
https://github.com/Genymobile/scrcpy
synced 2024-10-23 03:46:38 +00:00
Inject finger input whenever possible
Even if the pointer is a mouse, inject it as a finger unless it is required to be a mouse, that is: - when it is a HOVER_MOUSE event, or - when a secondary button is pressed. Some apps/games only accept events from a finger/touchscreen, so using a mouse by default does not work for them. For simplicity, make this change on the server side just before event injection (so that the client does not need to know about this hacky behavior). Refs6808288823
Refsc7b1d0ea9a
Fixes #5162 <https://github.com/Genymobile/scrcpy/issues/5162> Fixes #5163 <https://github.com/Genymobile/scrcpy/issues/5163>
This commit is contained in:
parent
992b4922fe
commit
773c23fda2
@ -278,8 +278,9 @@ public class Controller implements AsyncProcessor {
|
||||
pointer.setPressure(pressure);
|
||||
|
||||
int source;
|
||||
if (pointerId == POINTER_ID_MOUSE) {
|
||||
// real mouse event
|
||||
boolean activeSecondaryButtons = ((actionButton | buttons) & ~MotionEvent.BUTTON_PRIMARY) != 0;
|
||||
if (pointerId == POINTER_ID_MOUSE && (action == MotionEvent.ACTION_HOVER_MOVE || activeSecondaryButtons)) {
|
||||
// real mouse event, or event incompatible with a finger
|
||||
pointerProperties[pointerIndex].toolType = MotionEvent.TOOL_TYPE_MOUSE;
|
||||
source = InputDevice.SOURCE_MOUSE;
|
||||
pointer.setUp(buttons == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user