firefox on copy: -> send_selection(nullptr); -> send_selection(some_offer); klipper: selection(nil) ->create offer with the old text ->send_selection(new offer) then we have two things hitting the compositor at once: - firefox with the new contents - kipper re-posting the old contents Our compositor is naive and just does last content received is the best which is now a race, but more often that not is klipper re-pasting the old contents that gets received last and "wins". The rest are cancelled. I don't know what a good fix for this is.
Can confirm.
Seems to have duplicate: https://bugs.kde.org/show_bug.cgi?id=424731
Following this up further. Firefox isn't quite sending -> send_selection(nullptr); -> send_selection(some_offer); It's actually sending wl_data_offer@oldOffer.destroy() before creating the new offer for the new clipboard It's kwayland-server that's tracking the old offer resource being destroyed and sending that the selection has changed to nil.
Brainstorming I have solutions, but none which are great. 1) Introduce a whole new fencing protocol, kwin will only accept data from wlr_data_control if the fence is up-to-date showing it has the latest clipboard 2) Introduce some only-replace-empty flag on the set_selection from klipper. SeatInterface will then only apply it if the current clipboard (as it sees it) is empty. Potentially we could abuse a mime type to signify this without protocol changes, which shouldn't take too long to roll out. For now I'll make a unit test for this case in kwayland so we have a starting point and can think of other ideas.
I wonder if this related or not: "Can't copy/paste from any app to Plasma panel's fields" https://bugs.kde.org/show_bug.cgi?id=424519
I'm still affected by this issue: if I open Firefox and copy something, it is saved into Klipper, but if I try to copy again Klipper's history is not updated correctly. Firefox version: 109.0 Plasma version: 5.26.5 Kernel version: 6.1.7-arch1-1
This sounds like bug 464509
(In reply to Vlad Zahorodnii from comment #7) > This sounds like bug 464509 You're right, thanks!