From 76cdbe2cf8ebb946377c51f4545b27033d335096 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 30 Sep 2021 19:40:21 +0200 Subject: [PATCH] Add better documentation for epi::NativeOptions::drag_and_drop_support Closes https://github.com/emilk/egui/issues/747 --- eframe/examples/file_dialog.rs | 5 ++++- egui/src/data/input.rs | 3 +++ egui_demo_app/src/main.rs | 1 + epi/src/lib.rs | 5 +++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/eframe/examples/file_dialog.rs b/eframe/examples/file_dialog.rs index 91585c4f..2de6e3f4 100644 --- a/eframe/examples/file_dialog.rs +++ b/eframe/examples/file_dialog.rs @@ -95,6 +95,9 @@ impl MyApp { } 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); } diff --git a/egui/src/data/input.rs b/egui/src/data/input.rs index 07ebfd38..89f42bf0 100644 --- a/egui/src/data/input.rs +++ b/egui/src/data/input.rs @@ -60,6 +60,9 @@ pub struct RawInput { pub hovered_files: Vec, /// 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, } diff --git a/egui_demo_app/src/main.rs b/egui_demo_app/src/main.rs index 806fbe0c..a0295142 100644 --- a/egui_demo_app/src/main.rs +++ b/egui_demo_app/src/main.rs @@ -9,6 +9,7 @@ fn main() { let options = eframe::NativeOptions { // Let's show off that we support transparent windows transparent: true, + drag_and_drop_support: true, ..Default::default() }; eframe::run_native(Box::new(app), options); diff --git a/epi/src/lib.rs b/epi/src/lib.rs index 1a7d548a..e50bfb5f 100644 --- a/epi/src/lib.rs +++ b/epi/src/lib.rs @@ -180,8 +180,9 @@ pub struct NativeOptions { pub decorated: bool, /// On Windows: enable drag and drop support. - /// Default is `false` to avoid issues with crates such as cpal which - /// uses that use multi-threaded COM API + /// Default is `false` to avoid issues with crates such as [`cpal`](https://github.com/RustAudio/cpal) which + /// will hang when combined with drag-and-drop. + /// See . pub drag_and_drop_support: bool, /// The application icon, e.g. in the Windows task bar etc.