From 3b3718df3d8e8f729980408ac86dffb041a0fcff Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 24 Apr 2022 12:04:16 +0200 Subject: some fixes for full damage tracking --- src/render/Renderer.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/render') diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 0d50dae4..2c685f98 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -444,21 +444,27 @@ void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) { } void CHyprRenderer::damageWindow(CWindow* pWindow) { - const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); - if (!pWindow->m_bIsFloating) { // damage by size & pos // TODO TEMP: revise when added shadows/etc - wlr_box damageBox = {pWindow->m_vPosition.x - PMONITOR->vecPosition.x, pWindow->m_vPosition.y - PMONITOR->vecPosition.y, pWindow->m_vSize.x, pWindow->m_vSize.y}; - for (auto& m : g_pCompositor->m_lMonitors) - wlr_output_damage_add_box(m.damage, &damageBox); + wlr_box damageBox = {pWindow->m_vRealPosition.vec().x, pWindow->m_vRealPosition.vec().y, pWindow->m_vRealSize.vec().x, pWindow->m_vRealSize.vec().y}; + for (auto& m : g_pCompositor->m_lMonitors) { + wlr_box fixedDamageBox = damageBox; + fixedDamageBox.x -= m.vecPosition.x; + fixedDamageBox.y -= m.vecPosition.y; + wlr_output_damage_add_box(m.damage, &fixedDamageBox); + } } else { // damage by real size & pos + border size * 2 (JIC) const auto BORDERSIZE = g_pConfigManager->getInt("general:border_size"); wlr_box damageBox = { pWindow->m_vRealPosition.vec().x - BORDERSIZE - 1, pWindow->m_vRealPosition.vec().y - BORDERSIZE - 1, pWindow->m_vRealSize.vec().x + 2 * BORDERSIZE + 2, pWindow->m_vRealSize.vec().y + 2 * BORDERSIZE + 2}; - for (auto& m : g_pCompositor->m_lMonitors) - wlr_output_damage_add_box(m.damage, &damageBox); + for (auto& m : g_pCompositor->m_lMonitors) { + wlr_box fixedDamageBox = damageBox; + fixedDamageBox.x -= m.vecPosition.x; + fixedDamageBox.y -= m.vecPosition.y; + wlr_output_damage_add_box(m.damage, &fixedDamageBox); + } } } @@ -470,7 +476,8 @@ void CHyprRenderer::damageMonitor(SMonitor* pMonitor) { void CHyprRenderer::damageBox(wlr_box* pBox) { for (auto& m : g_pCompositor->m_lMonitors) { - wlr_output_damage_add_box(m.damage, pBox); + wlr_box damageBox = {pBox->x - m.vecPosition.x, pBox->y - m.vecPosition.y, pBox->width, pBox->height}; + wlr_output_damage_add_box(m.damage, &damageBox); } } -- cgit v1.2.3