Add better documentation for epi::NativeOptions::drag_and_drop_support

Closes https://github.com/emilk/egui/issues/747
This commit is contained in:
Emil Ernerfeldt 2021-09-30 19:40:21 +02:00
parent e2bdd40985
commit 76cdbe2cf8
4 changed files with 11 additions and 3 deletions

View file

@ -95,6 +95,9 @@ impl MyApp {
} }
fn main() { fn main() {
let options = eframe::NativeOptions::default(); let options = eframe::NativeOptions {
drag_and_drop_support: true,
..Default::default()
};
eframe::run_native(Box::new(MyApp::default()), options); eframe::run_native(Box::new(MyApp::default()), options);
} }

View file

@ -60,6 +60,9 @@ pub struct RawInput {
pub hovered_files: Vec<HoveredFile>, pub hovered_files: Vec<HoveredFile>,
/// Dragged files dropped into egui. /// Dragged files dropped into egui.
///
/// Note: when using `eframe` on Windows you need to enable
/// drag-and-drop support using `epi::NativeOptions`.
pub dropped_files: Vec<DroppedFile>, pub dropped_files: Vec<DroppedFile>,
} }

View file

@ -9,6 +9,7 @@ fn main() {
let options = eframe::NativeOptions { let options = eframe::NativeOptions {
// Let's show off that we support transparent windows // Let's show off that we support transparent windows
transparent: true, transparent: true,
drag_and_drop_support: true,
..Default::default() ..Default::default()
}; };
eframe::run_native(Box::new(app), options); eframe::run_native(Box::new(app), options);

View file

@ -180,8 +180,9 @@ pub struct NativeOptions {
pub decorated: bool, pub decorated: bool,
/// On Windows: enable drag and drop support. /// On Windows: enable drag and drop support.
/// Default is `false` to avoid issues with crates such as cpal which /// Default is `false` to avoid issues with crates such as [`cpal`](https://github.com/RustAudio/cpal) which
/// uses that use multi-threaded COM API <https://github.com/rust-windowing/winit/pull/1524> /// will hang when combined with drag-and-drop.
/// See <https://github.com/rust-windowing/winit/issues/1255>.
pub drag_and_drop_support: bool, pub drag_and_drop_support: bool,
/// The application icon, e.g. in the Windows task bar etc. /// The application icon, e.g. in the Windows task bar etc.