Repository: iced-rs/iced (language: rust)

Issue:
Unnecessary COM initialization with drag and drop disabled
### Is your issue REALLY a bug?

- [X] My issue is indeed a bug!
- [X] I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.

### Is there an existing issue for this?

- [X] I have searched the existing issues.

### Is this issue related to iced?

- [X] My hardware is compatible and my graphics drivers are up-to-date.

### What happened?

After upgrading my application from `0.12` to the `master` branch, I noticed COM (required for file drag and drop on Windows) is initialized even when the window setting flag `drag_and_drop` is set to false. This causes unnecessary collisions with user code, which can use COM in a different way.

The following code works in `0.12` but not in `master`:
```rust
fn main() {
    unsafe {
        CoInitializeEx(None, COINIT_MULTITHREADED).unwrap();
    }

    let window = window::Settings {
        platform_specific: PlatformSpecific {
            drag_and_drop: false,
            ..PlatformSpecific::default()
        },
        ..window::Settings::default()
    };

    iced::application("A cool counter", Counter::update, Counter::view)
        .window(window)
        .run()
        .unwrap();
}

#[derive(Default)]
struct Counter;

impl Counter {
    fn update(&mut self, _: ()) {}

    fn view(&self) -> Button<()> {
        iced::widget::button("Hello, world!")
    }
}
```

> 

### What is the expected behavior?

COM is not touched by `winit` and the provided example works as in `0.12`.


### Version

master

### Operating System

Windows

### Do you have any log output?

```shell
thread 'main' panicked at C:\Users\<>\.cargo\git\checkouts\winit-57d3141eaf559308\254d6b3\src\platform_impl\windows\window.rs:1179:17:
OleInitialize failed! Result was: `RPC_E_CHANGED_MODE`. Make sure other crates are not using multithreaded COM library on the same thread or disable drag and drop support.
```



Discussion / hints:

Fix patch:
diff --git a/winit/src/program.rs b/winit/src/program.rs
index 7cfbd2d5fc..8d1eec3af9 100644
--- a/winit/src/program.rs
+++ b/winit/src/program.rs
@@ -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;
+                    }
                 }
             };
 


Test patch: