From a7e3bd32c121eb5d16b0f5a9b722aaec94875c3b Mon Sep 17 00:00:00 2001 From: Quinten Date: Sun, 25 Aug 2024 17:26:13 -0700 Subject: [PATCH] fix weird behavior after normal scrolling --- src/daemon.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/daemon.c b/src/daemon.c index ad2f2d4..aebd167 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -501,8 +501,13 @@ static int event_handler(struct event *ev) * Treat scroll events as mouse buttons so oneshot and the like get * cleared. */ + + kev.code = ev->devev->x == 0 ? ((int)ev->devev->y > 0 ? KEYD_SCROLL_UP : KEYD_SCROLL_DOWN): KEYD_EXTERNAL_MOUSE_BUTTON; + const struct descriptor *mapping = active_kbd? get_active_layer_mapping(active_kbd, kev.code): NULL; if (active_kbd) { - kev.code = ev->devev->x == 0 ? ((int)ev->devev->y > 0 ? KEYD_SCROLL_UP : KEYD_SCROLL_DOWN): KEYD_EXTERNAL_MOUSE_BUTTON; + if (mapping == NULL){ + kev.code = KEYD_EXTERNAL_MOUSE_BUTTON; + } kev.pressed = 1; kev.timestamp = ev->timestamp; @@ -511,7 +516,6 @@ static int event_handler(struct event *ev) kev.pressed = 0; timeout = kbd_process_events(ev->dev->data, &kev, 1); } - const struct descriptor *mapping = active_kbd? get_active_layer_mapping(active_kbd, kev.code): NULL; if (mapping == NULL) { vkbd_mouse_scroll(vkbd, ev->devev->x, ev->devev->y); }