klipper: perform roundtrip to fix infinite loop when syncing clipboard and selection on Wayland
Reason for the change
When Klipper receives a selection update event, it will try to update
the clipboard when Text selection - Always save in history
is enabled.
On X11 the loop is prevented by the lock level in the same context.
On Wayland the new clipboard event is received in a new context due to the asynchronous nature, so the
lock level doesn't work. This adds a roundtrip to make the new clipboard
event received in the same context so an infinite loop can be
avoided.
Test plan
- Enable "Text selection - Always save in history" in Klipper on Wayland
- Select some text
- Watch the CPU usage of plasmashell
Screenshots or screen recordings
Bugs fixed
BUG: 466414 FIXED-IN: 6.1
Closes #126 (closed)