Skip to content

primary-selection: add a serial argument

Simon Ser requested to merge github/fork/emersion/data-device-serial into master

The serial needs to be bumped when X11 clients set the selection, otherwise some Wayland clients (e.g. GTK) will overwrite it when they gain focus.

For instance, copy from a GTK app will send set_selection(serial=42, source), then immediately set_selection(serial=42, NULL). If another app is focused and then the GTK app is focused again, GTK will send set_selection(serial=42, NULL) again. If X11 has updated the selection in the meantime, this will clear it (and shouldn't).

This isn't a GTK bug, that's how the Wayland protocol works. However this is silly behaviour from GTK.

Merge request reports