Make drag and drop optional (fixes OleInitialize failure #1255) (#1524)

Co-authored-by: Osspial <osspial@gmail.com>
This commit is contained in:
Jurgis 2020-06-29 01:17:27 +03:00 committed by GitHub
parent 2191e9ecd5
commit b1e22aa559
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 6 deletions

View file

@ -117,6 +117,14 @@ pub trait WindowBuilderExtWindows {
/// This sets `WS_EX_NOREDIRECTIONBITMAP`.
fn with_no_redirection_bitmap(self, flag: bool) -> WindowBuilder;
/// Enables or disables drag and drop support (enabled by default). Will interfere with other crates
/// that use multi-threaded COM API (`CoInitializeEx` with `COINIT_MULTITHREADED` instead of
/// `COINIT_APARTMENTTHREADED`) on the same thread. Note that winit may still attempt to initialize
/// COM API regardless of this option. Currently only fullscreen mode does that, but there may be more in the future.
/// If you need COM API with `COINIT_MULTITHREADED` you must initialize it before calling any winit functions.
/// See https://docs.microsoft.com/en-us/windows/win32/api/objbase/nf-objbase-coinitialize#remarks for more information.
fn with_drag_and_drop(self, flag: bool) -> WindowBuilder;
}
impl WindowBuilderExtWindows for WindowBuilder {
@ -137,6 +145,12 @@ impl WindowBuilderExtWindows for WindowBuilder {
self.platform_specific.no_redirection_bitmap = flag;
self
}
#[inline]
fn with_drag_and_drop(mut self, flag: bool) -> WindowBuilder {
self.platform_specific.drag_and_drop = flag;
self
}
}
/// Additional methods on `MonitorHandle` that are specific to Windows.