From 41a9ffeb0c7309e9e2b84c3b3666a423dedce317 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 13 Jan 2023 07:47:24 +0400 Subject: [PATCH] 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 --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 c1462e07d7f..d339bb56b5f 100644 --- a/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/platforms/wayland/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -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(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(focusWindow->handle()) : m_window; if (const auto xdgSurface = qobject_cast(wlWindow->shellSurface())) { if (const auto seat = wlWindow->display()->lastInputDevice()) { const auto tokenProvider = activation->requestXdgActivationToken(