Skip to content

Add file_drop: drop files onto a window via WM_DROPFILES#404

Merged
JE-Chen merged 1 commit into
devfrom
feat/file-drop-batch
Jun 24, 2026
Merged

Add file_drop: drop files onto a window via WM_DROPFILES#404
JE-Chen merged 1 commit into
devfrom
feat/file-drop-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 24, 2026

Copy link
Copy Markdown
Member

Why

clipboard_files stages a file-drop list on the clipboard so a user can Ctrl+V it; file_drop actively drops files onto a target window — the completion of a drag-and-drop — by posting a WM_DROPFILES message carrying a DROPFILES blob.

  • drop_files(hwnd, paths, point=, driver=) — pack the blob and post WM_DROPFILES to a window
  • plan_file_drop(paths, point=) — pure dry-run returning {message, paths, point, wide, blob_size}

Design

  • Reuses clipboard_files.build_dropfiles to pack the DROPFILES blob (shared byte layout, not re-implemented).
  • Dispatches through an injectable driver seam (hwnd, blob, point) -> bool, so the build-and-dispatch logic is unit-testable on any platform with a fake driver; the real GlobalAlloc + PostMessageW(WM_DROPFILES) lives in the default Win32 driver (the receiving window owns/frees the memory via DragFinish).
  • 5 layers wired: core → facade __all__AC_drop_files (device) + AC_plan_file_drop (pure) → ac_* MCP tools (drop side-effect-only, plan read-only) → Script Builder (Window). Qt-free verified.

Tests

test/unit_test/headless/test_file_drop_batch.pyplan_file_drop payload + packing reuse, drop_files dispatching a real parseable DROPFILES blob to an injected driver (round-tripped through parse_dropfiles), driver-result passthrough, empty-paths errors, the pure executor path, and 5-layer wiring. 14 passed with the clipboard_files sibling. Real Win32 PostMessage not executed in CI.

clipboard_files stages a file list on the clipboard for Ctrl+V; this
actively drops files onto a target window (the completion of a
drag-and-drop) by posting WM_DROPFILES. Reuses clipboard_files.
build_dropfiles to pack the DROPFILES blob (shared byte layout) and
dispatches through an injectable driver seam, so build-and-dispatch is
unit-testable with a fake driver; the real GlobalAlloc + PostMessage
lives in the default Win32 driver. plan_file_drop is a pure dry-run.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 19 complexity · 1 duplication

Metric Results
Complexity 19
Duplication 1

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 000a5db into dev Jun 24, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/file-drop-batch branch June 24, 2026 06:12
@sonarqubecloud

Copy link
Copy Markdown

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