diff --git a/plugins/scenes/opengl/lanczosfilter.cpp b/plugins/scenes/opengl/lanczosfilter.cpp --- a/plugins/scenes/opengl/lanczosfilter.cpp +++ b/plugins/scenes/opengl/lanczosfilter.cpp @@ -394,18 +394,10 @@ delete m_offscreenTex; m_offscreenTarget = nullptr; m_offscreenTex = nullptr; - foreach (X11Client *c, Workspace::self()->clientList()) { - discardCacheTexture(c->effectWindow()); - } - foreach (X11Client *c, Workspace::self()->desktopList()) { - discardCacheTexture(c->effectWindow()); - } - foreach (Unmanaged *u, Workspace::self()->unmanagedList()) { - discardCacheTexture(u->effectWindow()); - } - foreach (Deleted *d, Workspace::self()->deletedList()) { - discardCacheTexture(d->effectWindow()); - } + + workspace()->forEachToplevel([this](Toplevel *toplevel) { + discardCacheTexture(toplevel->effectWindow()); + }); } } diff --git a/workspace.h b/workspace.h --- a/workspace.h +++ b/workspace.h @@ -133,6 +133,7 @@ Unmanaged *findUnmanaged(xcb_window_t w) const; void forEachUnmanaged(std::function func); Toplevel *findToplevel(std::function func) const; + void forEachToplevel(std::function func); /** * @brief Finds a Toplevel for the internal window @p w. * diff --git a/workspace.cpp b/workspace.cpp --- a/workspace.cpp +++ b/workspace.cpp @@ -1720,6 +1720,15 @@ return nullptr; } +void Workspace::forEachToplevel(std::function func) +{ + std::for_each(m_allClients.constBegin(), m_allClients.constEnd(), func); + std::for_each(desktops.constBegin(), desktops.constEnd(), func); + std::for_each(deleted.constBegin(), deleted.constEnd(), func); + std::for_each(unmanaged.constBegin(), unmanaged.constEnd(), func); + std::for_each(m_internalClients.constBegin(), m_internalClients.constEnd(), func); +} + bool Workspace::hasClient(const AbstractClient *c) { if (auto cc = dynamic_cast(c)) {