diff options
| author | UjinT34 <41110182+UjinT34@users.noreply.github.com> | 2025-02-26 17:56:37 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-26 15:56:37 +0100 |
| commit | 6787fe8933b54f9e68f123df457e502dee9be13a (patch) | |
| tree | f77f71d739e8d403347b83fde4377bc519acea3e /src/protocols/core/Compositor.cpp | |
| parent | f0850905f0275922340035f62b6d808c2980ceda (diff) | |
protocols: Support wp color management proto (#9444)
Adds support for the recently merged w-p CM protocol alongside the (now deprecated) old CM WIP protocols
Diffstat (limited to 'src/protocols/core/Compositor.cpp')
| -rw-r--r-- | src/protocols/core/Compositor.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp index 92c3c425..06977338 100644 --- a/src/protocols/core/Compositor.cpp +++ b/src/protocols/core/Compositor.cpp @@ -306,6 +306,23 @@ void CWLSurfaceResource::breadthfirst(std::function<void(SP<CWLSurfaceResource>, bfHelper(surfs, fn, data); } +SP<CWLSurfaceResource> CWLSurfaceResource::findFirstPreorderHelper(SP<CWLSurfaceResource> root, std::function<bool(SP<CWLSurfaceResource>)> fn) { + if (fn(root)) + return root; + for (auto const& sub : root->subsurfaces) { + if (sub.expired() || sub->surface.expired()) + continue; + const auto found = findFirstPreorderHelper(sub->surface.lock(), fn); + if (found) + return found; + } + return nullptr; +} + +SP<CWLSurfaceResource> CWLSurfaceResource::findFirstPreorder(std::function<bool(SP<CWLSurfaceResource>)> fn) { + return findFirstPreorderHelper(self.lock(), fn); +} + std::pair<SP<CWLSurfaceResource>, Vector2D> CWLSurfaceResource::at(const Vector2D& localCoords, bool allowsInput) { std::vector<std::pair<SP<CWLSurfaceResource>, Vector2D>> surfs; breadthfirst([&surfs](SP<CWLSurfaceResource> surf, const Vector2D& offset, void* data) { surfs.emplace_back(std::make_pair<>(surf, offset)); }, &surfs); |
