Skip to content

Display and control your Android device

Reverse horizontal scrolling behavior

Romain Vimontf9a63ec272a6
diff --git a/app/src/convert.c b/app/src/convert.c
index ec6f1de0..2c17f948 100644
--- a/app/src/convert.c
+++ b/app/src/convert.c
@@ -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;