From 6c1e61f7222f137132bb352ac809c5d02a701815 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Thu, 6 Jan 2022 20:25:03 +0000 Subject: [PATCH] Clean up warnings --- crates/bevy_winit/src/lib.rs | 5 +++-- crates/bevy_winit/src/winit_windows.rs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index cf6d19892a50be..dca1ede3efe13d 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -13,7 +13,7 @@ pub use winit_windows::*; use bevy_app::{App, AppExit, CoreStage, Events, ManualEventReader, Plugin}; use bevy_ecs::{system::IntoExclusiveSystem, world::World}; use bevy_math::{ivec2, DVec2, Vec2}; -use bevy_utils::tracing::{error, trace, warn}; +use bevy_utils::tracing::{error, info, trace, warn}; use bevy_window::{ CreateWindow, CursorEntered, CursorLeft, CursorMoved, FileDragAndDrop, ReceivedCharacter, WindowBackendScaleFactorChanged, WindowCloseRequested, WindowClosed, WindowCreated, @@ -293,7 +293,8 @@ pub fn winit_runner_with(mut app: App) { let window = if let Some(window) = windows.get_mut(window_id) { window } else { - warn!("Skipped event for unknown Window Id {:?}", winit_window_id); + // If we're here, this window was previously opened + info!("Skipped event for closed window: {:?}", window_id); return; }; diff --git a/crates/bevy_winit/src/winit_windows.rs b/crates/bevy_winit/src/winit_windows.rs index f0f5a40e360c11..7e436c0ee63fed 100644 --- a/crates/bevy_winit/src/winit_windows.rs +++ b/crates/bevy_winit/src/winit_windows.rs @@ -185,7 +185,7 @@ impl WinitWindows { pub fn remove_window(&mut self, id: WindowId) -> Option { let winit_id = self.window_id_to_winit.remove(&id)?; - self.winit_to_window_id.remove(&winit_id); + // Don't remove from winit_to_window_id, to track that we used to know about this winit window self.windows.remove(&winit_id) } }