From 40fca82b6002662c43a054079c0b8e0cbaa7d692 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sun, 2 Jan 2022 00:11:00 +0100 Subject: [PATCH] Forward all motion events to mouse processors The decision to not send motion events when no click is pressed is specific to Android mouse injection. Other mouse processors (e.g. for HID mouse) will need to receive all events. --- app/src/input_manager.c | 8 -------- app/src/mouse_inject.c | 5 +++++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/src/input_manager.c b/app/src/input_manager.c index cc7883d9..e407a541 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -632,14 +632,6 @@ static void input_manager_process_mouse_motion(struct input_manager *im, const SDL_MouseMotionEvent *event) { - uint32_t mask = SDL_BUTTON_LMASK; - if (im->forward_all_clicks) { - mask |= SDL_BUTTON_MMASK | SDL_BUTTON_RMASK; - } - if (!(event->state & mask)) { - // do not send motion events when no click is pressed - return; - } if (event->which == SDL_TOUCH_MOUSEID) { // simulated from touch events, so it's a duplicate return; diff --git a/app/src/mouse_inject.c b/app/src/mouse_inject.c index dcb4f611..8a4a0531 100644 --- a/app/src/mouse_inject.c +++ b/app/src/mouse_inject.c @@ -58,6 +58,11 @@ convert_touch_action(enum sc_touch_action action) { static void sc_mouse_processor_process_mouse_motion(struct sc_mouse_processor *mp, const struct sc_mouse_motion_event *event) { + if (!event->buttons_state) { + // Do not send motion events when no click is pressed + return; + } + struct sc_mouse_inject *mi = DOWNCAST(mp); struct control_msg msg = {