summaryrefslogtreecommitdiff
path: root/src/desktop/LayerSurface.cpp
diff options
context:
space:
mode:
authorVirt <41426325+VirtCode@users.noreply.github.com>2025-10-25 19:53:01 +0200
committerGitHub <noreply@github.com>2025-10-25 18:53:01 +0100
commit72cbb7906a0c65eb62b1d5ddb0769dc0391f37e6 (patch)
tree165ea413dba59c6c8f4ca30c8b0a09360ae28d20 /src/desktop/LayerSurface.cpp
parentb6f946991da0bf372df3f9f8f7160ac8514db8b9 (diff)
layer-shell: fix fullscreen alpha when changing layers (#12124)
* layer-shell: fix fullscreen alpha when changing layers * this is intended * ooops * ooops #2
Diffstat (limited to 'src/desktop/LayerSurface.cpp')
-rw-r--r--src/desktop/LayerSurface.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/desktop/LayerSurface.cpp b/src/desktop/LayerSurface.cpp
index 5d2ab9a8..6278078d 100644
--- a/src/desktop/LayerSurface.cpp
+++ b/src/desktop/LayerSurface.cpp
@@ -289,18 +289,32 @@ void CLayerSurface::onCommit() {
g_pHyprRenderer->damageBox(geomFixed);
if (m_layerSurface->m_current.committed != 0) {
- if (m_layerSurface->m_current.committed & CLayerShellResource::eCommittedState::STATE_LAYER) {
+ if (m_layerSurface->m_current.committed & CLayerShellResource::eCommittedState::STATE_LAYER && m_layerSurface->m_current.layer != m_layer) {
for (auto it = PMONITOR->m_layerSurfaceLayers[m_layer].begin(); it != PMONITOR->m_layerSurfaceLayers[m_layer].end(); it++) {
if (*it == m_self) {
- if (m_layerSurface->m_current.layer == m_layer)
- break;
PMONITOR->m_layerSurfaceLayers[m_layerSurface->m_current.layer].emplace_back(*it);
PMONITOR->m_layerSurfaceLayers[m_layer].erase(it);
break;
}
}
+ // update alpha when window is in fullscreen
+ auto PWORKSPACE = PMONITOR->m_activeSpecialWorkspace ? PMONITOR->m_activeSpecialWorkspace : PMONITOR->m_activeWorkspace;
+ if (PWORKSPACE && PWORKSPACE->m_fullscreenMode == FSMODE_FULLSCREEN) {
+ // warp if switching render layer so we don't see glitches and have clean fade
+ if ((m_layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || m_layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM) &&
+ (m_layerSurface->m_current.layer == ZWLR_LAYER_SHELL_V1_LAYER_TOP || m_layerSurface->m_current.layer == ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY))
+ m_alpha->setValueAndWarp(0.f);
+
+ // from overlay to top
+ if (m_layer == ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY && m_layerSurface->m_current.layer == ZWLR_LAYER_SHELL_V1_LAYER_TOP)
+ *m_alpha = 0.f;
+ // to overlay
+ if (m_layerSurface->m_current.layer == ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY)
+ *m_alpha = 1.f;
+ }
+
m_layer = m_layerSurface->m_current.layer;
if (m_layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || m_layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM)