From 05f3eebd968455752eb95cee373bbf2d9a71deae Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 29 Oct 2022 12:24:44 +0100 Subject: [PATCH] avoid layout changes when unnecessary in applyMonitorRule --- src/render/Renderer.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 3247e499..24e6accd 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -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 - Events::listener_change(nullptr, nullptr); + 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);