Skip to content

Commit

Permalink
Forward mouse motion only on main clicks
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
rom1v committed Jun 19, 2021
1 parent ea01cec commit 0fd5622
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/src/input_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0fd5622

Please sign in to comment.