client: Attempt to request activate even if there's no focus window

The compositor is likely to display some indication
even if the activation fails, so it's helpful to always do the request.

Pick-to: 6.5 6.4
Change-Id: Ia3a8075e471d5a4b619f420ee166e7146f1229b8
Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
This commit is contained in:
Ilya Fedin 2023-01-13 07:47:24 +04:00
parent 9c35dc2284
commit 41a9ffeb0c

View File

@ -535,8 +535,12 @@ bool QWaylandXdgSurface::requestActivate()
activation->activate(token, window()->wlSurface());
qunsetenv("XDG_ACTIVATION_TOKEN");
return true;
} else if (const auto focusWindow = QGuiApplication::focusWindow()) {
const auto wlWindow = static_cast<QWaylandWindow*>(focusWindow->handle());
} else {
const auto focusWindow = QGuiApplication::focusWindow();
// At least GNOME requires to request the token in order to get the
// focus stealing prevention indication, so requestXdgActivationToken call
// is still necessary in that case.
const auto wlWindow = focusWindow ? static_cast<QWaylandWindow*>(focusWindow->handle()) : m_window;
if (const auto xdgSurface = qobject_cast<QWaylandXdgSurface *>(wlWindow->shellSurface())) {
if (const auto seat = wlWindow->display()->lastInputDevice()) {
const auto tokenProvider = activation->requestXdgActivationToken(