From f70359f14fb13f277c65b96f43ec83aba4722457 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 25 Jan 2018 17:17:21 +0100 Subject: [PATCH] Inject mouse events as touchscreen As a mouse, some clicks on close prositions are sometimes not generated on some devices. --- server/src/com/genymobile/scrcpy/EventController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/com/genymobile/scrcpy/EventController.java b/server/src/com/genymobile/scrcpy/EventController.java index 01513ad384..a1a2e20e81 100644 --- a/server/src/com/genymobile/scrcpy/EventController.java +++ b/server/src/com/genymobile/scrcpy/EventController.java @@ -31,7 +31,7 @@ public EventController(DesktopConnection connection) { private void initPointer() { MotionEvent.PointerProperties props = pointerProperties[0]; props.id = 0; - props.toolType = MotionEvent.TOOL_TYPE_MOUSE; + props.toolType = MotionEvent.TOOL_TYPE_FINGER; MotionEvent.PointerCoords coords = pointerCoords[0]; coords.orientation = 0; @@ -108,7 +108,7 @@ private boolean injectMouse(int action, int buttons, Point point) { return false; } setPointerCoords(rawPoint); - MotionEvent event = MotionEvent.obtain(lastMouseDown, now, action, 1, pointerProperties, pointerCoords, 0, buttons, 1f, 1f, 0, 0, InputDevice.SOURCE_MOUSE, 0); + MotionEvent event = MotionEvent.obtain(lastMouseDown, now, action, 1, pointerProperties, pointerCoords, 0, buttons, 1f, 1f, 0, 0, InputDevice.SOURCE_TOUCHSCREEN, 0); return injectEvent(event); }