Skip to content

Commit

Permalink
Merge pull request #2 from alice-i-cecile/a11y-patch
Browse files Browse the repository at this point in the history
Fix borrow checker errors in A11y patch
  • Loading branch information
ndarilek authored Oct 23, 2023
2 parents bbf852f + ec09d2b commit 104c6ae
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions crates/bevy_winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ pub fn winit_runner(mut app: App) {
WindowAndInputEventWriters,
NonSend<WinitWindows>,
Query<(&mut Window, &mut CachedWindow)>,
NonSend<AccessKitAdapters>,
)> = SystemState::new(&mut app.world);

#[cfg(not(target_arch = "wasm32"))]
Expand Down Expand Up @@ -418,7 +419,7 @@ pub fn winit_runner(mut app: App) {
event::Event::WindowEvent {
event, window_id, ..
} => {
let (mut event_writers, winit_windows, mut windows) =
let (mut event_writers, winit_windows, mut windows, access_kit_adapters) =
event_writer_system_state.get_mut(&mut app.world);

let Some(window_entity) = winit_windows.get_window_entity(window_id) else {
Expand All @@ -439,12 +440,10 @@ pub fn winit_runner(mut app: App) {

// Allow AccessKit to filter `WindowEvent`s before they reach
// the engine.
if let Some(adapters) = app.world.get_non_send_resource::<AccessKitAdapters>() {
if let Some(adapter) = adapters.get(&window_entity) {
if let Some(window) = winit_windows.get_window(window_entity) {
if !adapter.on_event(window, &event) {
return;
}
if let Some(adapter) = access_kit_adapters.get(&window_entity) {
if let Some(window) = winit_windows.get_window(window_entity) {
if !adapter.on_event(window, &event) {
return;
}
}
}
Expand Down Expand Up @@ -675,7 +674,7 @@ pub fn winit_runner(mut app: App) {
event: DeviceEvent::MouseMotion { delta: (x, y) },
..
} => {
let (mut event_writers, _, _) = event_writer_system_state.get_mut(&mut app.world);
let (mut event_writers, ..) = event_writer_system_state.get_mut(&mut app.world);
event_writers.mouse_motion.send(MouseMotion {
delta: Vec2::new(x as f32, y as f32),
});
Expand Down

0 comments on commit 104c6ae

Please sign in to comment.