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 18:25:08 +0000
commit063e0ca81c45fd793d463752128ea6fa0a25f89b (patch)
tree5e04d8a0033d982326f73e1b495b56fc2d4c3103
parent2435e705d3b37e0ab27b2f78722d3e7f19e59658 (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. 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> (cherry picked from commit baf2793fcd3deff068dff3638d3e7c229ac36f49)
-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 d8abd059b..a6be53e35 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -633,17 +633,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;
}
}
}