aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-08-03 17:43:06 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-08-03 18:08:39 +0000
commit36468b0406023cb8d66999eaabfdc5bbf94157d8 (patch)
tree5ddd198c1cb58599b19321b095f83da6f3839781
parentinput: hide-when-typing: ignore modifiers (diff)
config: add scrollback.multiplier option
This option is used to multiply the mouse scroll amount for mouse and trackpad based scrollback scrolling. Closes #54.
-rw-r--r--CHANGELOG.md2
-rw-r--r--config.c12
-rw-r--r--config.h1
-rw-r--r--doc/footrc.5.scd4
-rw-r--r--input.c5
5 files changed, 22 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9617fbf8..44e69af3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,8 @@
**pipe-scrollback**, but only pipes the currently selected text, if
any (https://codeberg.org/dnkl/foot/issues/51).
* **cursor.hide-when-typing** option to `footrc.
+* **scrollback.multiplier** option to `footrc`
+ (https://codeberg.org/dnkl/foot/issues/54).
### Deprecated
diff --git a/config.c b/config.c
index 431d7817..68424cca 100644
--- a/config.c
+++ b/config.c
@@ -439,6 +439,17 @@ parse_section_scrollback(const char *key, const char *value, struct config *conf
}
}
+ else if (strcmp(key, "multiplier") == 0) {
+ double multiplier;
+ if (!str_to_double(value, &multiplier)) {
+ LOG_AND_NOTIFY_ERR("%s:%d: [scrollback]: multiplier: "
+ "invalid value: %s", path, lineno, value);
+ return false;
+ }
+
+ conf->scrollback.multiplier = multiplier;
+ }
+
else {
LOG_AND_NOTIFY_ERR("%s:%u: [scrollback]: %s: invalid key", path, lineno, key);
return false;
@@ -1218,6 +1229,7 @@ config_load(struct config *conf, const char *conf_path, bool errors_are_fatal)
.format = SCROLLBACK_INDICATOR_FORMAT_TEXT,
.text = wcsdup(L""),
},
+ .multiplier = 1.,
},
.colors = {
.fg = default_foreground,
diff --git a/config.h b/config.h
index baee177d..a0484e9f 100644
--- a/config.h
+++ b/config.h
@@ -61,6 +61,7 @@ struct config {
wchar_t *text;
} indicator;
+ double multiplier;
} scrollback;
struct {
diff --git a/doc/footrc.5.scd b/doc/footrc.5.scd
index 8fbe7bd6..2832552c 100644
--- a/doc/footrc.5.scd
+++ b/doc/footrc.5.scd
@@ -77,6 +77,10 @@ in this order:
*lines*
Number of scrollback lines. Default: _1000_.
+*multiplier*
+ Amount to multiply mouse scrolling with. It is a decimal number,
+ i.e. fractions are allowed. Default: _1.0_.
+
*indicator-position*
Configures the style of the scrollback position indicator. One of
*none*, *fixed* or *relative*. *none* disables the indicator
diff --git a/input.c b/input.c
index 8d59780f..97563930 100644
--- a/input.c
+++ b/input.c
@@ -1544,7 +1544,8 @@ wl_pointer_axis(void *data, struct wl_pointer *wl_pointer,
* Without this, very slow scrolling will never actually scroll
* anything.
*/
- seat->mouse.axis_aggregated += wl_fixed_to_double(value);
+ 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));
@@ -1561,7 +1562,7 @@ wl_pointer_axis_discrete(void *data, struct wl_pointer *wl_pointer,
struct seat *seat = data;
seat->mouse.have_discrete = true;
- mouse_scroll(seat, discrete);
+ mouse_scroll(seat, seat->wayl->conf->scrollback.multiplier * discrete);
}
static void