summaryrefslogtreecommitdiff
path: root/src/layout/DwindleLayout.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-09-01 19:46:35 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-09-01 19:46:38 +0200
commit56203b175752b49c46eb9303c37b80cd4c2dfcf8 (patch)
treefb63297b013dfc08521e59655240449592fba8b4 /src/layout/DwindleLayout.cpp
parentc0a7dffcdc6cb04e5dd7dacf04681f9d2b361b97 (diff)
fix no_gaps_when_only with a group
Diffstat (limited to 'src/layout/DwindleLayout.cpp')
-rw-r--r--src/layout/DwindleLayout.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
index c937f645..8caa1b88 100644
--- a/src/layout/DwindleLayout.cpp
+++ b/src/layout/DwindleLayout.cpp
@@ -90,6 +90,19 @@ void SDwindleNodeData::setGroupFocusedNode(SDwindleNodeData* pMember) {
this->pWindow->m_bHidden = pMember != this;
}
+int SDwindleNodeData::getGroupMemberCount() {
+ SDwindleNodeData* current = this->pNextGroupMember;
+
+ int no = 1;
+
+ while (current != this) {
+ current = current->pNextGroupMember;
+ no++;
+ }
+
+ return no;
+}
+
int CHyprDwindleLayout::getNodesOnWorkspace(const int& id) {
int no = 0;
for (auto& n : m_lDwindleNodesData) {
@@ -173,7 +186,9 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
auto calcPos = PWINDOW->m_vPosition + Vector2D(BORDERSIZE, BORDERSIZE);
auto calcSize = PWINDOW->m_vSize - Vector2D(2 * BORDERSIZE, 2 * BORDERSIZE);
- if (*PNOGAPSWHENONLY && PWINDOW->m_iWorkspaceID != SPECIAL_WORKSPACE_ID && getNodesOnWorkspace(PWINDOW->m_iWorkspaceID) == 1) {
+ 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(BORDERSIZE, BORDERSIZE);
PWINDOW->m_vRealSize = calcSize + Vector2D(2 * BORDERSIZE, 2 * BORDERSIZE);
@@ -871,6 +886,9 @@ void CHyprDwindleLayout::toggleWindowGroup(CWindow* pWindow) {
// focus
PNODE->setGroupFocusedNode(PNODE);
+
+ // required for no_gaps_when_only to work
+ applyNodeDataToWindow(PNODE);
}
g_pCompositor->updateAllWindowsAnimatedDecorationValues();