aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-03-22 09:41:10 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-03-22 09:41:10 +0400
commit977f1487c22b5d30051939b9572b99a31a9775ff (patch)
tree9751866fc766eb63f6644d57d724dfc0ff241acb
parentfbe021fbdfb3623bf613e71ddf6b1cf220c1b420 (diff)
downloadniri-977f1487c22b5d30051939b9572b99a31a9775ff.tar.gz
niri-977f1487c22b5d30051939b9572b99a31a9775ff.tar.bz2
niri-977f1487c22b5d30051939b9572b99a31a9775ff.zip
input: Fix discrete axis value on winit
-rw-r--r--src/input.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/input.rs b/src/input.rs
index a48a299a..80000efe 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -1078,15 +1078,18 @@ impl State {
fn on_pointer_axis<I: InputBackend>(&mut self, event: I::PointerAxisEvent) {
let source = event.source();
- let horizontal_amount = event
- .amount(Axis::Horizontal)
- .unwrap_or_else(|| event.amount_v120(Axis::Horizontal).unwrap_or(0.0) * 3.0 / 120.);
- let vertical_amount = event
- .amount(Axis::Vertical)
- .unwrap_or_else(|| event.amount_v120(Axis::Vertical).unwrap_or(0.0) * 3.0 / 120.);
let horizontal_amount_v120 = event.amount_v120(Axis::Horizontal);
let vertical_amount_v120 = event.amount_v120(Axis::Vertical);
+ let horizontal_amount = event.amount(Axis::Horizontal).unwrap_or_else(|| {
+ // Winit backend, discrete scrolling.
+ horizontal_amount_v120.unwrap_or(0.0) / 120. * 15.
+ });
+ let vertical_amount = event.amount(Axis::Vertical).unwrap_or_else(|| {
+ // Winit backend, discrete scrolling.
+ vertical_amount_v120.unwrap_or(0.0) / 120. * 15.
+ });
+
let mut frame = AxisFrame::new(event.time_msec()).source(source);
if horizontal_amount != 0.0 {
frame = frame