diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-09-29 17:44:32 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-09-29 17:44:32 +0000 |
| commit | 5171abb188b2e4a34e265b1316484400870e0b43 (patch) | |
| tree | 45c614975be6755d5d1dfbe78f4e64f1920abe8c /input.c | |
| parent | Merge branch 'reflow-retain-scrollback-position' into master (diff) | |
| parent | changelog: multiplier: the option belongs to the ‘scrollback’ section (diff) | |
Merge branch 'trackpad-scroll-speed' into master
Closes #144
Diffstat (limited to 'input.c')
| -rw-r--r-- | input.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1688,6 +1688,8 @@ wl_pointer_axis(void *data, struct wl_pointer *wl_pointer, if (seat->mouse.have_discrete) return; + assert(seat->mouse_focus != NULL); + /* * Aggregate scrolled amount until we get at least 1.0 * @@ -1697,10 +1699,12 @@ wl_pointer_axis(void *data, struct wl_pointer *wl_pointer, seat->mouse.axis_aggregated += seat->wayl->conf->scrollback.multiplier * wl_fixed_to_double(value); - if (fabs(seat->mouse.axis_aggregated) >= 1.) { - mouse_scroll(seat, round(seat->mouse.axis_aggregated)); - seat->mouse.axis_aggregated = 0.; - } + if (fabs(seat->mouse.axis_aggregated) < seat->mouse_focus->cell_height) + return; + + int lines = seat->mouse.axis_aggregated / seat->mouse_focus->cell_height; + mouse_scroll(seat, lines); + seat->mouse.axis_aggregated -= (double)lines * seat->mouse_focus->cell_height; } static void |
