From 7299194b23059cebfa0c8ada939c4e58ce1378e0 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 5 Apr 2025 14:31:46 +0200 Subject: [PATCH] fixed broken handling of swipe gestures for moving scrollbars The most important fix is never calling "HandleButton()" with a button value of "0" anymore, which caused major trouble on most screens using scrollbars. Another bug was that diagonal swipe gestures were handled as horizontal scrollbar movements only, which is now also corrected. --- src/events.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/events.c b/src/events.c index 4e815ef6..7a70da6c 100644 --- a/src/events.c +++ b/src/events.c @@ -584,8 +584,6 @@ static void HandleWheelEventButton(int button_nr, int steps) void HandleWheelEvent(WheelEvent *event) { - int button_nr; - #if DEBUG_EVENTS_WHEEL #if 1 Debug("event:wheel", "mouse == %d, x/y == %d/%d\n", @@ -599,12 +597,11 @@ void HandleWheelEvent(WheelEvent *event) #endif #endif - button_nr = (event->x < 0 ? MB_WHEEL_LEFT : - event->x > 0 ? MB_WHEEL_RIGHT : - event->y < 0 ? MB_WHEEL_DOWN : - event->y > 0 ? MB_WHEEL_UP : 0); + if (event->x != 0) + HandleWheelEventButton(event->x < 0 ? MB_WHEEL_LEFT : MB_WHEEL_RIGHT, ABS(event->x)); - HandleWheelEventButton(button_nr, (event->x ? ABS(event->x) : ABS(event->y))); + if (event->y != 0) + HandleWheelEventButton(event->y < 0 ? MB_WHEEL_DOWN : MB_WHEEL_UP, ABS(event->y)); } void HandleWindowEvent(WindowEvent *event) -- 2.34.1