client: Attempt to request activate even if there's no last input device

The compositor is likely to display some indication
even if the activation fails but it doesn't happen
if there were no input due to the last input device condition,
resulting in no indication of activation failure on first window show.

Amends 41a9ffeb0c7309e9e2b84c3b3666a423dedce317
Amends 0fc235c5030ee6fb70dd145b1faad1567cf39788

Pick-to: 6.9 6.8
Change-Id: I08308c3338c0d3fa2c36004eb8f75ad0c1bcce4f
Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
Ilya Fedin 2025-03-09 06:03:07 +04:00
parent 732ea4faca
commit 5e9c9eba0f

View File

@ -567,16 +567,18 @@ bool QWaylandXdgSurface::requestActivate()
if (const auto xdgSurface = qobject_cast<QWaylandXdgSurface *>(wlWindow->shellSurface()))
appId = xdgSurface->m_appId;
if (const auto seat = wlWindow->display()->lastInputDevice()) {
const auto tokenProvider = activation->requestXdgActivationToken(
wlWindow->display(), wlWindow->wlSurface(), seat->serial(), appId);
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this,
[this](const QString &token) {
m_shell->activation()->activate(token, window()->wlSurface());
});
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater);
return true;
}
std::optional<uint32_t> serial;
if (const auto seat = wlWindow->display()->lastInputDevice())
serial = seat->serial();
const auto tokenProvider = activation->requestXdgActivationToken(
wlWindow->display(), wlWindow->wlSurface(), serial, appId);
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this,
[this](const QString &token) {
m_shell->activation()->activate(token, window()->wlSurface());
});
connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, tokenProvider, &QObject::deleteLater);
return true;
}
}
return false;