From c66319314e2099c2c4f4d05c3d8c1e196ef6bdea Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 23 Mar 2024 09:00:55 +0400 Subject: Fix vertical wheel binds on winit --- src/input.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/input.rs') diff --git a/src/input.rs b/src/input.rs index fd19e5c4..c4558cee 100644 --- a/src/input.rs +++ b/src/input.rs @@ -1121,6 +1121,10 @@ impl State { let comp_mod = self.backend.mod_key(); let mods = self.niri.seat.get_keyboard().unwrap().modifier_state(); + // Winit sends scroll events where both directions are set at once, so we can't early + // return after handling just one. + let mut handled = false; + if let Some(v120) = horizontal_amount_v120 { let config = self.niri.config.borrow(); let bindings = &config.binds; @@ -1144,7 +1148,8 @@ impl State { self.handle_bind(left.clone()); } } - return; + + handled = true; } else { self.niri.horizontal_wheel_tracker.reset(); } @@ -1171,11 +1176,16 @@ impl State { self.handle_bind(up.clone()); } } - return; + + handled = true; } else { self.niri.vertical_wheel_tracker.reset(); } } + + if handled { + return; + } } let horizontal_amount = event.amount(Axis::Horizontal).unwrap_or_else(|| { -- cgit