62 lines
2.5 KiB
Diff
62 lines
2.5 KiB
Diff
|
From 5ac39d2d76735c5d1d28a16f7fbc8b28e39886dd Mon Sep 17 00:00:00 2001
|
||
|
From: Jan Grulich <jgrulich@redhat.com>
|
||
|
Date: Fri, 16 Jul 2021 13:00:03 +0200
|
||
|
Subject: [PATCH] Client: do not empty clipboard when a new popup/window is opened
|
||
|
|
||
|
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
|
||
|
Pick-to: 6.2 5.15
|
||
|
Change-Id: Ia2ef826c2967b1daf1cdeb085e8dae66d090dbcf
|
||
|
---
|
||
|
|
||
|
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
|
||
|
index 2730311..e05eee5 100644
|
||
|
--- a/src/client/qwaylanddisplay.cpp
|
||
|
+++ b/src/client/qwaylanddisplay.cpp
|
||
|
@@ -595,8 +595,21 @@ void QWaylandDisplay::handleWaylandSync()
|
||
|
// pair, and the latter one would be lost in the QWindowSystemInterface queue, if we issue the
|
||
|
// handleWindowActivated() calls immediately.
|
||
|
QWindow *activeWindow = mActiveWindows.empty() ? nullptr : mActiveWindows.last()->window();
|
||
|
- if (activeWindow != QGuiApplication::focusWindow())
|
||
|
+ if (activeWindow != QGuiApplication::focusWindow()) {
|
||
|
+ if (!activeWindow) {
|
||
|
+ if (lastInputDevice()) {
|
||
|
+#if QT_CONFIG(clipboard)
|
||
|
+ if (auto *dataDevice = lastInputDevice()->dataDevice())
|
||
|
+ dataDevice->invalidateSelectionOffer();
|
||
|
+#endif
|
||
|
+#if QT_CONFIG(wayland_client_primary_selection)
|
||
|
+ if (auto *device = lastInputDevice()->primarySelectionDevice())
|
||
|
+ device->invalidateSelectionOffer();
|
||
|
+#endif
|
||
|
+ }
|
||
|
+ }
|
||
|
QWindowSystemInterface::handleWindowActivated(activeWindow);
|
||
|
+ }
|
||
|
}
|
||
|
|
||
|
const wl_callback_listener QWaylandDisplay::syncCallbackListener = {
|
||
|
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp
|
||
|
index ae045f4..514457e 100644
|
||
|
--- 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();
|
||
|
}
|