Skip to content

Commit

Permalink
I forgot finished_and_setup_done
Browse files Browse the repository at this point in the history
  • Loading branch information
maniwani committed Jul 25, 2023
1 parent fc1dc5e commit 57ac11a
Showing 1 changed file with 41 additions and 40 deletions.
81 changes: 41 additions & 40 deletions crates/bevy_winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ pub fn winit_runner(mut app: App) {
runner_state.is_active = true;
}
event::Event::MainEventsCleared => {
if runner_state.is_active {
if finished_and_setup_done && runner_state.is_active {
let (config, windows) = focused_windows_state.get(&app.world);
let focused = windows.iter().any(|window| window.focused);
let should_update = match config.update_mode(focused) {
Expand Down Expand Up @@ -738,47 +738,48 @@ pub fn winit_runner(mut app: App) {
*control_flow = ControlFlow::Exit;
}
}

// create any new windows
#[cfg(not(target_arch = "wasm32"))]
let (
commands,
mut windows,
event_writer,
winit_windows,
adapters,
handlers,
accessibility_requested,
) = create_window_system_state.get_mut(&mut app.world);

#[cfg(target_arch = "wasm32")]
let (
commands,
mut windows,
event_writer,
winit_windows,
adapters,
handlers,
accessibility_requested,
event_channel,
) = create_window_system_state.get_mut(&mut app.world);

create_windows(
event_loop,
commands,
windows.iter_mut(),
event_writer,
winit_windows,
adapters,
handlers,
accessibility_requested,
#[cfg(target_arch = "wasm32")]
event_channel,
);

create_window_system_state.apply(&mut app.world);
}
}

// create any new windows
// (even if app did not update, some may have been created by plugin setup)
#[cfg(not(target_arch = "wasm32"))]
let (
commands,
mut windows,
event_writer,
winit_windows,
adapters,
handlers,
accessibility_requested,
) = create_window_system_state.get_mut(&mut app.world);

#[cfg(target_arch = "wasm32")]
let (
commands,
mut windows,
event_writer,
winit_windows,
adapters,
handlers,
accessibility_requested,
event_channel,
) = create_window_system_state.get_mut(&mut app.world);

create_windows(
event_loop,
commands,
windows.iter_mut(),
event_writer,
winit_windows,
adapters,
handlers,
accessibility_requested,
#[cfg(target_arch = "wasm32")]
event_channel,
);

create_window_system_state.apply(&mut app.world);
}
_ => (),
}
Expand Down

0 comments on commit 57ac11a

Please sign in to comment.