mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-24 16:50:06 +01:00
layout: include reserved area in float fit (#12289)
Ref https://github.com/basecamp/omarchy/issues/3327
This commit is contained in:
parent
b77cbad502
commit
64ee8f8a72
4 changed files with 18 additions and 11 deletions
|
|
@ -16,6 +16,7 @@ static void testFloatClamp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
OK(getFromSocket("/keyword dwindle:force_split 2"));
|
OK(getFromSocket("/keyword dwindle:force_split 2"));
|
||||||
|
OK(getFromSocket("/keyword monitor HEADLESS-2, addreserved, 0, 20, 0, 20"));
|
||||||
OK(getFromSocket("/dispatch focuswindow class:c"));
|
OK(getFromSocket("/dispatch focuswindow class:c"));
|
||||||
OK(getFromSocket("/dispatch setfloating class:c"));
|
OK(getFromSocket("/dispatch setfloating class:c"));
|
||||||
OK(getFromSocket("/dispatch resizewindowpixel exact 1200 900,class:c"));
|
OK(getFromSocket("/dispatch resizewindowpixel exact 1200 900,class:c"));
|
||||||
|
|
@ -24,7 +25,7 @@ static void testFloatClamp() {
|
||||||
|
|
||||||
{
|
{
|
||||||
auto str = getFromSocket("/clients");
|
auto str = getFromSocket("/clients");
|
||||||
EXPECT_CONTAINS(str, "at: 718,178");
|
EXPECT_CONTAINS(str, "at: 698,158");
|
||||||
EXPECT_CONTAINS(str, "size: 1200,900");
|
EXPECT_CONTAINS(str, "size: 1200,900");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1509,6 +1509,10 @@ CBox CMonitor::logicalBox() {
|
||||||
return {m_position, m_size};
|
return {m_position, m_size};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CBox CMonitor::logicalBoxMinusExtents() {
|
||||||
|
return {m_position + m_reservedTopLeft, m_size - m_reservedTopLeft - m_reservedBottomRight};
|
||||||
|
}
|
||||||
|
|
||||||
void CMonitor::scheduleDone() {
|
void CMonitor::scheduleDone() {
|
||||||
if (m_doneScheduled)
|
if (m_doneScheduled)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -298,6 +298,7 @@ class CMonitor {
|
||||||
WORKSPACEID activeWorkspaceID();
|
WORKSPACEID activeWorkspaceID();
|
||||||
WORKSPACEID activeSpecialWorkspaceID();
|
WORKSPACEID activeSpecialWorkspaceID();
|
||||||
CBox logicalBox();
|
CBox logicalBox();
|
||||||
|
CBox logicalBoxMinusExtents();
|
||||||
void scheduleDone();
|
void scheduleDone();
|
||||||
uint32_t isSolitaryBlocked(bool full = false);
|
uint32_t isSolitaryBlocked(bool full = false);
|
||||||
void recheckSolitary();
|
void recheckSolitary();
|
||||||
|
|
|
||||||
|
|
@ -826,19 +826,20 @@ void IHyprLayout::fitFloatingWindowOnMonitor(PHLWINDOW w, std::optional<CBox> tb
|
||||||
|
|
||||||
const auto EXTENTS = w->getWindowExtentsUnified(RESERVED_EXTENTS | INPUT_EXTENTS);
|
const auto EXTENTS = w->getWindowExtentsUnified(RESERVED_EXTENTS | INPUT_EXTENTS);
|
||||||
CBox targetBoxMonLocal = tb.value_or(w->getWindowMainSurfaceBox()).translate(-PMONITOR->m_position).addExtents(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.w < MONITOR_LOCAL_BOX.w) {
|
||||||
if (targetBoxMonLocal.x < 0)
|
if (targetBoxMonLocal.x < MONITOR_LOCAL_BOX.x)
|
||||||
targetBoxMonLocal.x = 0;
|
targetBoxMonLocal.x = MONITOR_LOCAL_BOX.x;
|
||||||
else if (targetBoxMonLocal.x + targetBoxMonLocal.w > PMONITOR->m_size.x)
|
else if (targetBoxMonLocal.x + targetBoxMonLocal.w > MONITOR_LOCAL_BOX.w)
|
||||||
targetBoxMonLocal.x = PMONITOR->m_size.x - targetBoxMonLocal.w;
|
targetBoxMonLocal.x = MONITOR_LOCAL_BOX.w - targetBoxMonLocal.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetBoxMonLocal.h < PMONITOR->m_size.y) {
|
if (targetBoxMonLocal.h < MONITOR_LOCAL_BOX.h) {
|
||||||
if (targetBoxMonLocal.y < 0)
|
if (targetBoxMonLocal.y < MONITOR_LOCAL_BOX.y)
|
||||||
targetBoxMonLocal.y = 0;
|
targetBoxMonLocal.y = MONITOR_LOCAL_BOX.y;
|
||||||
else if (targetBoxMonLocal.y + targetBoxMonLocal.h > PMONITOR->m_size.y)
|
else if (targetBoxMonLocal.y + targetBoxMonLocal.h > MONITOR_LOCAL_BOX.h)
|
||||||
targetBoxMonLocal.y = PMONITOR->m_size.y - targetBoxMonLocal.h;
|
targetBoxMonLocal.y = MONITOR_LOCAL_BOX.h - targetBoxMonLocal.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
*w->m_realPosition = (targetBoxMonLocal.pos() + PMONITOR->m_position + EXTENTS.topLeft).round();
|
*w->m_realPosition = (targetBoxMonLocal.pos() + PMONITOR->m_position + EXTENTS.topLeft).round();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue