summaryrefslogtreecommitdiff
path: root/src/layout/MasterLayout.cpp
diff options
context:
space:
mode:
authorUjinT34 <41110182+UjinT34@users.noreply.github.com>2025-12-27 21:17:51 +0300
committerGitHub <noreply@github.com>2025-12-27 19:17:51 +0100
commite5f22c06b4c01784753315156247e15d0ec3db45 (patch)
treebcc828f9682efc10d26f01e621d044aa2825b11c /src/layout/MasterLayout.cpp
parent6d3b17ee832411f627d8bed6b74e09b4fa55e2fb (diff)
master: fix placement with center_ignores_reserved (#12695)
Diffstat (limited to 'src/layout/MasterLayout.cpp')
-rw-r--r--src/layout/MasterLayout.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp
index d677d7b6..8c6376ab 100644
--- a/src/layout/MasterLayout.cpp
+++ b/src/layout/MasterLayout.cpp
@@ -349,10 +349,11 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
static auto PIGNORERESERVED = CConfigValue<Hyprlang::INT>("master:center_ignores_reserved");
static auto PSMARTRESIZING = CConfigValue<Hyprlang::INT>("master:smart_resizing");
- const auto MASTERS = getMastersOnWorkspace(pWorkspace->m_id);
- const auto WINDOWS = getNodesOnWorkspace(pWorkspace->m_id);
- const auto STACKWINDOWS = WINDOWS - MASTERS;
- const auto WORKAREA = workAreaOnWorkspace(pWorkspace);
+ const auto MASTERS = getMastersOnWorkspace(pWorkspace->m_id);
+ const auto WINDOWS = getNodesOnWorkspace(pWorkspace->m_id);
+ const auto STACKWINDOWS = WINDOWS - MASTERS;
+ const auto WORKAREA = workAreaOnWorkspace(pWorkspace);
+ const auto UNRESERVED_WIDTH = WORKAREA.width + PMONITOR->m_reservedArea.left() + PMONITOR->m_reservedArea.right();
if (orientation == ORIENTATION_CENTER) {
if (STACKWINDOWS >= *SLAVECOUNTFORCENTER)
@@ -443,11 +444,12 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
nextX += WIDTH;
}
} else { // orientation left, right or center
- float WIDTH = *PIGNORERESERVED && centerMasterWindow ? PMONITOR->m_size.x : WORKAREA.w;
- float heightLeft = WORKAREA.h;
- int mastersLeft = MASTERS;
- float nextX = 0;
- float nextY = 0;
+ const float TOTAL_WIDTH = *PIGNORERESERVED && centerMasterWindow ? UNRESERVED_WIDTH : WORKAREA.w;
+ float WIDTH = TOTAL_WIDTH;
+ float heightLeft = WORKAREA.h;
+ int mastersLeft = MASTERS;
+ float nextX = 0;
+ float nextY = 0;
if (STACKWINDOWS > 0 || centerMasterWindow)
WIDTH *= PMASTERNODE->percMaster;
@@ -455,7 +457,7 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
if (orientation == ORIENTATION_RIGHT)
nextX = WORKAREA.w - WIDTH;
else if (centerMasterWindow)
- nextX = ((*PIGNORERESERVED && centerMasterWindow ? PMONITOR->m_size.x : WORKAREA.w) - WIDTH) / 2;
+ nextX += (TOTAL_WIDTH - WIDTH) / 2;
for (auto& nd : m_masterNodesData) {
if (nd.workspaceID != pWorkspace->m_id || !nd.isMaster)
@@ -471,7 +473,7 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
}
nd.size = Vector2D(WIDTH, HEIGHT);
- nd.position = (*PIGNORERESERVED && centerMasterWindow ? PMONITOR->m_position : WORKAREA.pos()) + Vector2D(nextX, nextY);
+ nd.position = (*PIGNORERESERVED && centerMasterWindow ? WORKAREA.pos() - Vector2D(PMONITOR->m_reservedArea.left(), 0.0) : WORKAREA.pos()) + Vector2D(nextX, nextY);
applyNodeDataToWindow(&nd);
mastersLeft--;
@@ -546,7 +548,7 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
nextY += HEIGHT;
}
} else { // slaves for centered master window(s)
- const float WIDTH = ((*PIGNORERESERVED ? PMONITOR->m_size.x : WORKAREA.w) - PMASTERNODE->size.x) / 2.0;
+ const float WIDTH = ((*PIGNORERESERVED ? UNRESERVED_WIDTH : WORKAREA.w) - PMASTERNODE->size.x) / 2.0;
float heightLeft = 0;
float heightLeftL = WORKAREA.h;
float heightLeftR = WORKAREA.h;