From: Holger Schemel Date: Sat, 5 Apr 2025 12:31:46 +0000 (+0200) Subject: fixed broken handling of swipe gestures for moving scrollbars X-Git-Tag: 4.4.0.5~5 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=7299194b23059cebfa0c8ada939c4e58ce1378e0;p=rocksndiamonds.git 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. --- 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)