summaryrefslogtreecommitdiff
path: root/src/layout/DwindleLayout.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-28 19:16:20 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-28 19:16:20 +0200
commitb1b24cb21a36713aa7c8c0d39464504c97423139 (patch)
tree6bc8036db6c051ddfb745b73dc5105a82fb4a3f9 /src/layout/DwindleLayout.cpp
parent9ede0f1c7d54dc6b3203ca4e103a79af3203ba51 (diff)
Added changegroupactive direction
Diffstat (limited to 'src/layout/DwindleLayout.cpp')
-rw-r--r--src/layout/DwindleLayout.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
index eef98622..ef312abd 100644
--- a/src/layout/DwindleLayout.cpp
+++ b/src/layout/DwindleLayout.cpp
@@ -735,7 +735,7 @@ void CHyprDwindleLayout::toggleWindowGroup(CWindow* pWindow) {
}
}
-void CHyprDwindleLayout::switchGroupWindow(CWindow* pWindow) {
+void CHyprDwindleLayout::switchGroupWindow(CWindow* pWindow, bool forward) {
if (!g_pCompositor->windowValidMapped(pWindow))
return; // reject
@@ -747,7 +747,13 @@ void CHyprDwindleLayout::switchGroupWindow(CWindow* pWindow) {
if (!PNODE->pGroupParent)
return; // reject
- PNODE->pGroupParent->groupMemberActive++;
+ if (forward)
+ PNODE->pGroupParent->groupMemberActive++;
+ else
+ PNODE->pGroupParent->groupMemberActive--;
+
+ if (PNODE->pGroupParent->groupMemberActive < 0)
+ PNODE->pGroupParent->groupMemberActive = PNODE->pGroupParent->groupMembers.size() - 1;
if ((long unsigned int)PNODE->pGroupParent->groupMemberActive >= PNODE->pGroupParent->groupMembers.size())
PNODE->pGroupParent->groupMemberActive = 0;
@@ -847,8 +853,10 @@ void CHyprDwindleLayout::alterSplitRatioBy(CWindow* pWindow, float ratio) {
void CHyprDwindleLayout::layoutMessage(SLayoutMessageHeader header, std::string message) {
if (message == "togglegroup")
toggleWindowGroup(header.pWindow);
- else if (message == "changegroupactive")
- switchGroupWindow(header.pWindow);
+ else if (message == "changegroupactivef")
+ switchGroupWindow(header.pWindow, true);
+ else if (message == "changegroupactiveb")
+ switchGroupWindow(header.pWindow, false);
else if (message == "togglesplit")
toggleSplit(header.pWindow);
}