From 783eb95795a1e13dcf7f7808f6f85eeec4bdfce7 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 30 Sep 2019 21:17:22 +0200 Subject: [PATCH] fix timestamp --- server/src/main/java/com/genymobile/scrcpy/Controller.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/Controller.java b/server/src/main/java/com/genymobile/scrcpy/Controller.java index 326198ad..ec9d7d82 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Controller.java +++ b/server/src/main/java/com/genymobile/scrcpy/Controller.java @@ -191,9 +191,7 @@ public class Controller { private boolean injectTouch(int action, long fingerId, Position position, float pressure) { long now = SystemClock.uptimeMillis(); - if (action == MotionEvent.ACTION_DOWN) { - lastTouchDown = now; - } + Point point = device.getPhysicalPoint(position); if (point == null) { // ignore event @@ -226,7 +224,10 @@ public class Controller { } else if (action == MotionEvent.ACTION_DOWN) { action = MotionEvent.ACTION_POINTER_DOWN | (fingerIndex << MotionEvent.ACTION_POINTER_INDEX_SHIFT); } + } else if (action == MotionEvent.ACTION_DOWN) { + lastTouchDown = now; } + MotionEvent event = MotionEvent.obtain(lastTouchDown, now, action, pointerCount, touchPointerProperties, touchPointerCoords, 0, 0, 1f, 1f, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0); return injectEvent(event);