From b65886d31890df93030b7c8b42ccd3fe5bdc37e1 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Tue, 8 Jun 2021 19:14:20 +0300 Subject: [PATCH] Log finger event coordinates in verbose log 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. --- app/src/input_manager.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/input_manager.c b/app/src/input_manager.c index b008c4db22..0a1592bd38 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -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'"); } @@ -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;