avoid layout changes when unnecessary in applyMonitorRule

This commit is contained in:
vaxerski 2022-10-29 12:24:44 +01:00
parent 74d05d0adc
commit 05f3eebd96

View file

@ -1214,16 +1214,21 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
pMonitor->vecPosition = pMonitorRule->offset;
}
if (!pMonitor->isMirror())
wlr_output_layout_add(g_pCompositor->m_sWLROutputLayout, pMonitor->output, (int)pMonitor->vecPosition.x, (int)pMonitor->vecPosition.y);
wlr_output_enable(pMonitor->output, true);
// update renderer (here because it will call rollback, so we cannot do this before committing)
g_pHyprOpenGL->destroyMonitorResources(pMonitor);
// updato wlroots
if (!pMonitor->isMirror()) {
wlr_box box = {0, 0, 0, 0};
wlr_output_layout_get_box(g_pCompositor->m_sWLROutputLayout, pMonitor->output, &box);
if (!DELTALESSTHAN(box.x, pMonitor->vecPosition.x, 1) || !DELTALESSTHAN(box.y, pMonitor->vecPosition.y, 1)) {
wlr_output_layout_add(g_pCompositor->m_sWLROutputLayout, pMonitor->output, (int)pMonitor->vecPosition.x, (int)pMonitor->vecPosition.y);
Events::listener_change(nullptr, nullptr);
}
}
// updato us
arrangeLayersForMonitor(pMonitor->ID);