activation: Guard against not having any active window

If we have no active window we shouldn't call lastUsageSerial. We may as
well activate whatever client requested it.
This commit is contained in:
David Edmundson 2022-11-15 19:12:29 +00:00 committed by Vlad Zahorodnii
parent 18553417d3
commit 319c6a4cfa

View file

@ -128,7 +128,7 @@ void XdgActivationV1Integration::activateSurface(SurfaceInterface *surface, cons
auto ownerWindow = waylandServer()->findWindow(m_currentActivationToken->surface);
qCDebug(KWIN_CORE) << "activating" << window << surface << "on behalf of" << m_currentActivationToken->surface << "into" << ownerWindow;
if (ws->activeWindow() == ownerWindow || ws->activeWindow()->lastUsageSerial() < m_currentActivationToken->serial || m_currentActivationToken->isPrivileged) {
if (!ws->activeWindow() || ws->activeWindow() == ownerWindow || ws->activeWindow()->lastUsageSerial() < m_currentActivationToken->serial || m_currentActivationToken->isPrivileged) {
ws->activateWindow(window);
} else {
qCWarning(KWIN_CORE) << "Activation requested while owner isn't active" << (ownerWindow ? ownerWindow->desktopFileName() : "null")