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 Change-Id: Ia2ef826c2967b1daf1cdeb085e8dae66d090dbcf Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
parent
4be0cbb5b3
commit
5c9a38e768
@ -600,6 +600,19 @@ void QWaylandDisplay::handleWaylandSync()
|
|||||||
QWindow *activeWindow = mActiveWindows.empty() ? nullptr : mActiveWindows.last()->window();
|
QWindow *activeWindow = mActiveWindows.empty() ? nullptr : mActiveWindows.last()->window();
|
||||||
if (activeWindow != QGuiApplication::focusWindow())
|
if (activeWindow != QGuiApplication::focusWindow())
|
||||||
QWindowSystemInterface::handleWindowActivated(activeWindow);
|
QWindowSystemInterface::handleWindowActivated(activeWindow);
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const wl_callback_listener QWaylandDisplay::syncCallbackListener = {
|
const wl_callback_listener QWaylandDisplay::syncCallbackListener = {
|
||||||
|
@ -1337,14 +1337,6 @@ void QWaylandInputDevice::Keyboard::handleFocusDestroyed()
|
|||||||
void QWaylandInputDevice::Keyboard::handleFocusLost()
|
void QWaylandInputDevice::Keyboard::handleFocusLost()
|
||||||
{
|
{
|
||||||
mFocus = nullptr;
|
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);
|
mParent->mQDisplay->handleKeyboardFocusChanged(mParent);
|
||||||
mRepeatTimer.stop();
|
mRepeatTimer.stop();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user