wayland: Allow setting the clipboard with the current serial

Some clients (for example Chromium and LibreOffice) display a certain
behavior in that they will set the clipboard twice in short succession
deleting the data source in between and using the same serial twice.
This allows setting the clipboard with the same serial as
the current clipboard which only the current owner (or previous
owner when the source was deleted) should know.
wilder/Plasma/6.2
David Redondo 2 years ago
parent 8141cc1871
commit 5a3d2593f1
  1. 4
      src/wayland/seat.cpp

@ -321,7 +321,7 @@ void SeatInterfacePrivate::endDrag()
void SeatInterfacePrivate::updateSelection(DataSourceInterface *dataSource, quint32 serial)
{
if (currentSelectionSerial - serial < UINT32_MAX / 2) {
if (currentSelectionSerial - serial < UINT32_MAX / 2 && currentSelectionSerial != serial) {
if (dataSource) {
dataSource->cancel();
}
@ -332,7 +332,7 @@ void SeatInterfacePrivate::updateSelection(DataSourceInterface *dataSource, quin
void SeatInterfacePrivate::updatePrimarySelection(PrimarySelectionSourceV1Interface *dataSource, quint32 serial)
{
if (currentPrimarySelectionSerial - serial < UINT32_MAX / 2) {
if (currentPrimarySelectionSerial - serial < UINT32_MAX / 2 && currentPrimarySelectionSerial != serial) {
if (dataSource) {
dataSource->cancel();
}

Loading…
Cancel
Save