From 5bfff316c9818b3c140d02bb6cdc488556d46ab7 Mon Sep 17 00:00:00 2001 From: valadaptive <79560998+valadaptive@users.noreply.github.com> Date: Wed, 30 Oct 2024 10:24:45 -0400 Subject: [PATCH] Fix documentation for file drag and drop (#5328) The `RawInput::dropped_files` documentation referred to `NativeOptions`, but the `drag_and_drop` option was moved to `ViewportBuilder` and is now enabled by default. Note that drag-and-drop is not *explicitly* enabled by default here, but rather is enabled by default in winit. We only override winit's default if the API consumer specifies it. It might be a good idea in general to provide explicit defaults for everything in `ViewportBuilder` so we're not relying on winit's behavior, but that's best left for another PR. * Closes N/A * [x] I have followed the instructions in the PR template --- crates/egui/src/data/input.rs | 4 ++-- crates/egui/src/viewport.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/egui/src/data/input.rs b/crates/egui/src/data/input.rs index 3601fcae46e..a1b9783280e 100644 --- a/crates/egui/src/data/input.rs +++ b/crates/egui/src/data/input.rs @@ -68,8 +68,8 @@ pub struct RawInput { /// Dragged files dropped into egui. /// - /// Note: when using `eframe` on Windows you need to enable - /// drag-and-drop support using `eframe::NativeOptions`. + /// Note: when using `eframe` on Windows, this will always be empty if drag-and-drop support has + /// been disabled in [`crate::viewport::ViewportBuilder`]. pub dropped_files: Vec, /// The native window has the keyboard focus (i.e. is receiving key presses). diff --git a/crates/egui/src/viewport.rs b/crates/egui/src/viewport.rs index df72f822d4d..76131ec9fb9 100644 --- a/crates/egui/src/viewport.rs +++ b/crates/egui/src/viewport.rs @@ -534,7 +534,7 @@ impl ViewportBuilder { /// See [winit's documentation][drag_and_drop] for information on why you /// might want to disable this on windows. /// - /// [drag_and_drop]: https://docs.rs/winit/latest/x86_64-pc-windows-msvc/winit/platform/windows/trait.WindowBuilderExtWindows.html#tymethod.with_drag_and_drop + /// [drag_and_drop]: https://docs.rs/winit/latest/x86_64-pc-windows-msvc/winit/platform/windows/trait.WindowAttributesExtWindows.html#tymethod.with_drag_and_drop #[inline] pub fn with_drag_and_drop(mut self, value: bool) -> Self { self.drag_and_drop = Some(value);