diff options
author | David Edmundson <davidedmundson@kde.org> | 2023-10-30 16:29:45 +0000 |
---|---|---|
committer | David Edmundson <davidedmundson@kde.org> | 2024-02-20 09:34:53 +0000 |
commit | 9bad0fc2fd89fc5a7e77bef95e830a6dee1be731 (patch) | |
tree | df9acba534152315d24c7c9989762e5a1829f710 | |
parent | fdb29f3f6fa83e030ba8be30f3e23ff21dea6b5a (diff) |
client: Support Xdg activation across shell surfaces
XDG activation operates on wl_surfaces, which can be used on all shell
types.
For the case of self activation there is was cast to the xdg
shellintegration on the focused window in order to populate the appId.
Only this part needs to be guarded, not the whole activation.
Pick-to: 6.6
Pick-to: 6.7
Change-Id: If44cc800b7cd98141ba05ba5d1cf0812ef777e7a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Marco Martin <mart@kde.org>
Reviewed-by: David Redondo <qt@david-redondo.de>
-rw-r--r-- | src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 566a0ff47..45714e2fe 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -637,17 +637,20 @@ bool QWaylandXdgSurface::requestActivate() // 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( - wlWindow->display(), wlWindow->wlSurface(), seat->serial(), xdgSurface->m_appId); - connect(tokenProvider, &QWaylandXdgActivationTokenV1::done, this, - [this, tokenProvider](const QString &token) { - m_shell->activation()->activate(token, window()->wlSurface()); - tokenProvider->deleteLater(); - }); - return true; - } + + QString appId; + if (const auto xdgSurface = qobject_cast<QWaylandXdgSurface *>(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, tokenProvider](const QString &token) { + m_shell->activation()->activate(token, window()->wlSurface()); + tokenProvider->deleteLater(); + }); + return true; } } } |