summaryrefslogtreecommitdiff
path: root/src/layout/DwindleLayout.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-08 15:36:17 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-05-08 15:36:17 +0200
commit434184aa323cb9eb253d39a724381747c82fb68d (patch)
treeb7aebd632449efa5023c9ad0c42235d38650bdeb /src/layout/DwindleLayout.cpp
parent39dcfa61c3530c2049b9e88afff6b31f5b2bb7fd (diff)
Added dwindle:force_split
Diffstat (limited to 'src/layout/DwindleLayout.cpp')
-rw-r--r--src/layout/DwindleLayout.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
index cad67422..f1d327f0 100644
--- a/src/layout/DwindleLayout.cpp
+++ b/src/layout/DwindleLayout.cpp
@@ -214,19 +214,30 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
// if cursor over first child, make it first, etc
const auto SIDEBYSIDE = NEWPARENT->size.x / NEWPARENT->size.y > 1.f;
const auto MOUSECOORDS = g_pInputManager->getMouseCoordsInternal();
- if ((SIDEBYSIDE && VECINRECT(MOUSECOORDS, NEWPARENT->position.x, NEWPARENT->position.y, NEWPARENT->position.x + NEWPARENT->size.x / 2.f, NEWPARENT->position.y + NEWPARENT->size.y))
- || (!SIDEBYSIDE && VECINRECT(MOUSECOORDS, NEWPARENT->position.x, NEWPARENT->position.y, NEWPARENT->position.x + NEWPARENT->size.x, NEWPARENT->position.y + NEWPARENT->size.y / 2.f))) {
- // we are hovering over the first node, make PNODE first.
- NEWPARENT->children[1] = OPENINGON;
- NEWPARENT->children[0] = PNODE;
+ const auto FORCESPLIT = g_pConfigManager->getInt("dwindle:force_split");
+
+ if (FORCESPLIT == 0) {
+ if ((SIDEBYSIDE && VECINRECT(MOUSECOORDS, NEWPARENT->position.x, NEWPARENT->position.y, NEWPARENT->position.x + NEWPARENT->size.x / 2.f, NEWPARENT->position.y + NEWPARENT->size.y))
+ || (!SIDEBYSIDE && VECINRECT(MOUSECOORDS, NEWPARENT->position.x, NEWPARENT->position.y, NEWPARENT->position.x + NEWPARENT->size.x, NEWPARENT->position.y + NEWPARENT->size.y / 2.f))) {
+ // we are hovering over the first node, make PNODE first.
+ NEWPARENT->children[1] = OPENINGON;
+ NEWPARENT->children[0] = PNODE;
+ } else {
+ // we are hovering over the second node, make PNODE second.
+ NEWPARENT->children[0] = OPENINGON;
+ NEWPARENT->children[1] = PNODE;
+ }
} else {
- // we are hovering over the second node, make PNODE second.
- NEWPARENT->children[0] = OPENINGON;
- NEWPARENT->children[1] = PNODE;
+ if (FORCESPLIT == 1) {
+ NEWPARENT->children[1] = OPENINGON;
+ NEWPARENT->children[0] = PNODE;
+ } else {
+ NEWPARENT->children[0] = OPENINGON;
+ NEWPARENT->children[1] = PNODE;
+ }
}
-
// and update the previous parent if it exists
if (OPENINGON->pParent) {
if (OPENINGON->pParent->children[0] == OPENINGON) {