From 5a3d2593f1b1291d5d18e375d2e6f7edcd505ac7 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Fri, 30 Aug 2024 12:12:50 +0200 Subject: [PATCH] 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. --- src/wayland/seat.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wayland/seat.cpp b/src/wayland/seat.cpp index 7887cc63f9..70cd44b9cc 100644 --- a/src/wayland/seat.cpp +++ b/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(); }