2
0
mirror of https://github.com/Genymobile/scrcpy synced 2025-08-31 06:15:25 +00:00

Pass buttons state in scroll events

A scroll event might be produced when a mouse button is pressed (for
example when scrolling while selecting a text). For consistency, pass
the actual buttons state (instead of 0).

In practice, it seems that this use case does not work properly with
Android event injection, but it will work with HID mouse.
This commit is contained in:
Romain Vimont
2021-12-31 10:38:05 +01:00
parent 7121a0dc53
commit 924375487e
10 changed files with 24 additions and 11 deletions

View File

@@ -810,7 +810,7 @@ input_manager_process_mouse_wheel(struct input_manager *im,
// mouse_x and mouse_y are expressed in pixels relative to the window
int mouse_x;
int mouse_y;
SDL_GetMouseState(&mouse_x, &mouse_y);
uint32_t buttons = SDL_GetMouseState(&mouse_x, &mouse_y);
struct sc_mouse_scroll_event evt = {
.position = {
@@ -820,6 +820,8 @@ input_manager_process_mouse_wheel(struct input_manager *im,
},
.hscroll = event->x,
.vscroll = event->y,
.buttons_state =
sc_mouse_buttons_state_from_sdl(buttons, im->forward_all_clicks),
};
im->mp->ops->process_mouse_scroll(im->mp, &evt);