From 85abafc31c296b3e9ddd83f89f160e2a2c4b982b Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Thu, 5 Nov 2020 07:55:35 +0100 Subject: [PATCH] Backport upstream fix for clipboard issue --- ...refresh-x11-clipboard-while-fetching.patch | 75 +++++++++++++++++++ kwin.spec | 6 +- 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 kwin-do-not-refresh-x11-clipboard-while-fetching.patch diff --git a/kwin-do-not-refresh-x11-clipboard-while-fetching.patch b/kwin-do-not-refresh-x11-clipboard-while-fetching.patch new file mode 100644 index 0000000..1cb18bb --- /dev/null +++ b/kwin-do-not-refresh-x11-clipboard-while-fetching.patch @@ -0,0 +1,75 @@ +From d335070b80c2f3bc5674355e3edba61bc010bc36 Mon Sep 17 00:00:00 2001 +From: Aleix Pol +Date: Tue, 20 Oct 2020 02:29:01 +0200 +Subject: [PATCH] xwl: Do not refresh the x11 Clipboard while fetching + +At the moment there was a race condition when putting something into the +keyboard from XWayland apps. The clipboard manager would announce a new +thing before we'd submitted it all resulting in a broken state. + +This change detects when it's fetching and will only refresh the source +after everything has been sent. + +BUG: 424754 +CCBUG: 412350 +--- + xwl/clipboard.cpp | 10 ++++++++++ + xwl/clipboard.h | 1 + + 2 files changed, 11 insertions(+) + +diff --git a/xwl/clipboard.cpp b/xwl/clipboard.cpp +index b2f3435a5..a64fda0ae 100644 +--- a/xwl/clipboard.cpp ++++ b/xwl/clipboard.cpp +@@ -66,6 +66,10 @@ Clipboard::Clipboard(xcb_atom_t atom, QObject *parent) + + void Clipboard::wlSelectionChanged(KWaylandServer::AbstractDataSource *dsi) + { ++ if (m_waitingForTargets) { ++ return; ++ } ++ + if (!ownsSelection(dsi)) { + // Wayland native client provides new selection + if (!m_checkConnection) { +@@ -85,6 +89,10 @@ bool Clipboard::ownsSelection(KWaylandServer::AbstractDataSource *dsi) const + + void Clipboard::checkWlSource() + { ++ if (m_waitingForTargets) { ++ return; ++ } ++ + auto dsi = waylandServer()->seat()->selection(); + auto removeSource = [this] { + if (wlSource()) { +@@ -142,6 +150,7 @@ void Clipboard::doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event) + + if (X11Source *source = x11Source()) { + source->getTargets(); ++ m_waitingForTargets = true; + } else { + qCWarning(KWIN_XWL) << "Could not create a source from" << event << Qt::hex << (event ? event->owner : -1); + } +@@ -149,6 +158,7 @@ void Clipboard::doHandleXfixesNotify(xcb_xfixes_selection_notify_event_t *event) + + void Clipboard::x11OffersChanged(const QStringList &added, const QStringList &removed) + { ++ m_waitingForTargets = false; + X11Source *source = x11Source(); + if (!source) { + qCWarning(KWIN_XWL) << "offers changed when not having an X11Source!?"; +diff --git a/xwl/clipboard.h b/xwl/clipboard.h +index c2296845a..f534d1f3e 100644 +--- a/xwl/clipboard.h ++++ b/xwl/clipboard.h +@@ -53,6 +53,7 @@ private: + QMetaObject::Connection m_checkConnection; + + Q_DISABLE_COPY(Clipboard) ++ bool m_waitingForTargets = false; + }; + + } // namespace Xwl +-- +GitLab diff --git a/kwin.spec b/kwin.spec index 62655d4..7eafc75 100644 --- a/kwin.spec +++ b/kwin.spec @@ -17,7 +17,7 @@ Name: kwin Version: 5.20.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: KDE Window manager # all sources are effectively GPLv2+, except for: @@ -38,6 +38,7 @@ URL: https://userbase.kde.org/KWin Source0: http://download.kde.org/%{stable}/plasma/%{version}/%{name}-%{version}.tar.xz ## upstream patches +Patch0: kwin-do-not-refresh-x11-clipboard-while-fetching.patch # Base BuildRequires: extra-cmake-modules @@ -355,6 +356,9 @@ make test ARGS="--output-on-failure --timeout 10" -C %{_target_platform} ||: %changelog +* Thu Nov 5 07:55:10 CET 2020 Jan Grulich - 5.20.2-3 +- Backport upstream fix for clipboard issue + * Sat Oct 31 10:01:51 EDT 2020 Neal Gompa - 5.20.2-2 - Obsolete kwin-wayland-nvidia package by kwin-wayland since kwin now automatically supports NVIDIA graphics correctly on Wayland