Drag and drop disk images (desktop and browser)#191
Merged
Conversation
Dropped floppy images insert directly when one drive is connected; with several, an Insert Disk chooser panel opens (click, 1-4, Esc), since winit 0.30 reports file drops without a cursor position on every platform, so drop-on-drive-icon targeting is not possible until the 0.31 positional drag events ship. Multiple floppies become the target drive's swap playlist like a multi-selection in the load dialog; .cue mounts in the CD drive; .hdf/.rom point at the configuration screen, which also refuses drops while open. A dimmed hint overlay shows while a drag hovers, and per-file DroppedFile events coalesce into one action in about_to_wait. The browser page routes drops through the existing picker paths: .rom loads (or queues) a Kickstart, anything else inserts into DF0, with the same pre-boot stashing and 64 MiB cap; the hint overlay is built from JS so the page shell needs no changes. The dialog and drop flows share new insert_disk_playlist and insert_cd_image_from_path helpers, and FloppyController gained inserted_disk_name for the chooser labels. Closes #189
Contributor
There was a problem hiding this comment.
Pull request overview
Adds drag-and-drop media insertion support across both the native desktop window and the Web “try” page, reusing existing insert paths so media-change behavior (OSD, input recording, audio pause, etc.) remains consistent.
Changes:
- Desktop: handle
winitdrag hover + drop events, coalesce multi-file drops, and route drops into floppies / CD cue / notices (HDF/ROM), with a modal “Insert Disk” chooser when multiple floppy drives are connected. - Refactor: share insertion logic via new helpers (
insert_disk_playlist,insert_cd_image_from_path) and add UI support for the chooser + drop-hover hint overlay. - Web: add document-level drag/drop handlers with an overlay hint; route
.romto Kickstart load and other files to DF0, honoring the existing 64 MiB cap.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/video/window/tests.rs | Adds unit tests covering drop classification, coalescing, chooser flows, and notices. |
| src/video/window.rs | Implements desktop drag hover/drop event handling, coalescing, media routing, and shared insert helpers. |
| src/video/ui.rs | Adds DropChooser panel UI, hit-testing, rendering, and the full-window drop-hover hint overlay. |
| src/floppy.rs | Adds inserted_disk_name() to support accurate drive labels in the drop chooser. |
| docs/guide/ui.md | Documents the new desktop drag-and-drop behavior and chooser rationale/limitations. |
| docs/guide/browser.md | Documents browser drag-and-drop behavior for ROM vs disk routing and pre-boot queuing. |
| crates/copperline-web/www/try.js | Implements browser drag-and-drop handlers and hint overlay in the try page glue code. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #189.
Desktop
.cuesheets mount in the CD drive with the media-change notification;.hdf/.romshow a notice pointing at the machine-configuration screen (no runtime attach path exists), which also refuses drops while it is open (it runs on a placeholder machine).insert_disk_imagepath, so input recording, reverse-debug media-change notes, and audio-pause handling all apply. The dialog and drop flows now shareinsert_disk_playlist/insert_cd_image_from_pathhelpers.Why a post-drop chooser instead of the drop-on-icon/zone UX from the issue: winit 0.30 delivers
HoveredFile/DroppedFilewith no cursor position on every platform (and no file-drop events at all under native Wayland), so the target drive cannot be derived from where the drag is released. winit 0.31's positionalDragMoved/DragDropevents are still in beta; when they ship, the status-bar drive clusters are ready-made positional targets. Per-fileDroppedFileevents are coalesced inabout_to_waitso a multi-file drop acts once.Browser
JS-only change in
crates/copperline-web/www/try.js: document-level drag handlers with a hint overlay built from JS (the page shell in the website repo needs no changes). A dropped.romloads (or, pre-boot, queues) a Kickstart like the ROM picker; anything else routes to DF0 like the disk picker, including pre-boot stashing and the 64 MiB cap.Testing
COPPERLINE_UI_PREVIEW=1).cargo test --releasegreen (1432 unit tests + 20 golden probes untouched),clippy/fmtclean..romdrop power-cycles into the new ROM.