pub fn write_file_dnd_events_system(
    focused_non_window_egui_context: Option<Res<FocusedNonWindowEguiContext>>,
    mut dnd_reader: EventReader<FileDragAndDrop>,
    mut egui_file_dnd_event_writer: EventWriter<EguiFileDragAndDropEvent>,
    egui_contexts: Query<&EguiContextSettings, With<EguiContext>>,
) {
    for event in dnd_reader.read() {
        let window = match &event {
            FileDragAndDrop::DroppedFile { window, .. }
            | FileDragAndDrop::HoveredFile { window, .. }
            | FileDragAndDrop::HoveredFileCanceled { window } => *window,
        };
        let context = focused_non_window_egui_context
            .as_deref()
            .map_or(window, |context| context.0);

        let Some(context_settings) = egui_contexts.get_some(context) else {
            continue;
        };

        if !context_settings
            .input_system_settings
            .run_write_file_dnd_events_system
        {
            continue;
        }

        match event {
            FileDragAndDrop::DroppedFile { window, path_buf } => {
                egui_file_dnd_event_writer.write(EguiFileDragAndDropEvent {
                    context,
                    event: FileDragAndDrop::DroppedFile {
                        window: *window,
                        path_buf: path_buf.clone(),
                    },
                });
            }
            FileDragAndDrop::HoveredFile { window, path_buf } => {
                egui_file_dnd_event_writer.write(EguiFileDragAndDropEvent {
                    context,
                    event: FileDragAndDrop::HoveredFile {
                        window: *window,
                        path_buf: path_buf.clone(),
                    },
                });
            }
            FileDragAndDrop::HoveredFileCanceled { window } => {
                egui_file_dnd_event_writer.write(EguiFileDragAndDropEvent {
                    context,
                    event: FileDragAndDrop::HoveredFileCanceled { window: *window },
                });
            }
        }
    }
}
Reads [`FileDragAndDrop`] events and wraps them into [`EguiFileDragAndDropEvent`], can redirect events to [`FocusedNonWindowEguiContext`].
src/input.rs