Skip to content

Commit

Permalink
Inject mouse events as touchscreen
Browse files Browse the repository at this point in the history
As a mouse, some clicks on close prositions are sometimes not generated
on some devices.
  • Loading branch information
rom1v committed Jan 25, 2018
1 parent 1930c81 commit f70359f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/src/com/genymobile/scrcpy/EventController.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit f70359f

Please sign in to comment.