2021-12-06 15:08:41 +00:00
|
|
|
From 992833ca741efe8f533c61abfaf129a1d8bfcfee Mon Sep 17 00:00:00 2001
|
2021-10-04 08:00:47 +00:00
|
|
|
From: Jan Grulich <jgrulich@redhat.com>
|
|
|
|
Date: Fri, 16 Jul 2021 13:00:03 +0200
|
2021-12-06 15:08:41 +00:00
|
|
|
Subject: [PATCH 36/36] Client: do not empty clipboard when a new popup/window
|
|
|
|
is opened
|
2021-10-04 08:00:47 +00:00
|
|
|
|
|
|
|
If we open a new popup or a window within the same app we have to avoid
|
|
|
|
invalidating selection offer when losing focus, because it's still the
|
|
|
|
same client who has the focus and we might not get a new selection offer
|
|
|
|
by the compositor and therefore we would lose clipboard content.
|
|
|
|
|
|
|
|
Fixes: QTBUG-93474
|
|
|
|
Change-Id: Ia2ef826c2967b1daf1cdeb085e8dae66d090dbcf
|
2021-12-06 15:08:41 +00:00
|
|
|
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
|
|
|
Reviewed-by: David Edmundson <davidedmundson@kde.org>
|
|
|
|
|
|
|
|
Cherry-pick: 1e57ebd501cfc2255300392cd4565cd034efeed8
|
2021-10-04 08:00:47 +00:00
|
|
|
---
|
2021-12-06 15:08:41 +00:00
|
|
|
src/client/qwaylanddisplay.cpp | 13 +++++++++++++
|
|
|
|
src/client/qwaylandinputdevice.cpp | 8 --------
|
|
|
|
2 files changed, 13 insertions(+), 8 deletions(-)
|
2021-10-04 08:00:47 +00:00
|
|
|
|
|
|
|
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
|
2021-12-06 15:08:41 +00:00
|
|
|
index 27303110..9f595af3 100644
|
2021-10-04 08:00:47 +00:00
|
|
|
--- a/src/client/qwaylanddisplay.cpp
|
|
|
|
+++ b/src/client/qwaylanddisplay.cpp
|
2021-10-04 17:48:15 +00:00
|
|
|
@@ -597,6 +597,19 @@ void QWaylandDisplay::handleWaylandSync()
|
2021-10-04 08:00:47 +00:00
|
|
|
QWindow *activeWindow = mActiveWindows.empty() ? nullptr : mActiveWindows.last()->window();
|
2021-10-04 17:48:15 +00:00
|
|
|
if (activeWindow != QGuiApplication::focusWindow())
|
|
|
|
QWindowSystemInterface::handleWindowActivated(activeWindow);
|
|
|
|
+
|
|
|
|
+ if (!activeWindow) {
|
|
|
|
+ if (lastInputDevice()) {
|
2021-10-04 08:00:47 +00:00
|
|
|
+#if QT_CONFIG(clipboard)
|
2021-10-04 17:48:15 +00:00
|
|
|
+ if (auto *dataDevice = lastInputDevice()->dataDevice())
|
|
|
|
+ dataDevice->invalidateSelectionOffer();
|
2021-10-04 08:00:47 +00:00
|
|
|
+#endif
|
|
|
|
+#if QT_CONFIG(wayland_client_primary_selection)
|
2021-10-04 17:48:15 +00:00
|
|
|
+ if (auto *device = lastInputDevice()->primarySelectionDevice())
|
|
|
|
+ device->invalidateSelectionOffer();
|
2021-10-04 08:00:47 +00:00
|
|
|
+#endif
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
}
|
2021-12-06 15:08:41 +00:00
|
|
|
|
2021-10-04 08:00:47 +00:00
|
|
|
const wl_callback_listener QWaylandDisplay::syncCallbackListener = {
|
|
|
|
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
|
2021-12-06 15:08:41 +00:00
|
|
|
index ae045f4f..514457e9 100644
|
2021-10-04 08:00:47 +00:00
|
|
|
--- a/src/client/qwaylandinputdevice.cpp
|
|
|
|
+++ b/src/client/qwaylandinputdevice.cpp
|
|
|
|
@@ -1300,14 +1300,6 @@ void QWaylandInputDevice::Keyboard::handleFocusDestroyed()
|
|
|
|
void QWaylandInputDevice::Keyboard::handleFocusLost()
|
|
|
|
{
|
|
|
|
mFocus = nullptr;
|
|
|
|
-#if QT_CONFIG(clipboard)
|
|
|
|
- if (auto *dataDevice = mParent->dataDevice())
|
|
|
|
- dataDevice->invalidateSelectionOffer();
|
|
|
|
-#endif
|
|
|
|
-#if QT_CONFIG(wayland_client_primary_selection)
|
|
|
|
- if (auto *device = mParent->primarySelectionDevice())
|
|
|
|
- device->invalidateSelectionOffer();
|
|
|
|
-#endif
|
|
|
|
mParent->mQDisplay->handleKeyboardFocusChanged(mParent);
|
|
|
|
mRepeatTimer.stop();
|
|
|
|
}
|
2021-12-06 15:08:41 +00:00
|
|
|
--
|
|
|
|
2.33.1
|
|
|
|
|