71 lines
2.7 KiB
Diff
71 lines
2.7 KiB
Diff
From dc692e89f101a47b9049b1f6ae4cc3cebef46edb Mon Sep 17 00:00:00 2001
|
|
From: Xaver Hugl <xaver.hugl@kde.org>
|
|
Date: Tue, 12 Aug 2025 15:59:16 +0200
|
|
Subject: [PATCH] xdgactivation: clear activation feedback if no token is
|
|
provided too
|
|
|
|
If the window is activated, the user expectation is that feedback stops. The underlying
|
|
reason for why it's activated doesn't matter.
|
|
---
|
|
src/xdgactivationv1.cpp | 12 ++++++++++--
|
|
src/xdgactivationv1.h | 3 ++-
|
|
2 files changed, 12 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/xdgactivationv1.cpp b/src/xdgactivationv1.cpp
|
|
index 360ca9b8743..567b792025f 100644
|
|
--- a/src/xdgactivationv1.cpp
|
|
+++ b/src/xdgactivationv1.cpp
|
|
@@ -33,6 +33,13 @@ static bool isPrivilegedInWindowManagement(const ClientConnection *client)
|
|
XdgActivationV1Integration::XdgActivationV1Integration(XdgActivationV1Interface *activation, QObject *parent)
|
|
: QObject(parent)
|
|
{
|
|
+ connect(Workspace::self(), &Workspace::windowActivated, this, [this](Window *window) {
|
|
+ if (!m_activation || !window || m_lastTokenAppId != window->desktopFileName()) {
|
|
+ return;
|
|
+ }
|
|
+ clearFeedback();
|
|
+ });
|
|
+
|
|
activation->setActivationTokenCreator([this](ClientConnection *client, SurfaceInterface *surface, uint serial, SeatInterface *seat, const QString &appId) -> QString {
|
|
Q_ASSERT(client); // Should always be available as it's coming straight from the wayland implementation
|
|
return requestToken(isPrivilegedInWindowManagement(client), surface, serial, seat, appId);
|
|
@@ -64,6 +71,7 @@ QString XdgActivationV1Integration::requestToken(bool isPrivileged, SurfaceInter
|
|
}
|
|
if (showNotify) {
|
|
m_lastToken = newToken;
|
|
+ m_lastTokenAppId = appId;
|
|
m_activation = waylandServer()->plasmaActivationFeedback()->createActivation(appId);
|
|
}
|
|
if (isPrivileged && workspace()->activeWindow()) {
|
|
@@ -95,10 +103,10 @@ void XdgActivationV1Integration::activateSurface(SurfaceInterface *surface, cons
|
|
} else {
|
|
window->setActivationToken(token);
|
|
}
|
|
- clear();
|
|
+ clearFeedback();
|
|
}
|
|
|
|
-void XdgActivationV1Integration::clear()
|
|
+void XdgActivationV1Integration::clearFeedback()
|
|
{
|
|
if (m_activation) {
|
|
Q_EMIT effects->startupRemoved(m_lastToken);
|
|
diff --git a/src/xdgactivationv1.h b/src/xdgactivationv1.h
|
|
index 77d21856095..ad007c088b6 100644
|
|
--- a/src/xdgactivationv1.h
|
|
+++ b/src/xdgactivationv1.h
|
|
@@ -36,9 +36,10 @@ public:
|
|
|
|
private:
|
|
QString requestToken(bool isPrivileged, SurfaceInterface *surface, uint serial, SeatInterface *seat, const QString &appId);
|
|
- void clear();
|
|
+ void clearFeedback();
|
|
|
|
QString m_lastToken;
|
|
+ QString m_lastTokenAppId;
|
|
std::unique_ptr<PlasmaWindowActivationInterface> m_activation;
|
|
};
|
|
|
|
--
|
|
GitLab
|
|
|