From 1ef90d9c907ac12352b64965bbf99231cba9b2ec Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 23 Jul 2020 13:13:22 +0200 Subject: [PATCH] Add API to easily find Toplevels from their internal Id --- workspace.cpp | 7 +++++++ workspace.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/workspace.cpp b/workspace.cpp index c6b8828c74..f901166709 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -1712,6 +1712,13 @@ Toplevel *Workspace::findToplevel(std::function func) co return nullptr; } +Toplevel *Workspace::findToplevel(const QUuid &internalId) const +{ + return findToplevel([internalId] (const KWin::Toplevel* l) -> bool { + return internalId == l->internalId(); + }); +} + void Workspace::forEachToplevel(std::function func) { std::for_each(m_allClients.constBegin(), m_allClients.constEnd(), func); diff --git a/workspace.h b/workspace.h index 9e3c1bb5b9..073ef3759b 100644 --- a/workspace.h +++ b/workspace.h @@ -134,6 +134,9 @@ public: void forEachUnmanaged(std::function func); Toplevel *findToplevel(std::function func) const; void forEachToplevel(std::function func); + + Toplevel *findToplevel(const QUuid &internalId) const; + /** * @brief Finds a Toplevel for the internal window @p w. *