Forward DOWN and UP separately for middle-click

With this change, the actual HOME is handled by Android on UP on the
device. This is consistent with the keyboard shortcut (MOD+h) behavior.
This commit is contained in:
Romain Vimont 2021-04-16 17:58:22 +02:00
parent f0f96fbc3d
commit 5c65f3c170

View File

@ -647,6 +647,8 @@ input_manager_process_mouse_button(struct input_manager *im,
bool down = event->type == SDL_MOUSEBUTTONDOWN; bool down = event->type == SDL_MOUSEBUTTONDOWN;
if (!im->forward_all_clicks) { if (!im->forward_all_clicks) {
int action = down ? ACTION_DOWN : ACTION_UP;
if (control && event->button == SDL_BUTTON_RIGHT) { if (control && event->button == SDL_BUTTON_RIGHT) {
if (down) { if (down) {
press_back_or_turn_screen_on(im->controller); press_back_or_turn_screen_on(im->controller);
@ -654,9 +656,7 @@ input_manager_process_mouse_button(struct input_manager *im,
return; return;
} }
if (control && event->button == SDL_BUTTON_MIDDLE) { if (control && event->button == SDL_BUTTON_MIDDLE) {
if (down) { action_home(im->controller, action);
action_home(im->controller, ACTION_DOWN | ACTION_UP);
}
return; return;
} }