Skip to content

Fix #20049: Enable file drag & drop by fixing forbidden icon issue#20050

Open
qiwu-3 wants to merge 1 commit intomicrosoft:mainfrom
qiwu-3:fix/dragdrop-forbidden-icon
Open

Fix #20049: Enable file drag & drop by fixing forbidden icon issue#20050
qiwu-3 wants to merge 1 commit intomicrosoft:mainfrom
qiwu-3:fix/dragdrop-forbidden-icon

Conversation

@qiwu-3
Copy link
Copy Markdown

@qiwu-3 qiwu-3 commented Apr 1, 2026

Summary of the Pull Request

This PR fixes the long-standing issue #20049 where dragging files from the desktop into Windows Terminal shows a forbidden cursor icon, while the native cmd.exe works correctly. After this fix, users can drag files directly into Terminal, and the file path will be inserted normally.

References and Relevant Issues

Closes #20049

Detailed Description of the Pull Request / Additional comments

Root Cause

The Terminal window was not registered as a valid file drop target, and the WM_DROPFILES message was blocked by User Interface Privilege Isolation (UIPI), which prevented cross-permission drag-and-drop operations, resulting in a forbidden icon.

Fix Implementation

  1. Added DragAcceptFiles(_window.get(), TRUE) in IslandWindow::Initialize() to register the window as a file drop target
  2. Added ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD) to allow WM_DROPFILES messages across different permission levels
  3. Added #include <shellapi.h> to resolve undefined function errors
  4. Added // cspell:ignore MSGFLT_ADD WM_DROPFILES to fix the spelling check false positive

Validation Steps Performed

  • Tested on Windows 10 22H2 (Build 19045.6093), Windows Terminal 1.25.622.0
  • Verified that dragging files from desktop to Terminal now works normally, no forbidden icon
  • Confirmed that file paths are correctly inserted into cmd/powershell
  • Tested with different permission levels (admin/non-admin) to ensure compatibility
  • No regression in existing window functionality

PR Checklist

_source.Content(_rootGrid);

DragAcceptFiles(_window.get(), TRUE);
// cspell:ignore MSGFLT_ADD WM_DROPFILES

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

MSGFLT is not a recognized word. (unrecognized-spelling)
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

Unrecognized words (1)

MSGFLT

These words are not needed and should be removed lto Tlgg

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:qiwu-3/terminal.git repository
on the fix/dragdrop-forbidden-icon branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/terminal/actions/runs/23844786912/attempts/1' &&
git commit -m 'Update check-spelling metadata'
Warnings ⚠️ (1)

See the 📂 files view, the 📜action log, or 📝 job summary for details.

⚠️ Warnings Count
⚠️ ignored-expect-variant 1

See ⚠️ Event descriptions for more information.

✏️ Contributor please read this

By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.

If the listed items are:

  • ... misspelled, then please correct them instead of using the command.
  • ... names, please add them to .github/actions/spelling/allow/names.txt.
  • ... APIs, you can add them to a file in .github/actions/spelling/allow/.
  • ... just things you're using, please add them to an appropriate file in .github/actions/spelling/expect/.
  • ... tokens you only need in one place and shouldn't generally be used, you can add an item in an appropriate file in .github/actions/spelling/patterns/.

See the README.md in each directory for more information.

🔬 You can test your commits without appending to a PR by creating a new branch with that extra change and pushing it to your fork. The check-spelling action will run in response to your push -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. 😉

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@DHowett
Copy link
Copy Markdown
Member

DHowett commented Apr 1, 2026

long-standing issue

It has been open for six hours and never before reported.

Were you able to reproduce the issue? Because nobody on the team is able to.

Do you have a screenshot or screen recording of your fix working?

Do you know that this repository does not use cspell?

Is there a "you" involved in the authoring of this code at all?

@zadjii-msft zadjii-msft added the spam thought we wouldn't notice, but we did label Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spam thought we wouldn't notice, but we did

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can drag files and form paths In the built-in cmd, but not can't in wt

4 participants