aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorelipp <1861512+elipp@users.noreply.github.com>2024-11-03 20:43:03 +0200
committerGitHub <noreply@github.com>2024-11-03 18:43:03 +0000
commit8b39f986d9a2c99e87a9afc2e9d448a2c5280189 (patch)
tree16cd551ed048e754cd185967089548592ebe278c /src
parent354c365a0345787f6b98ee2d77d4516150a61254 (diff)
downloadniri-8b39f986d9a2c99e87a9afc2e9d448a2c5280189.tar.gz
niri-8b39f986d9a2c99e87a9afc2e9d448a2c5280189.tar.bz2
niri-8b39f986d9a2c99e87a9afc2e9d448a2c5280189.zip
Implement scroll_factor mouse and touchpad setting (#730)
* Implement scroll_factor mouse and touchpad setting * Change to FloatOrInt, add docs * Also change v120 values --------- Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/input/mod.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs
index 5800b8a4..9936102e 100644
--- a/src/input/mod.rs
+++ b/src/input/mod.rs
@@ -1881,14 +1881,23 @@ impl State {
}
}
+ let scroll_factor = match source {
+ AxisSource::Wheel => self.niri.config.borrow().input.mouse.scroll_factor.0,
+ AxisSource::Finger => self.niri.config.borrow().input.touchpad.scroll_factor.0,
+ _ => 1.0,
+ };
+
let horizontal_amount = horizontal_amount.unwrap_or_else(|| {
// Winit backend, discrete scrolling.
horizontal_amount_v120.unwrap_or(0.0) / 120. * 15.
- });
+ }) * scroll_factor;
let vertical_amount = vertical_amount.unwrap_or_else(|| {
// Winit backend, discrete scrolling.
vertical_amount_v120.unwrap_or(0.0) / 120. * 15.
- });
+ }) * scroll_factor;
+
+ let horizontal_amount_v120 = horizontal_amount_v120.map(|x| x * scroll_factor);
+ let vertical_amount_v120 = vertical_amount_v120.map(|x| x * scroll_factor);
let mut frame = AxisFrame::new(event.time_msec()).source(source);
if horizontal_amount != 0.0 {