Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
UjinT34 committed Feb 25, 2025
1 parent 5eb9ef9 commit 2854b33
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/protocols/core/Compositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,21 +306,21 @@ void CWLSurfaceResource::breadthfirst(std::function<void(SP<CWLSurfaceResource>,
bfHelper(surfs, fn, data);
}

SP<CWLSurfaceResource> CWLSurfaceResource::findFirstHelper(SP<CWLSurfaceResource> root, std::function<bool(SP<CWLSurfaceResource>)> fn) {
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 = findFirstHelper(sub->surface.lock(), fn);
const auto found = findFirstPreorderHelper(sub->surface.lock(), fn);
if (found)
return found;
}
return nullptr;
}

SP<CWLSurfaceResource> CWLSurfaceResource::findFirst(std::function<bool(SP<CWLSurfaceResource>)> fn) {
return findFirstHelper(self.lock(), fn);
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) {
Expand Down
4 changes: 2 additions & 2 deletions src/protocols/core/Compositor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class CWLSurfaceResource {
WP<CContentType> contentType;

void breadthfirst(std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data);
SP<CWLSurfaceResource> findFirst(std::function<bool(SP<CWLSurfaceResource>)> fn);
SP<CWLSurfaceResource> findFirstPreorder(std::function<bool(SP<CWLSurfaceResource>)> fn);
CRegion accumulateCurrentBufferDamage();
void presentFeedback(timespec* when, PHLMONITOR pMonitor, bool discarded = false);
void lockPendingState();
Expand All @@ -153,7 +153,7 @@ class CWLSurfaceResource {
void dropCurrentBuffer();
void commitPendingState();
void bfHelper(std::vector<SP<CWLSurfaceResource>> const& nodes, std::function<void(SP<CWLSurfaceResource>, const Vector2D&, void*)> fn, void* data);
SP<CWLSurfaceResource> findFirstHelper(SP<CWLSurfaceResource> root, std::function<bool(SP<CWLSurfaceResource>)> fn);
SP<CWLSurfaceResource> findFirstPreorderHelper(SP<CWLSurfaceResource> root, std::function<bool(SP<CWLSurfaceResource>)> fn);
void updateCursorShm(CRegion damage = CBox{0, 0, INT16_MAX, INT16_MAX});

friend class CWLPointerResource;
Expand Down
3 changes: 2 additions & 1 deletion src/protocols/types/ColorManagement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ namespace NColorManagement {
CM_TRANSFER_FUNCTION_HLG = 13,
};

// FIXME should be ok this way. unsupported primaries/tfs must be rejected earlier. might need a proper switch-case with exception as default.
// NOTE should be ok this way. unsupported primaries/tfs must be rejected earlier. supported enum values should be in sync with proto.
// might need a proper switch-case and additional INVALID enum value.
inline wpColorManagerV1Primaries convertPrimaries(ePrimaries primaries) {
return (wpColorManagerV1Primaries)primaries;
}
Expand Down
3 changes: 2 additions & 1 deletion src/render/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,8 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
if (pMonitor->activeWorkspace && pMonitor->activeWorkspace->m_bHasFullscreenWindow && pMonitor->activeWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN) {
const auto WINDOW = pMonitor->activeWorkspace->getFullscreenWindow();
const auto ROOT_SURF = WINDOW->m_pWLSurface->resource();
const auto SURF = ROOT_SURF->findFirst([ROOT_SURF](SP<CWLSurfaceResource> surf) { return surf->colorManagement.valid() && surf->extends() == ROOT_SURF->extends(); });
const auto SURF =
ROOT_SURF->findFirstPreorder([ROOT_SURF](SP<CWLSurfaceResource> surf) { return surf->colorManagement.valid() && surf->extends() == ROOT_SURF->extends(); });

if (SURF && SURF->colorManagement.valid() && SURF->colorManagement->hasImageDescription()) {
bool needsHdrMetadataUpdate = SURF->colorManagement->needsHdrMetadataUpdate() || pMonitor->m_previousFSWindow != WINDOW;
Expand Down

0 comments on commit 2854b33

Please sign in to comment.