simplify damageWindow

This commit is contained in:
vaxerski 2022-06-29 11:21:42 +02:00
parent 9388bb5d55
commit 5636d2031e

View file

@ -576,39 +576,19 @@ void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) {
} }
void CHyprRenderer::damageWindow(CWindow* pWindow) { void CHyprRenderer::damageWindow(CWindow* pWindow) {
if (!pWindow->m_bIsFloating) { wlr_box damageBox = pWindow->getFullWindowBoundingBox();
// damage by size & pos for (auto& m : g_pCompositor->m_lMonitors) {
// TODO TEMP: revise when added shadows/etc wlr_box fixedDamageBox = damageBox;
fixedDamageBox.x -= m.vecPosition.x;
wlr_box damageBox = pWindow->getFullWindowBoundingBox(); fixedDamageBox.y -= m.vecPosition.y;
for (auto& m : g_pCompositor->m_lMonitors) { scaleBox(&fixedDamageBox, m.scale);
wlr_box fixedDamageBox = damageBox; wlr_output_damage_add_box(m.damage, &fixedDamageBox);
fixedDamageBox.x -= m.vecPosition.x;
fixedDamageBox.y -= m.vecPosition.y;
scaleBox(&fixedDamageBox, m.scale);
wlr_output_damage_add_box(m.damage, &fixedDamageBox);
}
static auto *const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE)
Debug::log(LOG, "Damage: Window floated (%s): xy: %d, %d wh: %d, %d", pWindow->m_szTitle.c_str(), damageBox.x, damageBox.y, damageBox.width, damageBox.height);
} else {
// damage by real size & pos + border size * 2 (JIC)
wlr_box damageBox = pWindow->getFullWindowBoundingBox();
for (auto& m : g_pCompositor->m_lMonitors) {
wlr_box fixedDamageBox = damageBox;
fixedDamageBox.x -= m.vecPosition.x;
fixedDamageBox.y -= m.vecPosition.y;
scaleBox(&fixedDamageBox, m.scale);
wlr_output_damage_add_box(m.damage, &fixedDamageBox);
}
static auto *const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE)
Debug::log(LOG, "Damage: Window tiled (%s): xy: %d, %d wh: %d, %d", pWindow->m_szTitle.c_str(), damageBox.x, damageBox.y, damageBox.width, damageBox.height);
} }
static auto* const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE)
Debug::log(LOG, "Damage: Window (%s): xy: %d, %d wh: %d, %d", pWindow->m_szTitle.c_str(), damageBox.x, damageBox.y, damageBox.width, damageBox.height);
} }
void CHyprRenderer::damageMonitor(SMonitor* pMonitor) { void CHyprRenderer::damageMonitor(SMonitor* pMonitor) {