summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Fedin <fedin-ilja2010@ya.ru>2023-01-13 07:47:24 +0400
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-01-25 14:34:03 +0000
commit4e302cecde9c84e7b2e558ef7772d17179b22488 (patch)
tree46e12adc17976c4904d9c4bdf2a228857377310f
parentdf4ded984e461f8e29534826c76a27858c1167e9 (diff)
downloadqtwayland-4e302cecde9c84e7b2e558ef7772d17179b22488.tar.gz
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. Change-Id: Ia3a8075e471d5a4b619f420ee166e7146f1229b8 Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org> (cherry picked from commit f0de6ff9606ea2bf0622f8d8c67e8688be86bf0d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index 415bcad2..4e3b70e6 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -496,8 +496,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(