mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-02 06:08:53 +00:00
Preserve original scroll values in mouse event
Clamp scroll values to [-1, 1] only for the SDK mouse. HID mouse implementations perform their own clamping to [-127, 127] (in hid_mouse.c). PR #6172 <https://github.com/Genymobile/scrcpy/pull/6172>
This commit is contained in:
parent
98d30288f7
commit
9787fe5d26
2 changed files with 6 additions and 6 deletions
|
@ -897,11 +897,11 @@ sc_input_manager_process_mouse_wheel(struct sc_input_manager *im,
|
||||||
struct sc_mouse_scroll_event evt = {
|
struct sc_mouse_scroll_event evt = {
|
||||||
.position = sc_input_manager_get_position(im, mouse_x, mouse_y),
|
.position = sc_input_manager_get_position(im, mouse_x, mouse_y),
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 18)
|
#if SDL_VERSION_ATLEAST(2, 0, 18)
|
||||||
.hscroll = CLAMP(event->preciseX, -1.0f, 1.0f),
|
.hscroll = event->preciseX,
|
||||||
.vscroll = CLAMP(event->preciseY, -1.0f, 1.0f),
|
.vscroll = event->preciseY,
|
||||||
#else
|
#else
|
||||||
.hscroll = CLAMP(event->x, -1, 1),
|
.hscroll = event->x,
|
||||||
.vscroll = CLAMP(event->y, -1, 1),
|
.vscroll = event->y,
|
||||||
#endif
|
#endif
|
||||||
.buttons_state = im->mouse_buttons_state,
|
.buttons_state = im->mouse_buttons_state,
|
||||||
};
|
};
|
||||||
|
|
|
@ -113,8 +113,8 @@ sc_mouse_processor_process_mouse_scroll(struct sc_mouse_processor *mp,
|
||||||
.type = SC_CONTROL_MSG_TYPE_INJECT_SCROLL_EVENT,
|
.type = SC_CONTROL_MSG_TYPE_INJECT_SCROLL_EVENT,
|
||||||
.inject_scroll_event = {
|
.inject_scroll_event = {
|
||||||
.position = event->position,
|
.position = event->position,
|
||||||
.hscroll = event->hscroll,
|
.hscroll = CLAMP(event->hscroll, -1, 1),
|
||||||
.vscroll = event->vscroll,
|
.vscroll = CLAMP(event->vscroll, -1, 1),
|
||||||
.buttons = convert_mouse_buttons(event->buttons_state),
|
.buttons = convert_mouse_buttons(event->buttons_state),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue