aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/layout/DwindleLayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout/DwindleLayout.cpp')
-rw-r--r--src/layout/DwindleLayout.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
index 9e168df4..5bdf8748 100644
--- a/src/layout/DwindleLayout.cpp
+++ b/src/layout/DwindleLayout.cpp
@@ -225,10 +225,13 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
g_pXWaylandManager->setWindowSize(PWINDOW, wb.size());
} else {
- PWINDOW->m_vRealSize = calcSize;
- PWINDOW->m_vRealPosition = calcPos;
+ CBox wb = {calcPos, calcSize};
+ wb.round(); // avoid rounding mess
- g_pXWaylandManager->setWindowSize(PWINDOW, calcSize);
+ PWINDOW->m_vRealSize = wb.size();
+ PWINDOW->m_vRealPosition = wb.pos();
+
+ g_pXWaylandManager->setWindowSize(PWINDOW, wb.size());
}
if (force) {
@@ -644,8 +647,10 @@ void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, eRectCorn
else
PWINDOW->m_vPseudoSize.y -= pixResize.y * 2;
- PWINDOW->m_vPseudoSize.x = std::clamp(PWINDOW->m_vPseudoSize.x, 30.0, PNODE->box.w);
- PWINDOW->m_vPseudoSize.y = std::clamp(PWINDOW->m_vPseudoSize.y, 30.0, PNODE->box.h);
+ CBox wbox = PNODE->box;
+ wbox.round();
+
+ PWINDOW->m_vPseudoSize = {std::clamp(PWINDOW->m_vPseudoSize.x, 30.0, wbox.w), std::clamp(PWINDOW->m_vPseudoSize.y, 30.0, wbox.h)};
PWINDOW->m_vLastFloatingSize = PWINDOW->m_vPseudoSize;
PNODE->recalcSizePosRecursive(**PANIMATE == 0);
@@ -990,6 +995,8 @@ std::any CHyprDwindleLayout::layoutMessage(SLayoutMessageHeader header, std::str
const auto ARGS = CVarList(message, 0, ' ');
if (ARGS[0] == "togglesplit") {
toggleSplit(header.pWindow);
+ } else if (ARGS[0] == "swapsplit") {
+ swapSplit(header.pWindow);
} else if (ARGS[0] == "preselect") {
std::string direction = ARGS[1];
@@ -1043,6 +1050,20 @@ void CHyprDwindleLayout::toggleSplit(CWindow* pWindow) {
PNODE->pParent->recalcSizePosRecursive();
}
+void CHyprDwindleLayout::swapSplit(CWindow* pWindow) {
+ const auto PNODE = getNodeFromWindow(pWindow);
+
+ if (!PNODE || !PNODE->pParent)
+ return;
+
+ if (pWindow->m_bIsFullscreen)
+ return;
+
+ std::swap(PNODE->pParent->children[0], PNODE->pParent->children[1]);
+
+ PNODE->pParent->recalcSizePosRecursive();
+}
+
void CHyprDwindleLayout::replaceWindowDataWith(CWindow* from, CWindow* to) {
const auto PNODE = getNodeFromWindow(from);