From c885afcbc63cd3afd7ecf8c6ee45a908cdf6249f Mon Sep 17 00:00:00 2001 From: Dickby Date: Sun, 25 Sep 2022 12:42:39 +0200 Subject: [PATCH 1/2] Scale border size in calculations of windows --- src/layout/MasterLayout.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index 0c1d1dd1..0a1c5179 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -133,7 +133,7 @@ void CHyprMasterLayout::recalculateMonitor(const int& monid) { } if (PWORKSPACE->m_bHasFullscreenWindow) { - if (PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) + if (PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL) return; // massive hack from the fullscreen func @@ -241,12 +241,14 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { PWINDOW->m_vSize = pNode->size; PWINDOW->m_vPosition = pNode->position; - auto calcPos = PWINDOW->m_vPosition + Vector2D(*PBORDERSIZE, *PBORDERSIZE); - auto calcSize = PWINDOW->m_vSize - Vector2D(2 * *PBORDERSIZE, 2 * *PBORDERSIZE); + float scaledBorderSize = *PBORDERSIZE / PMONITOR->scale; + + auto calcPos = PWINDOW->m_vPosition + Vector2D(scaledBorderSize, scaledBorderSize); + auto calcSize = PWINDOW->m_vSize - Vector2D(2 * scaledBorderSize, 2 * scaledBorderSize); if (*PNOGAPSWHENONLY && PWINDOW->m_iWorkspaceID != SPECIAL_WORKSPACE_ID && getNodesOnWorkspace(PWINDOW->m_iWorkspaceID) == 1) { - PWINDOW->m_vRealPosition = calcPos - Vector2D(*PBORDERSIZE, *PBORDERSIZE); - PWINDOW->m_vRealSize = calcSize + Vector2D(2 * *PBORDERSIZE, 2 * *PBORDERSIZE); + PWINDOW->m_vRealPosition = calcPos - Vector2D(scaledBorderSize, scaledBorderSize); + PWINDOW->m_vRealSize = calcSize + Vector2D(2 * scaledBorderSize, 2 * scaledBorderSize); PWINDOW->updateWindowDecos(); @@ -612,4 +614,4 @@ void CHyprMasterLayout::onEnable() { void CHyprMasterLayout::onDisable() { m_lMasterNodesData.clear(); -} \ No newline at end of file +} From e476382d08059bd4e2571e1c52c1ce687a02fd1e Mon Sep 17 00:00:00 2001 From: Dickby Date: Sun, 25 Sep 2022 12:45:55 +0200 Subject: [PATCH 2/2] scale border size in dwindle layout window sizes. --- src/layout/DwindleLayout.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index 59b36156..fb420f8e 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -182,15 +182,16 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for PWINDOW->m_vPosition = pNode->position; static auto *const PNOGAPSWHENONLY = &g_pConfigManager->getConfigValuePtr("dwindle:no_gaps_when_only")->intValue; + float scaledBorderSize = *PBORDERSIZE / PMONITOR->scale; - auto calcPos = PWINDOW->m_vPosition + Vector2D(*PBORDERSIZE, *PBORDERSIZE); - auto calcSize = PWINDOW->m_vSize - Vector2D(2 * *PBORDERSIZE, 2 * *PBORDERSIZE); + auto calcPos = PWINDOW->m_vPosition + Vector2D(scaledBorderSize, scaledBorderSize); + auto calcSize = PWINDOW->m_vSize - Vector2D(2 * scaledBorderSize, 2 * scaledBorderSize); const auto NODESONWORKSPACE = getNodesOnWorkspace(PWINDOW->m_iWorkspaceID); if (*PNOGAPSWHENONLY && PWINDOW->m_iWorkspaceID != SPECIAL_WORKSPACE_ID && (NODESONWORKSPACE == 1 || (pNode->isGroupMember() && pNode->getGroupMemberCount() == NODESONWORKSPACE))) { - PWINDOW->m_vRealPosition = calcPos - Vector2D(*PBORDERSIZE, *PBORDERSIZE); - PWINDOW->m_vRealSize = calcSize + Vector2D(2 * *PBORDERSIZE, 2 * *PBORDERSIZE); + PWINDOW->m_vRealPosition = calcPos - Vector2D(scaledBorderSize, scaledBorderSize); + PWINDOW->m_vRealSize = calcSize + Vector2D(2 * scaledBorderSize, 2 * scaledBorderSize); PWINDOW->updateWindowDecos();