Fix text copy via mouse click on Wayland#50406
Open
soundslocke wants to merge 1 commit intozed-industries:mainfrom
Open
Fix text copy via mouse click on Wayland#50406soundslocke wants to merge 1 commit intozed-industries:mainfrom
soundslocke wants to merge 1 commit intozed-industries:mainfrom
Conversation
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.
I've been working on a GPUI application which has a button for copying text. After starting the app in Wayland in Linux I noticed that when I click the button to copy text it does not work. After interacting with other buttons and/or copying text via keyboard shortcuts then my copy button works.
I thought I was handling something wrong, but then I noticed that Zed also exhibits this behavior: upon starting Zed if you highlight text and right-click and select "Copy" then nothing happens. After you interact with other UI elements and/or keyboard shortcuts then copy buttons seem to work fine.
This paper cut has been annoying me and with the help of Claude Code I arrived at this small fix. This solves the problem and this appears to be the way the serial should be handled for clipboard actions via button clicks in Wayland, as far as I've been able to learn. Here are a couple related Wayland documentation pages that I double checked:
Added
a solid test coverage and/orscreenshots from doing manual testingHere's a screen recording of the behavior without this fix:
wayland-clipboard-problem.webm
Here's a screen recording of the behavior with this fix:
wayland-clipboard-fix.webm
Here's a screen recording of the problem in Zed itself:
wayland-clipboard-problem-zed.webm
Done a self-review taking into account security and performance aspects
Aligned any UI changes with the UI checklist
Release Notes: