Skip to content

Commit

Permalink
fix weird behavior after normal scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
quintenroets committed Aug 26, 2024
1 parent 489d77b commit bef343e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
Expand Down

0 comments on commit bef343e

Please sign in to comment.