From 7db0189f23bc3dd3802c751ed44a1dd367523a5a Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sun, 20 Jun 2021 00:42:55 +0200 Subject: [PATCH] Forward mouse motion only on main clicks Mouse motion events were forwarded as soon as any mouse button was pressed. Instead, only consider left-click (and also middle-click and right-click if --forward-all-clicks is enabled). --- app/src/input_manager.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/input_manager.c b/app/src/input_manager.c index b008c4db..a5d0ad07 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -595,8 +595,12 @@ convert_mouse_motion(const SDL_MouseMotionEvent *from, struct screen *screen, static void input_manager_process_mouse_motion(struct input_manager *im, const SDL_MouseMotionEvent *event) { - if (!event->state) { - // do not send motion events when no button is pressed + 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) {