Skip to content

Commit

Permalink
Log finger event coordinates in verbose log
Browse files Browse the repository at this point in the history
I wanted to automate a few actions using 'adb shell input' commands, but
it requires pixel coordinates. Logging finger event coordinates from
scrcpy seemed like the easiest way to achieve that.
  • Loading branch information
intgr committed Jun 10, 2021
1 parent 506f918 commit 728f658
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/src/input_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,12 @@ input_manager_process_touch(struct input_manager *im,
const SDL_TouchFingerEvent *event) {
struct control_msg msg;
if (convert_touch(event, im->screen, &msg)) {
if (msg.inject_touch_event.action != AMOTION_EVENT_ACTION_MOVE) {
LOGV("Finger %s at %ux%u",
msg.inject_touch_event.pressure ? "down" : "up",
msg.inject_touch_event.position.point.x,
msg.inject_touch_event.position.point.y);
}
if (!controller_push_msg(im->controller, &msg)) {
LOGW("Could not request 'inject touch event'");
}
Expand Down Expand Up @@ -740,6 +746,10 @@ input_manager_process_mouse_button(struct input_manager *im,
return;
}

LOGV("Mouse %s at %ux%u", msg.inject_touch_event.pressure ? "down" : "up",
msg.inject_touch_event.position.point.x,
msg.inject_touch_event.position.point.y);

if (!controller_push_msg(im->controller, &msg)) {
LOGW("Could not request 'inject mouse button event'");
return;
Expand Down

0 comments on commit 728f658

Please sign in to comment.