From ecf98069f655a4e54943ec70d638ddcf429211d1 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 5 Nov 2023 19:57:11 +0000 Subject: [PATCH] layout: round window boxes after special scale factor fixes #3761 again --- src/layout/DwindleLayout.cpp | 9 ++++++--- src/layout/MasterLayout.cpp | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index eed06751..6602c758 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -207,10 +207,13 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for // if special, we adjust the coords a bit static auto* const PSCALEFACTOR = &g_pConfigManager->getConfigValuePtr("dwindle:special_scale_factor")->floatValue; - PWINDOW->m_vRealPosition = calcPos + (calcSize - calcSize * *PSCALEFACTOR) / 2.f; - PWINDOW->m_vRealSize = calcSize * *PSCALEFACTOR; + CBox wb = {calcPos + (calcSize - calcSize * *PSCALEFACTOR) / 2.f, calcSize * *PSCALEFACTOR}; + wb.round(); // avoid rounding mess - g_pXWaylandManager->setWindowSize(PWINDOW, calcSize * *PSCALEFACTOR); + PWINDOW->m_vRealPosition = wb.pos(); + PWINDOW->m_vRealSize = wb.size(); + + g_pXWaylandManager->setWindowSize(PWINDOW, wb.size()); } else { PWINDOW->m_vRealSize = calcSize; PWINDOW->m_vRealPosition = calcPos; diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index 46a05aa8..e29addfd 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -692,10 +692,13 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { if (g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID)) { static auto* const PSCALEFACTOR = &g_pConfigManager->getConfigValuePtr("master:special_scale_factor")->floatValue; - PWINDOW->m_vRealPosition = calcPos + (calcSize - calcSize * *PSCALEFACTOR) / 2.f; - PWINDOW->m_vRealSize = calcSize * *PSCALEFACTOR; + CBox wb = {calcPos + (calcSize - calcSize * *PSCALEFACTOR) / 2.f, calcSize * *PSCALEFACTOR}; + wb.round(); // avoid rounding mess - g_pXWaylandManager->setWindowSize(PWINDOW, calcSize * *PSCALEFACTOR); + PWINDOW->m_vRealPosition = wb.pos(); + PWINDOW->m_vRealSize = wb.size(); + + g_pXWaylandManager->setWindowSize(PWINDOW, wb.size()); } else { PWINDOW->m_vRealSize = calcSize; PWINDOW->m_vRealPosition = calcPos;