From bef343ec9957eca3c1ef0c5a38774feecb0d0708 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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/daemon.c b/src/daemon.c index ad2f2d4..1681384 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -501,8 +501,14 @@ static int event_handler(struct event *ev) * Treat scroll events as mouse buttons so oneshot and the like get * cleared. */ + 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; + } + else { + kev.code = ev->devev->x == 0 ? ((int)ev->devev->y > 0 ? KEYD_SCROLL_UP : KEYD_SCROLL_DOWN): KEYD_EXTERNAL_MOUSE_BUTTON; + } kev.pressed = 1; kev.timestamp = ev->timestamp; @@ -511,7 +517,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); }