diff options
author | MightyPlaza <[email protected]> | 2023-07-24 10:13:40 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2023-07-24 12:13:40 +0200 |
commit | 6db3c4ef5ec21f415577a26b0cdf57c98a778eb5 (patch) | |
tree | 3f3725b1b21c8c9dccd10635923cbcd2763bd7f2 | |
parent | 2bbe3aa122f242f43ac31fb85a39da48db69ca79 (diff) | |
download | Hyprland-6db3c4ef5ec21f415577a26b0cdf57c98a778eb5.tar.gz Hyprland-6db3c4ef5ec21f415577a26b0cdf57c98a778eb5.zip |
layout: no_border_when_only-improvements (#2791)
-rw-r--r-- | src/layout/DwindleLayout.cpp | 27 | ||||
-rw-r--r-- | src/layout/MasterLayout.cpp | 25 |
2 files changed, 31 insertions, 21 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp index bd131b16..d544fa4c 100644 --- a/src/layout/DwindleLayout.cpp +++ b/src/layout/DwindleLayout.cpp @@ -144,21 +144,23 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for static auto* const PNOGAPSWHENONLY = &g_pConfigManager->getConfigValuePtr("dwindle:no_gaps_when_only")->intValue; - auto calcPos = PWINDOW->m_vPosition + Vector2D(borderSize, borderSize); - auto calcSize = PWINDOW->m_vSize - Vector2D(2 * borderSize, 2 * borderSize); - const auto NODESONWORKSPACE = getNodesOnWorkspace(PWINDOW->m_iWorkspaceID); - if (*PNOGAPSWHENONLY && !WORKSPACERULE.border && !g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID) && + if (*PNOGAPSWHENONLY && !g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID) && (NODESONWORKSPACE == 1 || (PWINDOW->m_bIsFullscreen && g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) { - PWINDOW->m_vRealPosition = calcPos - Vector2D(borderSize, borderSize); - PWINDOW->m_vRealSize = calcSize + Vector2D(2 * borderSize, 2 * borderSize); - - PWINDOW->updateWindowDecos(); PWINDOW->m_sSpecialRenderData.rounding = false; - PWINDOW->m_sSpecialRenderData.border = false; - PWINDOW->m_sSpecialRenderData.decorate = false; + PWINDOW->m_sSpecialRenderData.decorate = WORKSPACERULE.decorate.value_or(true); + PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(*PNOGAPSWHENONLY == 2); + + const auto RESERVED = PWINDOW->getFullWindowReservedArea(); + + borderSize *= PWINDOW->m_sSpecialRenderData.border; + + PWINDOW->m_vRealPosition = PWINDOW->m_vPosition + Vector2D(borderSize, borderSize) + RESERVED.topLeft; + PWINDOW->m_vRealSize = PWINDOW->m_vSize - Vector2D(2 * borderSize, 2 * borderSize) - (RESERVED.topLeft + RESERVED.bottomRight); + + PWINDOW->updateWindowDecos(); return; } @@ -168,6 +170,9 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(true); PWINDOW->m_sSpecialRenderData.borderSize = WORKSPACERULE.borderSize.value_or(-1); + auto calcPos = PWINDOW->m_vPosition + Vector2D(borderSize, borderSize); + auto calcSize = PWINDOW->m_vSize - Vector2D(2 * borderSize, 2 * borderSize); + const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? gapsOut : gapsIn, DISPLAYTOP ? gapsOut : gapsIn); const auto OFFSETBOTTOMRIGHT = Vector2D(DISPLAYRIGHT ? gapsOut : gapsIn, DISPLAYBOTTOM ? gapsOut : gapsIn); @@ -318,7 +323,7 @@ void CHyprDwindleLayout::onWindowCreatedTiling(CWindow* pWindow) { // if it's a group, add the window if (OPENINGON->pWindow->m_sGroupData.pNextWindow && !OPENINGON->pWindow->getGroupHead()->m_sGroupData.locked && - !g_pKeybindManager->m_bGroupsLocked) { // target is an unlocked group + !g_pKeybindManager->m_bGroupsLocked) { // target is an unlocked group if (!pWindow->m_sGroupData.pNextWindow) { // source is not a group m_lDwindleNodesData.remove(*PNODE); diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp index ca826d4d..ebe7f4b7 100644 --- a/src/layout/MasterLayout.cpp +++ b/src/layout/MasterLayout.cpp @@ -530,20 +530,22 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { PWINDOW->m_vSize = pNode->size; PWINDOW->m_vPosition = pNode->position; - auto calcPos = PWINDOW->m_vPosition + Vector2D(borderSize, borderSize); - auto calcSize = PWINDOW->m_vSize - Vector2D(2 * borderSize, 2 * borderSize); - - if (*PNOGAPSWHENONLY && !WORKSPACERULE.border && !g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID) && + if (*PNOGAPSWHENONLY && !g_pCompositor->isWorkspaceSpecial(PWINDOW->m_iWorkspaceID) && (getNodesOnWorkspace(PWINDOW->m_iWorkspaceID) == 1 || (PWINDOW->m_bIsFullscreen && g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_efFullscreenMode == FULLSCREEN_MAXIMIZED))) { - PWINDOW->m_vRealPosition = calcPos - Vector2D(borderSize, borderSize); - PWINDOW->m_vRealSize = calcSize + Vector2D(2 * borderSize, 2 * borderSize); - - PWINDOW->updateWindowDecos(); PWINDOW->m_sSpecialRenderData.rounding = false; - PWINDOW->m_sSpecialRenderData.border = false; - PWINDOW->m_sSpecialRenderData.decorate = false; + PWINDOW->m_sSpecialRenderData.decorate = WORKSPACERULE.decorate.value_or(true); + PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(*PNOGAPSWHENONLY == 2); + + const auto RESERVED = PWINDOW->getFullWindowReservedArea(); + + borderSize *= PWINDOW->m_sSpecialRenderData.border; + + PWINDOW->m_vRealPosition = PWINDOW->m_vPosition + Vector2D(borderSize, borderSize) + RESERVED.topLeft; + PWINDOW->m_vRealSize = PWINDOW->m_vSize - Vector2D(2 * borderSize, 2 * borderSize) - (RESERVED.topLeft + RESERVED.bottomRight); + + PWINDOW->updateWindowDecos(); return; } @@ -553,6 +555,9 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) { PWINDOW->m_sSpecialRenderData.border = WORKSPACERULE.border.value_or(true); PWINDOW->m_sSpecialRenderData.borderSize = WORKSPACERULE.borderSize.value_or(-1); + auto calcPos = PWINDOW->m_vPosition + Vector2D(borderSize, borderSize); + auto calcSize = PWINDOW->m_vSize - Vector2D(2 * borderSize, 2 * borderSize); + const auto OFFSETTOPLEFT = Vector2D(DISPLAYLEFT ? gapsOut : gapsIn, DISPLAYTOP ? gapsOut : gapsIn); const auto OFFSETBOTTOMRIGHT = Vector2D(DISPLAYRIGHT ? gapsOut : gapsIn, DISPLAYBOTTOM ? gapsOut : gapsIn); |