diff options
| author | Vaxry <vaxry@vaxry.net> | 2026-01-05 16:38:24 +0100 |
|---|---|---|
| committer | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-01-05 18:53:29 +0100 |
| commit | 107275238c0dd5e3de8b9c36575a335ebd393c56 (patch) | |
| tree | ff0c60a2a95d0aaead39b152554faf9e832ed492 /src/desktop/view/LayerSurface.cpp | |
| parent | 3b77c784e255b3d1d4381ab3619b8e7b8e23a0d6 (diff) | |
desktop/ls: clamp layer from protocol
Diffstat (limited to 'src/desktop/view/LayerSurface.cpp')
| -rw-r--r-- | src/desktop/view/LayerSurface.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/desktop/view/LayerSurface.cpp b/src/desktop/view/LayerSurface.cpp index 2d863225..b006c6b9 100644 --- a/src/desktop/view/LayerSurface.cpp +++ b/src/desktop/view/LayerSurface.cpp @@ -26,7 +26,7 @@ PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) { pLS->m_ruleApplicator = makeUnique<Desktop::Rule::CLayerRuleApplicator>(pLS); pLS->m_self = pLS; pLS->m_namespace = resource->m_layerNamespace; - pLS->m_layer = resource->m_current.layer; + pLS->m_layer = std::clamp(resource->m_current.layer, ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM, ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY); pLS->m_popupHead = CPopup::create(pLS); g_pAnimationManager->createAnimation(0.f, pLS->m_alpha, g_pConfigManager->getAnimationPropertyConfig("fadeLayersIn"), pLS, AVARDAMAGE_ENTIRE); @@ -323,16 +323,18 @@ void CLayerSurface::onCommit() { if (m_layerSurface->m_current.committed != 0) { if (m_layerSurface->m_current.committed & CLayerShellResource::eCommittedState::STATE_LAYER && m_layerSurface->m_current.layer != m_layer) { + const auto NEW_LAYER = std::clamp(m_layerSurface->m_current.layer, ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM, ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY); + for (auto it = PMONITOR->m_layerSurfaceLayers[m_layer].begin(); it != PMONITOR->m_layerSurfaceLayers[m_layer].end(); it++) { if (*it == m_self) { - PMONITOR->m_layerSurfaceLayers[m_layerSurface->m_current.layer].emplace_back(*it); + PMONITOR->m_layerSurfaceLayers[NEW_LAYER].emplace_back(*it); PMONITOR->m_layerSurfaceLayers[m_layer].erase(it); break; } } - m_layer = m_layerSurface->m_current.layer; - m_aboveFullscreen = m_layerSurface->m_current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY; + m_layer = NEW_LAYER; + m_aboveFullscreen = NEW_LAYER >= ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY; // if in fullscreen, only overlay can be above. *m_alpha = PMONITOR->inFullscreenMode() ? (m_layer >= ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY ? 1.F : 0.F) : 1.F; |
