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
commit894679e2af1f5da908e8f2b2d399aaf5287d5775 (patch)
treef71d8c20f58c3f7657c1f9307f3745b499c1228d
parente99c2ee89fcca73e135c014863f08fb2761486be (diff)
downloadqtwayland-894679e2af1f5da908e8f2b2d399aaf5287d5775.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 c1462e07..d339bb56 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/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<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(