3
0
mirror of https://github.com/hyprwm/Hyprland.git synced 2025-10-30 03:41:16 +00:00

layer-shell: fix fullscreen alpha when changing layers (#12124)

* layer-shell: fix fullscreen alpha when changing layers

* this is intended

* ooops

* ooops #2
This commit is contained in:
Virt 2025-10-25 19:53:01 +02:00 committed by GitHub
parent b6f946991d
commit 72cbb7906a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)