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 {
1121 let comp_mod = self.backend.mod_key();1121 let comp_mod = self.backend.mod_key();
1122 let mods = self.niri.seat.get_keyboard().unwrap().modifier_state();1122 let mods = self.niri.seat.get_keyboard().unwrap().modifier_state();
1123 1123
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+
1124 if let Some(v120) = horizontal_amount_v120 {1128 if let Some(v120) = horizontal_amount_v120 {
1125 let config = self.niri.config.borrow();1129 let config = self.niri.config.borrow();
1126 let bindings = &config.binds;1130 let bindings = &config.binds;
@@ -1144,7 +1148,8 @@ impl State {
1144 self.handle_bind(left.clone());1148 self.handle_bind(left.clone());
1145 }1149 }
1146 }1150 }
1147- return;1151+
1152+ handled = true;
1148 } else {1153 } else {
1149 self.niri.horizontal_wheel_tracker.reset();1154 self.niri.horizontal_wheel_tracker.reset();
1150 }1155 }
@@ -1171,11 +1176,16 @@ impl State {
1171 self.handle_bind(up.clone());1176 self.handle_bind(up.clone());
1172 }1177 }
1173 }1178 }
1174- return;1179+
1180+ handled = true;
1175 } else {1181 } else {
1176 self.niri.vertical_wheel_tracker.reset();1182 self.niri.vertical_wheel_tracker.reset();
1177 }1183 }
1178 }1184 }
1185+
1186+ if handled {
1187+ return;
1188+ }
1179 }1189 }
1180 1190
1181 let horizontal_amount = event.amount(Axis::Horizontal).unwrap_or_else(|| {1191 let horizontal_amount = event.amount(Axis::Horizontal).unwrap_or_else(|| {