mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-21 01:33:36 +00:00
Add an option to forward all clicks
Add --forward-all-clicks to disable mouse shortcuts and forward middle and right clicks to the device instead. Fixes #1302 <https://github.com/Genymobile/scrcpy/issues/1302> Fixes #1613 <https://github.com/Genymobile/scrcpy/issues/1613>
This commit is contained in:
parent
5dcfc0ebab
commit
adc547fa6e
7 changed files with 36 additions and 3 deletions
|
|
@ -205,9 +205,13 @@ public class Controller {
|
|||
}
|
||||
}
|
||||
|
||||
// Right-click and middle-click only work if the source is a mouse
|
||||
boolean nonPrimaryButtonPressed = (buttons & ~MotionEvent.BUTTON_PRIMARY) != 0;
|
||||
int source = nonPrimaryButtonPressed ? InputDevice.SOURCE_MOUSE : InputDevice.SOURCE_TOUCHSCREEN;
|
||||
|
||||
MotionEvent event = MotionEvent
|
||||
.obtain(lastTouchDown, now, action, pointerCount, pointerProperties, pointerCoords, 0, buttons, 1f, 1f, DEVICE_ID_VIRTUAL, 0,
|
||||
InputDevice.SOURCE_TOUCHSCREEN, 0);
|
||||
.obtain(lastTouchDown, now, action, pointerCount, pointerProperties, pointerCoords, 0, buttons, 1f, 1f, DEVICE_ID_VIRTUAL, 0, source,
|
||||
0);
|
||||
return device.injectEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue