diff --git a/workspace.h b/workspace.h index a938d9bd2..4d1e7e39b 100644 --- a/workspace.h +++ b/workspace.h @@ -32,6 +32,8 @@ along with this program. If not, see . #include // X #include +// std +#include // TODO: Cleanup the order of things in this .h file @@ -76,9 +78,11 @@ public: template Client* findClient(T predicate) const; template void forEachClient(T1 procedure, T2 predicate); template void forEachClient(T procedure); + void forEachClient(std::function func); template Unmanaged* findUnmanaged(T predicate) const; template void forEachUnmanaged(T1 procedure, T2 predicate); template void forEachUnmanaged(T procedure); + void forEachUnmanaged(std::function func); QRect clientArea(clientAreaOption, const QPoint& p, int desktop) const; QRect clientArea(clientAreaOption, const Client* c) const; @@ -686,6 +690,13 @@ inline void Workspace::forEachClient(T1 procedure, T2 predicate) procedure(*it); } +inline +void Workspace::forEachClient(std::function< void (Client*) > func) +{ + std::for_each(clients.constBegin(), clients.constEnd(), func); + std::for_each(desktops.constBegin(), desktops.constEnd(), func); +} + template< typename T > inline void Workspace::forEachClient(T procedure) { @@ -712,6 +723,12 @@ inline void Workspace::forEachUnmanaged(T procedure) return forEachUnmanaged(procedure, TruePredicate()); } +inline +void Workspace::forEachUnmanaged(std::function< void (Unmanaged*) > func) +{ + std::for_each(unmanaged.constBegin(), unmanaged.constEnd(), func); +} + KWIN_COMPARE_PREDICATE(ClientMatchPredicate, Client, const Client*, cl == value); inline bool Workspace::hasClient(const Client* c)