From 4ce3fe22858ed86480cead7302afa40c7a2a40fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 23 Jun 2021 11:21:26 +0200 Subject: [PATCH] bar/wayland: fix mouse wheel up not being emitted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We emit mouse wheel up events when the ‘discrete’ counter is negative. Thus, when looping, we need to loop to its *absolute* value. --- bar/wayland.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bar/wayland.c b/bar/wayland.c index 77474eb..19470fc 100644 --- a/bar/wayland.c +++ b/bar/wayland.c @@ -377,7 +377,9 @@ wl_pointer_axis_discrete(void *data, struct wl_pointer *wl_pointer, ? MOUSE_BTN_WHEEL_DOWN : MOUSE_BTN_WHEEL_UP; - for (int32_t i = 0; i < discrete; i++) { + int count = abs(discrete); + + for (int32_t i = 0; i < count; i++) { backend->bar_on_mouse( backend->bar, ON_MOUSE_CLICK, btn, seat->pointer.x, seat->pointer.y);