Fix AdvancedPaste auto-copy failing on Electron/Chromium apps#46486
Open
yeelam-gordon wants to merge 1 commit intomainfrom
Open
Fix AdvancedPaste auto-copy failing on Electron/Chromium apps#46486yeelam-gordon wants to merge 1 commit intomainfrom
yeelam-gordon wants to merge 1 commit intomainfrom
Conversation
…eams) WM_COPY message is delivered successfully to Electron apps but silently ignored, so the clipboard never changes. The old code treated WM_COPY delivery as success and never fell back to SendInput Ctrl+C. Now each attempt tries both strategies: WM_COPY first (fast path for standard Win32 controls), then Ctrl+C via SendInput if the clipboard sequence didn't change (needed for Electron/Chromium/browser apps). Also extracted send_ctrl_c_input() and poll_clipboard_sequence() helpers for clarity.
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.
Summary
Fixes #46485
AdvancedPaste's auto-copy feature fails on Electron/Chromium-based apps (e.g. Microsoft Teams, VS Code, browsers) because
WM_COPYis delivered successfully but silently ignored by these apps.Problem
The auto-copy code sends
WM_COPYviaSendMessageTimeout. For standard Win32 controls this works, but Electron apps accept the message delivery without actually copying to clipboard. The code treated successful delivery as success and never fell back toSendInputCtrl+C.Changes
src/modules/AdvancedPaste/AdvancedPasteModuleInterface/dllmain.cpp:WM_COPYandSendInputCtrl+C. IfWM_COPYis delivered but clipboard is unchanged, it falls through to Ctrl+C instead of giving up.poll_clipboard_sequence()helper: Reusable clipboard polling logic (checksGetClipboardSequenceNumberover N polls with configurable delay).send_ctrl_c_input()helper: Sends Ctrl+C viaSendInputwithCENTRALIZED_KEYBOARD_HOOK_DONT_TRIGGER_FLAG.Validation
WM_COPYstill works on first try, no regression