From a0ce7e40afb140be252c97b97667a5ba28b1593a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 27 Sep 2020 11:11:45 +0200 Subject: [PATCH 1/5] input: trackpad scroll: correctly convert pixel movements to line movements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Trackpad scroll movements are in pixels. Foot previously “translated” these directly to line movements (i.e. a one pixel scroll event was translated into a one line scroll). Now we use the line height of the terminal and correctly convert pixels to lines. This makes the trackpad scroll speed in foot consistent with the scroll speed in e.g. Alacritty and Kitty. --- CHANGELOG.md | 4 ++++ input.c | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2b30c01..0eb90527 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,10 @@ (https://codeberg.org/dnkl/foot/issues/141). * Scrollback position is now retained when resizing the window (https://codeberg.org/dnkl/foot/issues/142). +* Trackpad scrolling speed. Note that it is much slower compared to + previous foot versions. Use the **multiplier** option in `foot.ini` + if you find the new speed too slow + (https://codeberg.org/dnkl/foot/issues/144). ### Security diff --git a/input.c b/input.c index cc14d41b..20c1381c 100644 --- a/input.c +++ b/input.c @@ -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 From 08c1b35614fda9b380d73aa46eed7a80392d375e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 29 Sep 2020 09:49:21 +0200 Subject: [PATCH 2/5] changelog: reword trackpad scrolling speed entry --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eb90527..49cdb284 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,11 @@ previous foot versions. Use the **multiplier** option in `foot.ini` if you find the new speed too slow (https://codeberg.org/dnkl/foot/issues/144). +* Trackpad scrolling speed to better match the mouse scrolling speed, + and to be consistent with other (Wayland) terminal emulators. Note + that it is (much) slower compared to previous foot versions. Use the + **multiplier** option in `foot.ini` if you find the new speed too + slow (https://codeberg.org/dnkl/foot/issues/144). ### Security From ebd1476bafe1be10227f32fd8b3e80ba0aebf637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 29 Sep 2020 09:50:17 +0200 Subject: [PATCH 3/5] config: change default multiplier from 1.0 -> 3.0 --- config.c | 2 +- doc/foot.ini.5.scd | 2 +- foot.ini | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config.c b/config.c index 418c9c37..c69af59d 100644 --- a/config.c +++ b/config.c @@ -1869,7 +1869,7 @@ config_load(struct config *conf, const char *conf_path, .format = SCROLLBACK_INDICATOR_FORMAT_TEXT, .text = wcsdup(L""), }, - .multiplier = 1., + .multiplier = 3., }, .colors = { .fg = default_foreground, diff --git a/doc/foot.ini.5.scd b/doc/foot.ini.5.scd index 7467d0b8..e51a5470 100644 --- a/doc/foot.ini.5.scd +++ b/doc/foot.ini.5.scd @@ -99,7 +99,7 @@ in this order: *multiplier* Amount to multiply mouse scrolling with. It is a decimal number, - i.e. fractions are allowed. Default: _1.0_. + i.e. fractions are allowed. Default: _3.0_. *indicator-position* Configures the style of the scrollback position indicator. One of diff --git a/foot.ini b/foot.ini index 5e8dc47e..952bf00c 100644 --- a/foot.ini +++ b/foot.ini @@ -12,7 +12,7 @@ [scrollback] # lines=1000 -# multiplier=1.0 +# multiplier=3.0 # indicator-position=relative # indicator-format= From 2cee11d74d21bb23a8499da0c226cd4f7286e9db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 29 Sep 2020 19:41:53 +0200 Subject: [PATCH 4/5] changelog: multiplier default value changed from 1.0 -> 3.0 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49cdb284..2344b81f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,11 @@ ## Unreleased ### Added ### Changed + +* Default value of the **multiplier** option in `foot.ini` from `1.0` + to `3.0`. + + ### Deprecated ### Removed ### Fixed From 9c84b08ae4da3ef174ecf32882a31f9b130ab8aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 29 Sep 2020 19:43:39 +0200 Subject: [PATCH 5/5] =?UTF-8?q?changelog:=20multiplier:=20the=20option=20b?= =?UTF-8?q?elongs=20to=20the=20=E2=80=98scrollback=E2=80=99=20section?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2344b81f..89f0de13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,8 +18,8 @@ ### Added ### Changed -* Default value of the **multiplier** option in `foot.ini` from `1.0` - to `3.0`. +* Default value of the **scrollback.multiplier** option in `foot.ini` + from `1.0` to `3.0`. ### Deprecated