feat(cliprdr): advertise Preferred DropEffect alongside FileGroupDescriptorW#1301
Open
clintcan wants to merge 1 commit into
Open
feat(cliprdr): advertise Preferred DropEffect alongside FileGroupDescriptorW#1301clintcan wants to merge 1 commit into
clintcan wants to merge 1 commit into
Conversation
…riptorW `initiate_file_copy` now advertises BOTH `FileGroupDescriptorW` AND `Preferred DropEffect` (`CFSTR_PREFERREDDROPEFFECT`) in the same FormatList, and `handle_format_data_request` short-circuits a FormatDataRequest for the latter with `DROPEFFECT_COPY` (0x00000001 LE) without bothering the backend. - Added `ClipboardFormatName::PREFERRED_DROP_EFFECT = "Preferred DropEffect"`. - Added `Cliprdr::local_drop_effect_format_id` (mirrors `local_file_list_format_id` in lifecycle: set in `initiate_file_copy`, cleared on FormatListResponse::Fail and at the top of `initiate_copy`). - Picked a distinct private-range format ID (`0xC0FD`) — the wire only cares about the format *name*; the ID just needs to be locally unique so the request can be routed. No backend trait changes — the response is fixed (DROPEFFECT_COPY, matching the function's name) and served inline, so backends don't have to learn about the format. ### Why Windows Explorer pairs `CFSTR_PREFERREDDROPEFFECT` with the file formats locally; together they label the operation as a *copy*. When both are present, Explorer engages its shell file-copy machinery on paste (with native progress UI). Without `PreferredDropEffect`, Explorer falls back to a plain synchronous IStream read. ### Use case Used in https://github.com/clintcan/macrdp to deliver the standard "copying a file from the remote into local Windows Explorer" UX. The companion FD_PROGRESSUI flag (in a separate PR) is what actually triggers the native progress dialog; `PreferredDropEffect` provides the operation-semantics label Windows expects to see alongside the file descriptor for a clipboard file paste.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
initiate_file_copynow advertises bothFileGroupDescriptorWandPreferred DropEffect(CFSTR_PREFERREDDROPEFFECT) in the FormatList, andhandle_format_data_requestshort-circuits a request for the latter withDROPEFFECT_COPY(0x00000001 LE).Changes
ClipboardFormatName::PREFERRED_DROP_EFFECT = "Preferred DropEffect".Cliprdr::local_drop_effect_format_id— mirrorslocal_file_list_format_idin lifecycle (set ininitiate_file_copy, cleared onFormatListResponse::Failand at the top ofinitiate_copy).0xC0FD) — the wire only cares about the format name; the ID just needs to be locally unique so the request can be routed.DROPEFFECT_COPY, matching the function's name) and served inline, so backends don't have to learn about the format.Why
Windows Explorer pairs
CFSTR_PREFERREDDROPEFFECTwith the file formats locally; together they label the operation as a copy. When both are present, Explorer engages its shell file-copy machinery on paste (with native progress UI). WithoutPreferredDropEffect, Explorer falls back to a plain synchronousIStreamread.Use case / verification
Used in macrdp (a Rust RDP server for macOS) to deliver the standard "copy a file from the remote into local Windows Explorer" UX. Verified end-to-end on real mstsc.
The companion
FD_PROGRESSUIflag (#1299) is what actually triggers the native progress dialog;PreferredDropEffectprovides the operation-semantics label Windows expects to see alongside the file descriptor for a clipboard file paste. Either change is independently useful, but the user-visible "native progress dialog" UX requires both.Related