summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Bensmann <johannes.bensmann@gmx.de>2021-12-08 21:37:18 +0100
committerJohannes Bensmann <johannes.bensmann@gmx.de>2021-12-08 21:37:18 +0100
commitfbbb18659ca0fe54592500b28665c3d960ba287a (patch)
tree8cd846101a9536d8fea0f9ded090253fde80913d
parent8b2bdb28bd39217196575a4fe4fe86e30fb3b2fa (diff)
fixed scrolling not working the first time
-rw-r--r--xmouseless.c8
1 files changed, 8 insertions, 0 deletions
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);
}
}