WaylandClipboard: Transfer selections to Qt on user interaction

Having keyboard focus does not guarantee that the selection write operation will succeed, and Qt doesn't use the serial of the keyboard enter event when calling set_selection either. Additionally, in certain edge cases where the data control device write happens immediately before a window gets focus (e.g. Spectacle's Copy mode), it's likely that the last input serial will be behind the implicit serial of the current selection.

Instead, perform the selection transfer when we receive a keyboard/mouse/tablet/touch press event. This should be more reliable as their serials are tracked by Qt, and the set_selection serial used when we receive one of these events should be as recent as possible.

This requires that nothing within the application will read from QClipboard without user input, which is satisfied by all current users of KSystemClipboard.

BUG:480448 BUG:496029 BUG:500731 BUG:506467 BUG:509065

Merge request reports

Loading
Loading