Browse Source

Allow continuous scrolling

master
Constantin Fürst 3 years ago
parent
commit
4867d490ec
  1. 11
      key-actions.c

11
key-actions.c

@ -13,6 +13,8 @@ extern keym_state state;
/* internally-linked helpers */ /* internally-linked helpers */
extern void set_x_update(uint32_t tv_usec);
static inline int enum_to_mouse_button(unsigned int val) { static inline int enum_to_mouse_button(unsigned int val) {
switch (val) { switch (val) {
case MB_Left: return 1; case MB_Left: return 1;
@ -59,7 +61,12 @@ void mouse_move(const uint32_t* a) {
} }
void mouse_scroll(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) { 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; case CA_SPEED_LOW: state.speed = released ? 1 : 2; break;
default: break; default: break;
} }
}
}
Loading…
Cancel
Save