Reformat scroll factor computation

This commit is contained in:
Ivan Molodetskikh
2025-04-20 12:37:31 +03:00
parent ffd6acc0aa
commit ee4c5e23ab
+3 -2
View File
@@ -2571,13 +2571,14 @@ impl State {
AxisSource::Finger => self.niri.config.borrow().input.touchpad.scroll_factor,
_ => None,
};
let scroll_factor = scroll_factor.map(|x| x.0).unwrap_or(1.);
let window_scroll_factor = pointer
.current_focus()
.map(|focused| self.niri.find_root_shell_surface(&focused))
.and_then(|root| self.niri.layout.find_window_and_output(&root).unzip().0)
.and_then(|window| window.rules().scroll_factor);
let scroll_factor =
scroll_factor.map(|x| x.0).unwrap_or(1.) * window_scroll_factor.unwrap_or(1.);
let scroll_factor = scroll_factor * window_scroll_factor.unwrap_or(1.);
let horizontal_amount = horizontal_amount.unwrap_or_else(|| {
// Winit backend, discrete scrolling.