Merge pull request #73 from Moxinilian/windows-winit-panic

winit: fix panic on windows
This commit is contained in:
Carter Anderson 2020-07-26 13:15:56 -07:00 committed by GitHub
commit fb9f04ba90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,18 @@ impl WinitWindows {
event_loop: &winit::event_loop::EventLoopWindowTarget<()>, event_loop: &winit::event_loop::EventLoopWindowTarget<()>,
window: &Window, window: &Window,
) { ) {
#[cfg(target_os = "windows")]
let winit_window = {
use winit::platform::windows::WindowBuilderExtWindows;
winit::window::WindowBuilder::new()
.with_drag_and_drop(false)
.build(&event_loop)
.unwrap()
};
#[cfg(not(target_os = "windows"))]
let winit_window = winit::window::Window::new(&event_loop).unwrap(); let winit_window = winit::window::Window::new(&event_loop).unwrap();
self.window_id_to_winit.insert(window.id, winit_window.id()); self.window_id_to_winit.insert(window.id, winit_window.id());
self.winit_to_window_id.insert(winit_window.id(), window.id); self.winit_to_window_id.insert(winit_window.id(), window.id);