Skip to content

Drag and drop disk images (desktop and browser)#191

Merged
LinuxJedi merged 1 commit into
mainfrom
feat/drag-drop-disk-images
Jul 15, 2026
Merged

Drag and drop disk images (desktop and browser)#191
LinuxJedi merged 1 commit into
mainfrom
feat/drag-drop-disk-images

Conversation

@LinuxJedi

@LinuxJedi LinuxJedi commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Closes #189.

Desktop

  • Dragging files over the window shows a dimmed "Drop disk image to insert" hint; drops land anywhere on the window.
  • Floppy images (ADF/ADZ/DMS/SCP, gzip/zip packed) insert directly when one drive is connected. With several connected drives an Insert Disk chooser panel opens: click a drive, press its number (1-4), or Esc to cancel. Dropping several floppies queues them as the target drive's swap playlist, exactly like a multi-selection in the disk dialog.
  • .cue sheets mount in the CD drive with the media-change notification; .hdf/.rom show 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).
  • Inserts go through the existing insert_disk_image path, so input recording, reverse-debug media-change notes, and audio-pause handling all apply. The dialog and drop flows now share insert_disk_playlist / insert_cd_image_from_path helpers.

Why a post-drop chooser instead of the drop-on-icon/zone UX from the issue: winit 0.30 delivers HoveredFile/DroppedFile with 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 positional DragMoved/DragDrop events are still in beta; when they ship, the status-bar drive clusters are ready-made positional targets. Per-file DroppedFile events are coalesced in about_to_wait so 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 .rom loads (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

  • 10 new unit tests: extension classification, single-drive direct insert, chooser open/click/digit/Esc flows, hdf/cue notices, launcher refusal, event coalescing; the UI render test now draws the chooser and hover hint (rendered via COPPERLINE_UI_PREVIEW=1).
  • Full cargo test --release green (1432 unit tests + 20 golden probes untouched), clippy/fmt clean.
  • Browser flow verified end-to-end against the real page shell served locally: hint on dragenter, pre-boot drop queues ("inserts at boot"), post-boot drop inserts live ("write-protected"), .rom drop power-cycles into the new ROM.

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
Copilot AI review requested due to automatic review settings July 15, 2026 07:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 winit drag 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 .rom to 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.

@LinuxJedi LinuxJedi merged commit ef6cd51 into main Jul 15, 2026
10 checks passed
@LinuxJedi LinuxJedi deleted the feat/drag-drop-disk-images branch July 15, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drag and drop disk images

2 participants