diff options
author | vaxerski <[email protected]> | 2022-06-27 14:07:33 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-06-27 14:07:33 +0200 |
commit | dfe06cb060bcd71e74a47a9190de826d8ebf09be (patch) | |
tree | fe19a5a727c65a6df892b1546bdb6573feec6be8 | |
parent | 5ad8cead7cfc70cd7ca73cf60bb9703569f11927 (diff) | |
download | Hyprland-dfe06cb060bcd71e74a47a9190de826d8ebf09be.tar.gz Hyprland-dfe06cb060bcd71e74a47a9190de826d8ebf09be.zip |
fix crash with decos with null workspaces
-rw-r--r-- | src/render/decorations/CHyprDropShadowDecoration.cpp | 6 | ||||
-rw-r--r-- | src/render/decorations/CHyprGroupBarDecoration.cpp | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/render/decorations/CHyprDropShadowDecoration.cpp b/src/render/decorations/CHyprDropShadowDecoration.cpp index 1c11a1c9..121bfa12 100644 --- a/src/render/decorations/CHyprDropShadowDecoration.cpp +++ b/src/render/decorations/CHyprDropShadowDecoration.cpp @@ -38,8 +38,10 @@ void CHyprDropShadowDecoration::updateWindow(CWindow* pWindow) { const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID); - if (pWindow->m_vRealPosition.vec() + PWORKSPACE->m_vRenderOffset.vec() != m_vLastWindowPos || pWindow->m_vRealSize.vec() != m_vLastWindowSize) { - m_vLastWindowPos = pWindow->m_vRealPosition.vec() + PWORKSPACE->m_vRenderOffset.vec(); + const auto WORKSPACEOFFSET = PWORKSPACE ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D(); + + if (pWindow->m_vRealPosition.vec() + WORKSPACEOFFSET != m_vLastWindowPos || pWindow->m_vRealSize.vec() != m_vLastWindowSize) { + m_vLastWindowPos = pWindow->m_vRealPosition.vec() + WORKSPACEOFFSET; m_vLastWindowSize = pWindow->m_vRealSize.vec(); damageEntire(); diff --git a/src/render/decorations/CHyprGroupBarDecoration.cpp b/src/render/decorations/CHyprGroupBarDecoration.cpp index 833033de..abb5d90c 100644 --- a/src/render/decorations/CHyprGroupBarDecoration.cpp +++ b/src/render/decorations/CHyprGroupBarDecoration.cpp @@ -23,14 +23,16 @@ void CHyprGroupBarDecoration::updateWindow(CWindow* pWindow) { const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID); - if (pWindow->m_vRealPosition.vec() + PWORKSPACE->m_vRenderOffset.vec() != m_vLastWindowPos || pWindow->m_vRealSize.vec() != m_vLastWindowSize) { + const auto WORKSPACEOFFSET = PWORKSPACE ? PWORKSPACE->m_vRenderOffset.vec() : Vector2D(); + + if (pWindow->m_vRealPosition.vec() + WORKSPACEOFFSET != m_vLastWindowPos || pWindow->m_vRealSize.vec() != m_vLastWindowSize) { // we draw 3px above the window's border with 3px const auto BORDERSIZE = g_pConfigManager->getInt("general:border_size"); m_seExtents.topLeft = Vector2D(0, BORDERSIZE + 3 + 3); m_seExtents.bottomRight = Vector2D(); - m_vLastWindowPos = pWindow->m_vRealPosition.vec() + PWORKSPACE->m_vRenderOffset.vec(); + m_vLastWindowPos = pWindow->m_vRealPosition.vec() + WORKSPACEOFFSET; m_vLastWindowSize = pWindow->m_vRealSize.vec(); } |