summaryrefslogtreecommitdiff
path: root/src/layout/MasterLayout.cpp
diff options
context:
space:
mode:
authorJulian Schuler <31921487+julianschuler@users.noreply.github.com>2022-12-17 23:37:44 +0100
committerGitHub <noreply@github.com>2022-12-17 22:37:44 +0000
commit2daabfa0e981d8d2e33c068c9cc84ecb3cf2daa0 (patch)
tree02b4cdf3dfae7874fdb6f5893d46531a9b8ad6f6 /src/layout/MasterLayout.cpp
parent0f3214714f237afcccb5d6a1bd3cdb5b26ddbcfb (diff)
Add 'exact' option for 'splitratio' (#1245)
* Simplify getPlusMinusKeywordResult() * Add an 'exact' option for 'splitratio'
Diffstat (limited to 'src/layout/MasterLayout.cpp')
-rw-r--r--src/layout/MasterLayout.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp
index 5f38c871..0237bca9 100644
--- a/src/layout/MasterLayout.cpp
+++ b/src/layout/MasterLayout.cpp
@@ -604,7 +604,7 @@ void CHyprMasterLayout::switchWindows(CWindow* pWindow, CWindow* pWindow2) {
prepareNewFocus(pWindow2, inheritFullscreen);
}
-void CHyprMasterLayout::alterSplitRatioBy(CWindow* pWindow, float ratio) {
+void CHyprMasterLayout::alterSplitRatio(CWindow* pWindow, float ratio, bool exact) {
// window should be valid, insallah
const auto PNODE = getNodeFromWindow(pWindow);
@@ -614,7 +614,8 @@ void CHyprMasterLayout::alterSplitRatioBy(CWindow* pWindow, float ratio) {
const auto PMASTER = getMasterNodeOnWorkspace(pWindow->m_iWorkspaceID);
- PMASTER->percMaster = std::clamp(PMASTER->percMaster + ratio, 0.05f, 0.95f);
+ float newRatio = exact ? ratio : PMASTER->percMaster + ratio;
+ PMASTER->percMaster = std::clamp(newRatio, 0.05f, 0.95f);
recalculateMonitor(pWindow->m_iMonitorID);
}