diff --git a/key-actions.c b/key-actions.c index fcc2ab9..853e1b9 100644 --- a/key-actions.c +++ b/key-actions.c @@ -13,6 +13,8 @@ extern keym_state state; /* internally-linked helpers */ +extern void set_x_update(uint32_t tv_usec); + static inline int enum_to_mouse_button(unsigned int val) { switch (val) { case MB_Left: return 1; @@ -59,7 +61,12 @@ void mouse_move(const uint32_t* a) { } void mouse_scroll(const uint32_t* a) { - XTestFakeButtonEvent(state.display, enum_to_scroll_button(state_demasker(a)), state_released(a), 1); + if (!state_released(a)) { + set_x_update(500 * speeds[state.speed]); + XTestFakeButtonEvent(state.display, enum_to_scroll_button(state_demasker(a)), True, 1); + XTestFakeButtonEvent(state.display, enum_to_scroll_button(state_demasker(a)), False, 1); + set_x_update(speeds[state.speed]); + } } void control_action(const uint32_t* a) { @@ -71,4 +78,4 @@ void control_action(const uint32_t* a) { case CA_SPEED_LOW: state.speed = released ? 1 : 2; break; default: break; } -} \ No newline at end of file +}