Skip to content

Move file drop overlay support out of ContentView - #3107

Closed
lawrencecchen wants to merge 2 commits into
refactor-sidebar-appearance-supportfrom
refactor-file-drop-overlay-support
Closed

lawrencecchen wants to merge 2 commits into
refactor-sidebar-appearance-supportfrom
refactor-file-drop-overlay-support

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #3106.

Moves file drop overlay routing, view, key, and install helpers from Sources/ContentView.swift into Sources/Windowing/FileDropOverlaySupport.swift. Keeps behavior unchanged; only access is widened where needed for cross-file use.

Verification:

  • git diff --check
  • ./scripts/reload.sh --tag fdovrl

Summary by cubic

Extracted file drop overlay support from ContentView into Sources/Windowing/FileDropOverlaySupport.swift for clearer ownership and reuse. Behavior is unchanged; drag routing and drop handling remain the same.

  • Refactors
    • Moved DragOverlayRoutingPolicy, FileDropOverlayView, overlay storage key, and installers (installFileDropOverlay, installFileDropOverlayWhenReady) to Windowing/FileDropOverlaySupport.swift.
    • Widened access for SidebarTabDragPayload and overlay installers to enable cross-file use.
    • Registered the new file in the Xcode project with standard IDs and removed the old code from ContentView.swift.

Written for commit d6194d7. Summary will update on new commits.

@vercel

vercel Bot commented Apr 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment Apr 22, 2026 0:21am

@coderabbitai

coderabbitai Bot commented Apr 22, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 10e4e3d4-c2d4-4003-acda-3ebc4d1a2886

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor-file-drop-overlay-support

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR is a pure refactor that moves file-drop overlay routing, view, key, and install helpers out of Sources/ContentView.swift into a new dedicated Sources/Windowing/FileDropOverlaySupport.swift, and registers the new file in the Xcode project. Access on installFileDropOverlayWhenReady and SidebarTabDragPayload is widened from private to internal to enable cross-file use; all behavior is otherwise unchanged.

Confidence Score: 5/5

Safe to merge; this is a mechanical code relocation with no behavioral changes.

All findings are P2. The patterned UUIDs are unconventional but functional, and the unused onDrop closure is a pre-existing issue not introduced by this PR. The refactor is a faithful line-for-line move with only the necessary access-level widening.

GhosttyTabs.xcodeproj/project.pbxproj — patterned UUIDs are worth a second glance but are not blocking.

Important Files Changed

Filename Overview
Sources/Windowing/FileDropOverlaySupport.swift New file containing the moved file-drop overlay logic (DragOverlayRoutingPolicy, FileDropOverlayView, install helpers); access widened from private to internal where needed; code is otherwise identical to what was in ContentView.swift
Sources/ContentView.swift Removes ~590 lines of file-drop overlay code relocated to FileDropOverlaySupport.swift; SidebarTabDragPayload widened from private to internal to satisfy the cross-file reference in the new file
GhosttyTabs.xcodeproj/project.pbxproj Registers FileDropOverlaySupport.swift in the Xcode project using patterned UUIDs (FDFD…) rather than randomly generated ones; functionally correct but unconventional

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Window drag event] --> B[FileDropOverlayView.hitTest]
    B --> C{DragOverlayRoutingPolicy\n.shouldCaptureFileDropOverlay}
    C -- No --> D[Return nil\npass through to views below]
    C -- Yes --> E[Capture drag in overlay]
    E --> F[draggingEntered/Updated]
    F --> G{WKWebView\nunder cursor?}
    G -- Yes --> H[Forward to WKWebView\ndraggingEntered/Updated]
    G -- No --> I{Terminal\nunder cursor?}
    I -- Yes --> J[Return .copy]
    I -- No --> K[Return empty]
    E --> L[performDragOperation]
    L --> M{shouldCaptureFileDropDestination?}
    M -- No --> N[Return false]
    M -- Yes --> O{preparedDragWebView\nor activeDragWebView?}
    O -- Yes --> P[Forward to WKWebView.performDragOperation]
    O -- No --> Q{terminalUnderPoint?}
    Q -- Yes --> R[terminal.performDragOperation]
    Q -- No --> S[Return false — onDrop never called]
Loading

Comments Outside Diff (2)

  1. GhosttyTabs.xcodeproj/project.pbxproj, line 9 (link)

    P2 Non-standard Xcode UUIDs

    The UUIDs FDFD1001FDFD1001FDFD1001 and FDFD1002FDFD1002FDFD1002 are deliberately patterned rather than randomly generated. While they are valid 24-character hex identifiers and will work in Xcode, they deviate from Xcode's convention of random UUIDs (e.g. 4D8B37E0E11A29997632765F). This is low risk since they are unique within the file, but could cause confusion if another developer tries to regenerate project UUIDs or if a future merge produces a collision with another intentionally patterned UUID using the same scheme. Consider using Xcode's own "Add Files" workflow to generate canonical UUIDs.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

  2. Sources/Windowing/FileDropOverlaySupport.swift, line 1096-1097 (link)

    P2 onDrop closure is set but never invoked

    onDrop is documented as "fallback handler when no terminal is found under the drop point" and is wired up in configureFileDropOverlay, but performDragOperation returns false early when no terminal is found rather than calling onDrop. If this fallback is intentional API surface it should be invoked, otherwise the property and the configureFileDropOverlay wiring are dead code. This was pre-existing before the move, but the refactor is a good opportunity to resolve it.

Reviews (1): Last reviewed commit: "refactor: move file drop overlay support" | Re-trigger Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 3 files

@lawrencecchen lawrencecchen added the stale-revisit Closed after 30+ days without activity; preserved for possible revisit or reopening. label Sep 23, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in cmux backlog Sep 23, 2026

This branch was successfully deployed

1 active deployment
Preview — d6194d7f Deployed Apr 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale-revisit Closed after 30+ days without activity; preserved for possible revisit or reopening.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants