Skip to content

Commit

Permalink
Prevent forwarding only "mouse released" events
Browse files Browse the repository at this point in the history
Some mouse clicks DOWN are captured for shortcuts, but the matching UP
events were still forwarded to the device.

Instead, capture both DOWN and UP for shortcuts, and do nothing on UP.

PR #2259 <#2259>
Refs #2258 <#2258>
  • Loading branch information
rom1v committed Apr 17, 2021
1 parent edee69d commit 8cc057c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions app/src/input_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,13 +646,17 @@ input_manager_process_mouse_button(struct input_manager *im,
}

bool down = event->type == SDL_MOUSEBUTTONDOWN;
if (!im->forward_all_clicks && down) {
if (!im->forward_all_clicks) {
if (control && event->button == SDL_BUTTON_RIGHT) {
press_back_or_turn_screen_on(im->controller);
if (down) {
press_back_or_turn_screen_on(im->controller);
}
return;
}
if (control && event->button == SDL_BUTTON_MIDDLE) {
action_home(im->controller, ACTION_DOWN | ACTION_UP);
if (down) {
action_home(im->controller, ACTION_DOWN | ACTION_UP);
}
return;
}

Expand All @@ -665,7 +669,9 @@ input_manager_process_mouse_button(struct input_manager *im,
bool outside = x < r->x || x >= r->x + r->w
|| y < r->y || y >= r->y + r->h;
if (outside) {
screen_resize_to_fit(im->screen);
if (down) {
screen_resize_to_fit(im->screen);
}
return;
}
}
Expand Down

0 comments on commit 8cc057c

Please sign in to comment.