From f9a63ec272a6051bd2f1a92a580640018124a34c Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 12 Mar 2018 09:37:46 +0100 Subject: [PATCH] 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. Reverse the horizontal. Fixes . --- app/src/convert.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 + // + to->scroll_event.hscroll = -mul * from->x; to->scroll_event.vscroll = mul * from->y; return SDL_TRUE;