From 5e9c9eba0feeb94533fb5b49666985026d7c2b91 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 9 Mar 2025 06:03:07 +0400 Subject: [PATCH] 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 --- .../xdg-shell/qwaylandxdgshell.cpp | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 29489acda89..29c7cbf55d9 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -567,16 +567,18 @@ bool QWaylandXdgSurface::requestActivate() if (const auto xdgSurface = qobject_cast(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 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;