From b29509a32a0aa93555f47bc3d3f04c665c511f30 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 17 Sep 2025 10:27:07 +0300 Subject: [PATCH] shell: Port to KWaylandExtras::xdgActivationToken() --- shell/desktopview.cpp | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/shell/desktopview.cpp b/shell/desktopview.cpp index 9c3baa84b91..ca48e44e887 100644 --- a/shell/desktopview.cpp +++ b/shell/desktopview.cpp @@ -395,44 +395,6 @@ bool DesktopView::event(QEvent *e) return PlasmaQuick::ContainmentView::event(e); } -class ActivationTokenRequest : public QObject -{ - Q_OBJECT - -public: - explicit ActivationTokenRequest(QWindow *window) - : m_serial(KWaylandExtras::lastInputSerial(window)) - { - m_promise.start(); - - connect(KWaylandExtras::self(), &KWaylandExtras::xdgActivationTokenArrived, this, [this](int serial, const QString &token) { - if (m_serial == serial) { - if (!m_promise.isCanceled()) { - m_promise.addResult(token); - } - m_promise.finish(); - delete this; - } - }); - KWaylandExtras::requestXdgActivationToken(window, m_serial, QString()); - } - - QFuture future() const - { - return m_promise.future(); - } - -private: - QPromise m_promise; - int m_serial; -}; - -static QFuture fetchActivationToken(QWindow *window) -{ - auto request = new ActivationTokenRequest(window); - return request->future(); -} - bool DesktopView::handleKRunnerTextInput(QKeyEvent *e) { // allow only Shift and GroupSwitch modifiers @@ -459,7 +421,7 @@ bool DesktopView::handleKRunnerTextInput(QKeyEvent *e) if (!m_krunnerFuture.isCanceled()) { m_krunnerFuture.cancel(); } - m_krunnerFuture = fetchActivationToken(this); + m_krunnerFuture = KWaylandExtras::xdgActivationToken(this, QString()); m_krunnerFuture.then(this, [this](const QString &token) { auto message = QDBusMessage::createMethodCall(QStringLiteral("org.kde.krunner"), QStringLiteral("/org/kde/krunner"), @@ -672,5 +634,4 @@ void DesktopView::setAccentColorFromWallpaper(const QColor &accentColor) QDBusConnection::sessionBus().send(applyAccentColor); } -#include "desktopview.moc" #include "moc_desktopview.cpp" -- GitLab