Skip to content

Commit

Permalink
Merge pull request #2578 from Jinderamarak/fix-drag-drop-flag
Browse files Browse the repository at this point in the history
Fix unnecessary COM initialization
  • Loading branch information
hecrj authored Sep 13, 2024
2 parents d46f6f9 + cadc054 commit 8fb939b
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions winit/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,22 @@ where
return;
};

let window = match event_loop.create_window(
winit::window::WindowAttributes::default().with_visible(false),
) {
Ok(window) => Arc::new(window),
Err(error) => {
self.error = Some(Error::WindowCreationFailed(error));
event_loop.exit();
return;
let window = {
let attributes = winit::window::WindowAttributes::default();

#[cfg(target_os = "windows")]
let attributes = {
use winit::platform::windows::WindowAttributesExtWindows;
attributes.with_drag_and_drop(false)
};

match event_loop.create_window(attributes.with_visible(false)) {
Ok(window) => Arc::new(window),
Err(error) => {
self.error = Some(Error::WindowCreationFailed(error));
event_loop.exit();
return;
}
}
};

Expand Down

0 comments on commit 8fb939b

Please sign in to comment.