Skip to content

Open files dropped on the window; ask tab vs. layer for images - #47

Merged
IAmJSD merged 1 commit into
mainfrom
t3code/535ca314
Aug 26, 2026
Merged

IAmJSD merged 1 commit into
mainfrom
t3code/535ca314

Conversation

@IAmJSD

@IAmJSD IAmJSD commented Aug 26, 2026

Copy link
Copy Markdown
Member

Dragging a file from the OS into the schist window now opens it. Behavior by drop:

  • Any file → decoded through the codec registry and opened in a new tab, same as File ▸ Open.
  • A single flat image while a document is open → an "Open Image" dialog asks New Tab or New Layer (default). New Layer flattens the image and inserts it as a raster layer centered on the canvas, named after the file, above the active layer, undoable as "Place Image".
  • Layered formats (PSD, Affinity), multi-file drops, or no open document → straight to tabs, no question.
  • If the tab closes while the dropped image is still decoding, it falls back to opening a tab.

Implementation notes:

  • Root div gains .on_drop::<ExternalPaths>; decode + composite run on the background executor like load_file.
  • New Modal::DropImage dialog modeled on the close-tab confirm.
  • gpui translates an OS file drag into synthetic left-button mouse moves, so on_mouse_move now returns early while a drag is active to keep those out of the active tool.

Tested end-to-end under Xvfb with a scratch XDND drag-source client performing real protocol-level drops against gpui's X11 backend: dialog appearance, both dialog buttons, a two-file drop (two tabs, no dialog), and an .afphoto drop (tab with intact layer stack) all verified by screenshot. cargo fmt --check, clippy -D warnings, and the app-crate tests pass.

🤖 Generated with Claude Code

Dropping a file from the OS now opens it in a new tab through the
existing load_file path. A single flat image dropped while a document
is open asks whether to open a tab or place the image as a new raster
layer (centered, named after the file, undoable as "Place Image").
Layered formats, multi-file drops, and drops with no open document
skip the question and open tabs directly.

gpui turns an OS drag into synthetic left-button mouse moves, so the
canvas mouse-move handler now stands down while a drag is active.

Co-Authored-By: Claude Fable 5 <[email protected]>
@IAmJSD
IAmJSD merged commit 0ba4330 into main Aug 26, 2026
3 checks passed
@IAmJSD
IAmJSD deleted the t3code/535ca314 branch August 26, 2026 01:12
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.

1 participant