Fix text copy via mouse click on Wayland#50406
Conversation
|
hey sorry for the delay, once the merge conflicts are resolved I'd be happy to merge this |
|
It appears that #52053 came along several weeks later and duplicated this fix and then got merged a few days ago. It is a little more funky in my opinion, but not overly so. The issue arises on in any Wayland environment, not just KDE Plasma as that PR alluded to. I also have nice screen recordings and had tied more documentation together. Alas. I resolved the conflicts to orient around this code, which keeps the method docs and call sites simpler. But if you'd rather not merge because it's basically moot that's okay. 😞 |
|
Sorry that me falling behind on my PR reviewing meant you weren't the one to fix this bug. It's still a nice API cleanup. |
|
ugh, the CI is failing because we only fetch 350 commits from history to find the merge point. If you rebase on main I'd be happy to hit merge |
|
Hey @probably-neb, no problem, I just rebased with |
Also remove extraneous Wayland API reference.
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: