From fbbb18659ca0fe54592500b28665c3d960ba287a Mon Sep 17 00:00:00 2001 From: Johannes Bensmann Date: Wed, 8 Dec 2021 21:37:18 +0100 Subject: fixed scrolling not working the first time --- xmouseless.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xmouseless.c b/xmouseless.c index e7dfa1f..b5ce68a 100644 --- a/xmouseless.c +++ b/xmouseless.c @@ -215,6 +215,14 @@ void handle_key(KeyCode keycode, Bool is_press) { int sign = is_press ? 1 : -1; scrollinfo.speed_x += sign * scroll_bindings[i].x; scrollinfo.speed_y += sign * scroll_bindings[i].y; + + /* scroll once, workaround for scrolling not working the first time */ + int scroll_x, scroll_y = 0; + if (scrollinfo.speed_x < 0) scroll_x = -1; + if (scrollinfo.speed_x > 0) scroll_x = 1; + if (scrollinfo.speed_y < 0) scroll_y = -1; + if (scrollinfo.speed_y > 0) scroll_y = 1; + scroll(scroll_x, scroll_y); } } -- cgit v1.2.3