Forward DOWN and UP separately for middle-click

As a consequence of this change, the HOME button is now handled by
Android on mouse released. This is consistent with the keyboard shortcut
(MOD+h) behavior.

PR #2259 <https://github.com/Genymobile/scrcpy/pull/2259>
Refs #2258 <https://github.com/Genymobile/scrcpy/pull/2258>
This commit is contained in:
Romain Vimont 2021-04-16 17:58:22 +02:00
parent 8cc057c8f1
commit 964b6d2243

View file

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