From ebcf5a4b4f809e48ef26c13e7b525af8d246bbfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 8 Nov 2021 18:41:42 +0100 Subject: [PATCH] =?UTF-8?q?input:=20don=E2=80=99t=20apply=20[scrollback].m?= =?UTF-8?q?ultiplier=20when=20alt=20screen=20is=20in=20use?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #787 --- CHANGELOG.md | 2 ++ input.c | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6b3b1a2..4381b883 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,8 @@ “yes|true|on|1|no|false|off|0”, Previously, anything that did not match “yes|true|on”, or a number greater than 0, was treated as “false”. +* `[scrollback].multiplier` is no longer applied when the alternate + screen is in use (https://codeberg.org/dnkl/foot/issues/787). ### Deprecated diff --git a/input.c b/input.c index 00c4dac1..1428deda 100644 --- a/input.c +++ b/input.c @@ -2151,6 +2151,14 @@ mouse_scroll(struct seat *seat, int amount, enum wl_pointer_axis axis) } } +static float +mouse_scroll_multiplier(const struct terminal *term) +{ + return term->grid == &term->normal + ? term->conf->scrollback.multiplier + : 1.0; +} + static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis, wl_fixed_t value) @@ -2169,9 +2177,8 @@ wl_pointer_axis(void *data, struct wl_pointer *wl_pointer, * Without this, very slow scrolling will never actually scroll * anything. */ - seat->mouse.aggregated[axis] - += seat->wayl->conf->scrollback.multiplier * wl_fixed_to_double(value); - + seat->mouse.aggregated[axis] += + mouse_scroll_multiplier(seat->mouse_focus) * wl_fixed_to_double(value); if (fabs(seat->mouse.aggregated[axis]) < seat->mouse_focus->cell_height) return; @@ -2192,7 +2199,7 @@ wl_pointer_axis_discrete(void *data, struct wl_pointer *wl_pointer, if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) { /* Treat mouse wheel left/right as regular buttons */ } else - amount *= seat->wayl->conf->scrollback.multiplier; + amount *= mouse_scroll_multiplier(seat->mouse_focus); mouse_scroll(seat, amount, axis); }