fixed broken handling of swipe gestures for moving scrollbars
authorHolger Schemel <info@artsoft.org>
Sat, 5 Apr 2025 12:31:46 +0000 (14:31 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 5 Apr 2025 12:40:27 +0000 (14:40 +0200)
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

index 4e815ef68dbc8102de712d58ddf2ffdc88c64167..7a70da6cac8ceb25b8632f88db0a0a4429da89f6 100644 (file)
@@ -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)