diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-12-08 15:04:40 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-08 15:04:40 +0000 |
| commit | 920353370bba555010506a1c0b204675c60362fe (patch) | |
| tree | 87ba1036ecad6294a9c86dfc828ed2a356c810bd /src/desktop/view/GlobalViewMethods.cpp | |
| parent | 834f019bab5df85b912a7aab7054fc8306f7c52a (diff) | |
desktop: cleanup, unify desktop elements as views (#12563)
Diffstat (limited to 'src/desktop/view/GlobalViewMethods.cpp')
| -rw-r--r-- | src/desktop/view/GlobalViewMethods.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/desktop/view/GlobalViewMethods.cpp b/src/desktop/view/GlobalViewMethods.cpp new file mode 100644 index 00000000..97dc9960 --- /dev/null +++ b/src/desktop/view/GlobalViewMethods.cpp @@ -0,0 +1,82 @@ +#include "GlobalViewMethods.hpp" +#include "../../Compositor.hpp" + +#include "LayerSurface.hpp" +#include "Window.hpp" +#include "Popup.hpp" +#include "Subsurface.hpp" +#include "SessionLock.hpp" + +#include "../../protocols/core/Compositor.hpp" +#include "../../protocols/core/Subcompositor.hpp" +#include "../../protocols/SessionLock.hpp" + +using namespace Desktop; +using namespace Desktop::View; + +std::vector<SP<IView>> View::getViewsForWorkspace(PHLWORKSPACE ws) { + std::vector<SP<IView>> views; + + for (const auto& w : g_pCompositor->m_windows) { + if (!w->visible() || w->m_workspace != ws) + continue; + + views.emplace_back(w); + + w->wlSurface()->resource()->breadthfirst( + [&views](SP<CWLSurfaceResource> s, const Vector2D& pos, void* data) { + auto surf = CWLSurface::fromResource(s); + if (!surf || !s->m_mapped) + return; + + views.emplace_back(surf->view()); + }, + nullptr); + + // xwl windows dont have this + if (w->m_popupHead) { + w->m_popupHead->breadthfirst( + [&views](SP<CPopup> s, void* data) { + auto surf = s->wlSurface(); + if (!surf || !s->visible()) + return; + + views.emplace_back(surf->view()); + }, + nullptr); + } + } + + for (const auto& l : g_pCompositor->m_layers) { + if (!l->visible() || l->m_monitor != ws->m_monitor) + continue; + + views.emplace_back(l); + + l->m_popupHead->breadthfirst( + [&views](SP<CPopup> p, void* data) { + auto surf = p->wlSurface(); + if (!surf || !p->visible()) + return; + + views.emplace_back(surf->view()); + }, + nullptr); + } + + for (const auto& v : g_pCompositor->m_otherViews) { + if (!v->visible() || !v->desktopComponent()) + continue; + + if (v->type() == VIEW_TYPE_LOCK_SCREEN) { + const auto LOCK = Desktop::View::CSessionLock::fromView(v); + if (LOCK->monitor() != ws->m_monitor) + continue; + + views.emplace_back(LOCK); + continue; + } + } + + return views; +} |
