Reverse horizontal scrolling behavior
The SDL mouse wheel event seems inconsistent between horizontal and vertical scrolling. > Movements to the left generate negative x values and to the right > generate positive x values. Movements down (scroll backward) generate > negative y values and up (scroll forward) generate positive y values. <https://wiki.libsdl.org/SDL_MouseWheelEvent#Remarks> Reverse the horizontal. Fixes <https://github.com/Genymobile/scrcpy/issues/49>.
This commit is contained in:
parent
f6d0893316
commit
f9a63ec272
1 changed files with 4 additions and 1 deletions
|
@ -172,7 +172,10 @@ SDL_bool mouse_wheel_from_sdl_to_android(const SDL_MouseWheelEvent *from,
|
|||
to->scroll_event.position = position;
|
||||
|
||||
int mul = from->direction == SDL_MOUSEWHEEL_NORMAL ? 1 : -1;
|
||||
to->scroll_event.hscroll = mul * from->x;
|
||||
// SDL behavior seems inconsistent between horizontal and vertical scrolling
|
||||
// so reverse the horizontal
|
||||
// <https://wiki.libsdl.org/SDL_MouseWheelEvent#Remarks>
|
||||
to->scroll_event.hscroll = -mul * from->x;
|
||||
to->scroll_event.vscroll = mul * from->y;
|
||||
|
||||
return SDL_TRUE;
|
||||
|
|
Loading…
Reference in a new issue