summaryrefslogtreecommitdiff
path: root/src/layout/IHyprLayout.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-11-13 00:08:04 +0000
committerGitHub <noreply@github.com>2025-11-13 00:08:04 +0000
commit64ee8f8a72d62069a6bef45ca05bef1d0d412e1f (patch)
tree19043160e410c3690abbd3200e266ce41cad6320 /src/layout/IHyprLayout.cpp
parentb77cbad50251f0506b61d834b025247dcf74dddf (diff)
layout: include reserved area in float fit (#12289)
Ref https://github.com/basecamp/omarchy/issues/3327
Diffstat (limited to 'src/layout/IHyprLayout.cpp')
-rw-r--r--src/layout/IHyprLayout.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/layout/IHyprLayout.cpp b/src/layout/IHyprLayout.cpp
index 38868424..702d6ac9 100644
--- a/src/layout/IHyprLayout.cpp
+++ b/src/layout/IHyprLayout.cpp
@@ -826,19 +826,20 @@ void IHyprLayout::fitFloatingWindowOnMonitor(PHLWINDOW w, std::optional<CBox> tb
const auto EXTENTS = w->getWindowExtentsUnified(RESERVED_EXTENTS | INPUT_EXTENTS);
CBox targetBoxMonLocal = tb.value_or(w->getWindowMainSurfaceBox()).translate(-PMONITOR->m_position).addExtents(EXTENTS);
+ const auto MONITOR_LOCAL_BOX = PMONITOR->logicalBoxMinusExtents().translate(-PMONITOR->m_position);
- if (targetBoxMonLocal.w < PMONITOR->m_size.x) {
- if (targetBoxMonLocal.x < 0)
- targetBoxMonLocal.x = 0;
- else if (targetBoxMonLocal.x + targetBoxMonLocal.w > PMONITOR->m_size.x)
- targetBoxMonLocal.x = PMONITOR->m_size.x - targetBoxMonLocal.w;
+ if (targetBoxMonLocal.w < MONITOR_LOCAL_BOX.w) {
+ if (targetBoxMonLocal.x < MONITOR_LOCAL_BOX.x)
+ targetBoxMonLocal.x = MONITOR_LOCAL_BOX.x;
+ else if (targetBoxMonLocal.x + targetBoxMonLocal.w > MONITOR_LOCAL_BOX.w)
+ targetBoxMonLocal.x = MONITOR_LOCAL_BOX.w - targetBoxMonLocal.w;
}
- if (targetBoxMonLocal.h < PMONITOR->m_size.y) {
- if (targetBoxMonLocal.y < 0)
- targetBoxMonLocal.y = 0;
- else if (targetBoxMonLocal.y + targetBoxMonLocal.h > PMONITOR->m_size.y)
- targetBoxMonLocal.y = PMONITOR->m_size.y - targetBoxMonLocal.h;
+ if (targetBoxMonLocal.h < MONITOR_LOCAL_BOX.h) {
+ if (targetBoxMonLocal.y < MONITOR_LOCAL_BOX.y)
+ targetBoxMonLocal.y = MONITOR_LOCAL_BOX.y;
+ else if (targetBoxMonLocal.y + targetBoxMonLocal.h > MONITOR_LOCAL_BOX.h)
+ targetBoxMonLocal.y = MONITOR_LOCAL_BOX.h - targetBoxMonLocal.h;
}
*w->m_realPosition = (targetBoxMonLocal.pos() + PMONITOR->m_position + EXTENTS.topLeft).round();