Skip to content

Display and control your Android device

Inject mouse events as touchscreen

Romain Vimontf70359f14fb1
diff --git a/server/src/com/genymobile/scrcpy/EventController.java b/server/src/com/genymobile/scrcpy/EventController.java
index 01513ad3..a1a2e20e 100644
--- a/server/src/com/genymobile/scrcpy/EventController.java
+++ b/server/src/com/genymobile/scrcpy/EventController.java
@@ -31,7 +31,7 @@ public class EventController {
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 @@ public class EventController {
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);
}