aboutsummaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
Diffstat (limited to 'src/input')
-rw-r--r--src/input/mod.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/input/mod.rs b/src/input/mod.rs
index c9ab0b30..12746376 100644
--- a/src/input/mod.rs
+++ b/src/input/mod.rs
@@ -2086,6 +2086,8 @@ impl State {
}
fn on_pointer_axis<I: InputBackend>(&mut self, event: I::PointerAxisEvent) {
+ let pointer = &self.niri.seat.get_pointer().unwrap();
+
let source = event.source();
// We received an event for the regular pointer, so show it now. This is also needed for
@@ -2232,12 +2234,20 @@ impl State {
}
}
+ self.update_pointer_contents();
+
let scroll_factor = match source {
AxisSource::Wheel => self.niri.config.borrow().input.mouse.scroll_factor,
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 horizontal_amount = horizontal_amount.unwrap_or_else(|| {
// Winit backend, discrete scrolling.
@@ -2278,9 +2288,6 @@ impl State {
}
}
- self.update_pointer_contents();
-
- let pointer = &self.niri.seat.get_pointer().unwrap();
pointer.axis(self, frame);
pointer.frame(self);
}