From f9938dbf88fbe35415db65824a3345a0117790f9 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 25 Oct 2019 11:04:04 +0200 Subject: [PATCH] Inject button state for touch/mouse events The buttons state was forwarded, but ignored by the server. --- server/src/main/java/com/genymobile/scrcpy/Controller.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/Controller.java b/server/src/main/java/com/genymobile/scrcpy/Controller.java index 19bf9d94..ce02e333 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Controller.java +++ b/server/src/main/java/com/genymobile/scrcpy/Controller.java @@ -82,7 +82,7 @@ public class Controller { injectText(msg.getText()); break; case ControlMessage.TYPE_INJECT_TOUCH_EVENT: - injectTouch(msg.getAction(), msg.getPointerId(), msg.getPosition(), msg.getPressure(), 0); + injectTouch(msg.getAction(), msg.getPointerId(), msg.getPosition(), msg.getPressure(), msg.getButtons()); break; case ControlMessage.TYPE_INJECT_SCROLL_EVENT: injectScroll(msg.getPosition(), msg.getHScroll(), msg.getVScroll()); @@ -177,7 +177,7 @@ public class Controller { } MotionEvent event = MotionEvent.obtain(lastTouchDown, now, action, pointerCount, pointerProperties, - pointerCoords, 0, 0, 1f, 1f, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0); + pointerCoords, 0, buttons, 1f, 1f, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0); return injectEvent(event); }