Merge branch 'trackpad-scroll-speed' into master

Closes #144
This commit is contained in:
Daniel Eklöf 2020-09-29 19:44:32 +02:00
commit 5171abb188
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 25 additions and 7 deletions

View file

@ -17,6 +17,11 @@
## Unreleased
### Added
### Changed
* Default value of the **scrollback.multiplier** option in `foot.ini`
from `1.0` to `3.0`.
### Deprecated
### Removed
### Fixed
@ -29,6 +34,15 @@
(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).
* 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

View file

@ -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,

View file

@ -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

View file

@ -12,7 +12,7 @@
[scrollback]
# lines=1000
# multiplier=1.0
# multiplier=3.0
# indicator-position=relative
# indicator-format=

12
input.c
View file

@ -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