Handle down/up actions separately for HOME
Pressing middle-click generated both the DOWN and UP keyevent HOME. Instead, generate DOWN on button pressed and UP on button released. Ref #1062 <https://github.com/Genymobile/scrcpy/issues/1062>
This commit is contained in:
parent
83d48267a7
commit
149702753f
@ -521,31 +521,36 @@ input_manager_process_mouse_button(struct input_manager *im,
|
|||||||
// simulated from touch events, so it's a duplicate
|
// simulated from touch events, so it's a duplicate
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event->type == SDL_MOUSEBUTTONDOWN) {
|
|
||||||
if (control && event->button == SDL_BUTTON_RIGHT) {
|
|
||||||
press_back_or_turn_screen_on(im->controller);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (control && event->button == SDL_BUTTON_MIDDLE) {
|
|
||||||
action_home(im->controller, ACTION_DOWN | ACTION_UP);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// double-click on black borders resize to fit the device screen
|
// double-click on black borders resize to fit the device screen
|
||||||
if (event->button == SDL_BUTTON_LEFT && event->clicks == 2) {
|
if (event->type == SDL_MOUSEBUTTONDOWN
|
||||||
bool outside =
|
&& event->button == SDL_BUTTON_LEFT
|
||||||
is_outside_device_screen(im, event->x, event->y);
|
&& event->clicks == 2) {
|
||||||
|
bool outside = is_outside_device_screen(im, event->x, event->y);
|
||||||
if (outside) {
|
if (outside) {
|
||||||
screen_resize_to_fit(im->screen);
|
screen_resize_to_fit(im->screen);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// otherwise, send the click event to the device
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!control) {
|
if (!control) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event->button == SDL_BUTTON_MIDDLE) {
|
||||||
|
int action = event->type == SDL_MOUSEBUTTONDOWN ? ACTION_DOWN
|
||||||
|
: ACTION_UP;
|
||||||
|
action_home(im->controller, action);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event->button == SDL_BUTTON_RIGHT) {
|
||||||
|
if (event->type == SDL_MOUSEBUTTONDOWN) {
|
||||||
|
press_back_or_turn_screen_on(im->controller);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct control_msg msg;
|
struct control_msg msg;
|
||||||
if (convert_mouse_button(event, im->screen, &msg)) {
|
if (convert_mouse_button(event, im->screen, &msg)) {
|
||||||
if (!controller_push_msg(im->controller, &msg)) {
|
if (!controller_push_msg(im->controller, &msg)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user