forge
Explore
Log in

Don't you dare go Hollow

Fix vertical wheel binds on winit

Browse files at this commit

c66319314e2099c2c4f4d05c3d8c1e196ef6bdeaIvan MolodetskikhParent: b09dbb8
src/input.rsmodified+12 -2
@@ -1121,6 +1121,10 @@ impl State {
11211121 let comp_mod = self.backend.mod_key();
11221122 let mods = self.niri.seat.get_keyboard().unwrap().modifier_state();
11231123
1124+ // Winit sends scroll events where both directions are set at once, so we can't early
1125+ // return after handling just one.
1126+ let mut handled = false;
1127+
11241128 if let Some(v120) = horizontal_amount_v120 {
11251129 let config = self.niri.config.borrow();
11261130 let bindings = &config.binds;
@@ -1144,7 +1148,8 @@ impl State {
11441148 self.handle_bind(left.clone());
11451149 }
11461150 }
1147- return;
1151+
1152+ handled = true;
11481153 } else {
11491154 self.niri.horizontal_wheel_tracker.reset();
11501155 }
@@ -1171,11 +1176,16 @@ impl State {
11711176 self.handle_bind(up.clone());
11721177 }
11731178 }
1174- return;
1179+
1180+ handled = true;
11751181 } else {
11761182 self.niri.vertical_wheel_tracker.reset();
11771183 }
11781184 }
1185+
1186+ if handled {
1187+ return;
1188+ }
11791189 }
11801190
11811191 let horizontal_amount = event.amount(Axis::Horizontal).unwrap_or_else(|| {