summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2023-10-30 16:29:45 +0000
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-02-20 11:38:04 +0000
commitbaf2793fcd3deff068dff3638d3e7c229ac36f49 (patch)
treee44feb0c770a3809e4602e8e52d1b227e07514f7
parentef89d21776818e1ae1c6da1a648af3faf612d7af (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.6 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> (cherry picked from commit 9bad0fc2fd89fc5a7e77bef95e830a6dee1be731) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp25
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 57370f359..fc9b97c0f 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -636,17 +636,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;
}
}
}