mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-12-17 21:44:20 +01: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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user