2023-11-11 15:37:17 +01:00
|
|
|
#include "DecorationPositioner.hpp"
|
|
|
|
#include "../../Compositor.hpp"
|
|
|
|
|
|
|
|
CDecorationPositioner::CDecorationPositioner() {
|
|
|
|
g_pHookSystem->hookDynamic("closeWindow", [this](void* call, SCallbackInfo& info, std::any data) {
|
|
|
|
auto* const PWINDOW = std::any_cast<CWindow*>(data);
|
|
|
|
this->onWindowUnmap(PWINDOW);
|
|
|
|
});
|
2023-11-11 19:07:56 +01:00
|
|
|
|
|
|
|
g_pHookSystem->hookDynamic("openWindow", [this](void* call, SCallbackInfo& info, std::any data) {
|
|
|
|
auto* const PWINDOW = std::any_cast<CWindow*>(data);
|
|
|
|
this->onWindowMap(PWINDOW);
|
|
|
|
});
|
2023-11-11 15:37:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Vector2D CDecorationPositioner::getEdgeDefinedPoint(uint32_t edges, CWindow* pWindow) {
|
|
|
|
const bool TOP = edges & DECORATION_EDGE_TOP;
|
|
|
|
const bool BOTTOM = edges & DECORATION_EDGE_BOTTOM;
|
|
|
|
const bool LEFT = edges & DECORATION_EDGE_LEFT;
|
|
|
|
const bool RIGHT = edges & DECORATION_EDGE_RIGHT;
|
|
|
|
|
|
|
|
const int EDGESNO = TOP + BOTTOM + LEFT + RIGHT;
|
|
|
|
|
2023-12-10 17:28:12 +01:00
|
|
|
if (EDGESNO == 0 || EDGESNO == 3 || EDGESNO > 4) {
|
2023-11-11 15:37:17 +01:00
|
|
|
Debug::log(ERR, "getEdgeDefinedPoint: invalid number of edges");
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
2023-12-10 17:28:12 +01:00
|
|
|
CBox wb = pWindow->getWindowMainSurfaceBox();
|
|
|
|
|
|
|
|
if (EDGESNO == 4)
|
|
|
|
return wb.pos();
|
2023-11-11 15:37:17 +01:00
|
|
|
|
|
|
|
if (EDGESNO == 1) {
|
|
|
|
if (TOP)
|
|
|
|
return wb.pos() + Vector2D{wb.size().x / 2.0, 0};
|
|
|
|
else if (BOTTOM)
|
|
|
|
return wb.pos() + Vector2D{wb.size().x / 2.0, wb.size().y};
|
|
|
|
else if (LEFT)
|
|
|
|
return wb.pos() + Vector2D{0, wb.size().y / 2.0};
|
|
|
|
else if (RIGHT)
|
|
|
|
return wb.pos() + Vector2D{wb.size().x, wb.size().y / 2.0};
|
|
|
|
UNREACHABLE();
|
|
|
|
} else {
|
|
|
|
if (TOP && LEFT)
|
|
|
|
return wb.pos();
|
|
|
|
if (TOP && RIGHT)
|
|
|
|
return wb.pos() + Vector2D{wb.size().x, 0};
|
|
|
|
if (BOTTOM && RIGHT)
|
|
|
|
return wb.pos() + wb.size();
|
|
|
|
if (BOTTOM && LEFT)
|
|
|
|
return wb.pos() + Vector2D{0, wb.size().y};
|
|
|
|
UNREACHABLE();
|
|
|
|
}
|
|
|
|
UNREACHABLE();
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDecorationPositioner::uncacheDecoration(IHyprWindowDecoration* deco) {
|
|
|
|
std::erase_if(m_vWindowPositioningDatas, [&](const auto& data) { return data->pDecoration == deco; });
|
2023-11-11 19:07:56 +01:00
|
|
|
|
|
|
|
const auto WIT = std::find_if(m_mWindowDatas.begin(), m_mWindowDatas.end(), [&](const auto& other) { return other.first == deco->m_pWindow; });
|
|
|
|
if (WIT == m_mWindowDatas.end())
|
|
|
|
return;
|
|
|
|
|
|
|
|
WIT->second.needsRecalc = true;
|
2023-11-11 15:37:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CDecorationPositioner::repositionDeco(IHyprWindowDecoration* deco) {
|
|
|
|
uncacheDecoration(deco);
|
|
|
|
onWindowUpdate(deco->m_pWindow);
|
|
|
|
}
|
|
|
|
|
|
|
|
CDecorationPositioner::SWindowPositioningData* CDecorationPositioner::getDataFor(IHyprWindowDecoration* pDecoration, CWindow* pWindow) {
|
|
|
|
auto it = std::find_if(m_vWindowPositioningDatas.begin(), m_vWindowPositioningDatas.end(), [&](const auto& el) { return el->pDecoration == pDecoration; });
|
|
|
|
|
|
|
|
if (it != m_vWindowPositioningDatas.end())
|
|
|
|
return it->get();
|
|
|
|
|
|
|
|
const auto DATA = m_vWindowPositioningDatas.emplace_back(std::make_unique<CDecorationPositioner::SWindowPositioningData>(pWindow, pDecoration)).get();
|
|
|
|
|
|
|
|
DATA->positioningInfo = pDecoration->getPositioningInfo();
|
|
|
|
|
|
|
|
return DATA;
|
|
|
|
}
|
|
|
|
|
2023-11-11 19:07:56 +01:00
|
|
|
void CDecorationPositioner::sanitizeDatas() {
|
2023-11-12 18:02:31 +01:00
|
|
|
std::erase_if(m_mWindowDatas, [](const auto& other) { return !g_pCompositor->windowExists(other.first); });
|
2023-11-11 19:07:56 +01:00
|
|
|
std::erase_if(m_vWindowPositioningDatas, [](const auto& other) {
|
2023-11-12 18:02:31 +01:00
|
|
|
if (!g_pCompositor->windowExists(other->pWindow))
|
2023-11-11 19:07:56 +01:00
|
|
|
return true;
|
|
|
|
if (std::find_if(other->pWindow->m_dWindowDecorations.begin(), other->pWindow->m_dWindowDecorations.end(),
|
|
|
|
[&](const auto& el) { return el.get() == other->pDecoration; }) == other->pWindow->m_dWindowDecorations.end())
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-11-13 17:42:45 +01:00
|
|
|
void CDecorationPositioner::forceRecalcFor(CWindow* pWindow) {
|
|
|
|
const auto WIT = std::find_if(m_mWindowDatas.begin(), m_mWindowDatas.end(), [&](const auto& other) { return other.first == pWindow; });
|
|
|
|
if (WIT == m_mWindowDatas.end())
|
|
|
|
return;
|
|
|
|
|
|
|
|
const auto WINDOWDATA = &WIT->second;
|
|
|
|
|
|
|
|
WINDOWDATA->needsRecalc = true;
|
|
|
|
}
|
|
|
|
|
2023-11-11 15:37:17 +01:00
|
|
|
void CDecorationPositioner::onWindowUpdate(CWindow* pWindow) {
|
2023-11-12 18:02:31 +01:00
|
|
|
if (!g_pCompositor->windowExists(pWindow) || !pWindow->m_bIsMapped)
|
2023-11-11 15:37:17 +01:00
|
|
|
return;
|
|
|
|
|
2023-11-11 19:07:56 +01:00
|
|
|
const auto WIT = std::find_if(m_mWindowDatas.begin(), m_mWindowDatas.end(), [&](const auto& other) { return other.first == pWindow; });
|
|
|
|
if (WIT == m_mWindowDatas.end())
|
|
|
|
return;
|
|
|
|
|
|
|
|
const auto WINDOWDATA = &WIT->second;
|
|
|
|
|
|
|
|
sanitizeDatas();
|
2023-11-11 15:37:17 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
std::vector<CDecorationPositioner::SWindowPositioningData*> datas;
|
|
|
|
for (auto& wd : pWindow->m_dWindowDecorations) {
|
|
|
|
datas.push_back(getDataFor(wd.get(), pWindow));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (WINDOWDATA->lastWindowSize == pWindow->m_vRealSize.vec() /* position not changed */
|
|
|
|
&&
|
|
|
|
std::all_of(m_vWindowPositioningDatas.begin(), m_vWindowPositioningDatas.end(), [pWindow](const auto& data) { return pWindow != data->pWindow || !data->needsReposition; })
|
|
|
|
/* all window datas are either not for this window or don't need a reposition */
|
2023-11-11 15:52:27 +01:00
|
|
|
&& !WINDOWDATA->needsRecalc /* window doesn't need recalc */
|
2023-11-11 15:37:17 +01:00
|
|
|
)
|
|
|
|
return;
|
|
|
|
|
|
|
|
WINDOWDATA->lastWindowSize = pWindow->m_vRealSize.vec();
|
2023-11-11 15:52:27 +01:00
|
|
|
WINDOWDATA->needsRecalc = false;
|
2023-11-11 15:37:17 +01:00
|
|
|
const bool EPHEMERAL = pWindow->m_vRealSize.isBeingAnimated();
|
|
|
|
|
|
|
|
std::sort(datas.begin(), datas.end(), [](const auto& a, const auto& b) { return a->positioningInfo.priority > b->positioningInfo.priority; });
|
|
|
|
|
2023-12-10 17:28:12 +01:00
|
|
|
CBox wb = pWindow->getWindowMainSurfaceBox();
|
2023-11-11 15:37:17 +01:00
|
|
|
|
|
|
|
// calc reserved
|
|
|
|
float reservedXL = 0, reservedYT = 0, reservedXR = 0, reservedYB = 0;
|
|
|
|
for (size_t i = 0; i < datas.size(); ++i) {
|
|
|
|
auto* const wd = datas[i];
|
|
|
|
|
|
|
|
if (!wd->positioningInfo.reserved)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
const bool TOP = wd->positioningInfo.edges & DECORATION_EDGE_TOP;
|
|
|
|
const bool BOTTOM = wd->positioningInfo.edges & DECORATION_EDGE_BOTTOM;
|
|
|
|
const bool LEFT = wd->positioningInfo.edges & DECORATION_EDGE_LEFT;
|
|
|
|
const bool RIGHT = wd->positioningInfo.edges & DECORATION_EDGE_RIGHT;
|
|
|
|
|
|
|
|
if (LEFT)
|
|
|
|
reservedXL += wd->positioningInfo.desiredExtents.topLeft.x;
|
|
|
|
if (RIGHT)
|
|
|
|
reservedXR += wd->positioningInfo.desiredExtents.bottomRight.x;
|
|
|
|
if (TOP)
|
|
|
|
reservedYT += wd->positioningInfo.desiredExtents.topLeft.y;
|
|
|
|
if (BOTTOM)
|
|
|
|
reservedYB += wd->positioningInfo.desiredExtents.bottomRight.y;
|
|
|
|
}
|
|
|
|
|
|
|
|
WINDOWDATA->reserved = {{reservedXL, reservedYT}, {reservedXR, reservedYB}};
|
|
|
|
|
|
|
|
float stickyOffsetXL = 0, stickyOffsetYT = 0, stickyOffsetXR = 0, stickyOffsetYB = 0;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < datas.size(); ++i) {
|
|
|
|
auto* const wd = datas[i];
|
|
|
|
|
|
|
|
wd->needsReposition = false;
|
|
|
|
|
|
|
|
const bool TOP = wd->positioningInfo.edges & DECORATION_EDGE_TOP;
|
|
|
|
const bool BOTTOM = wd->positioningInfo.edges & DECORATION_EDGE_BOTTOM;
|
|
|
|
const bool LEFT = wd->positioningInfo.edges & DECORATION_EDGE_LEFT;
|
|
|
|
const bool RIGHT = wd->positioningInfo.edges & DECORATION_EDGE_RIGHT;
|
|
|
|
const int EDGESNO = TOP + BOTTOM + LEFT + RIGHT;
|
2023-11-12 14:01:23 +01:00
|
|
|
const bool SOLID = !(wd->pDecoration->getDecorationFlags() & DECORATION_NON_SOLID);
|
2023-11-11 15:37:17 +01:00
|
|
|
|
|
|
|
if (wd->positioningInfo.policy == DECORATION_POSITION_ABSOLUTE) {
|
2023-11-12 14:01:23 +01:00
|
|
|
|
|
|
|
if (SOLID) {
|
|
|
|
if (LEFT)
|
|
|
|
stickyOffsetXL += wd->positioningInfo.desiredExtents.topLeft.x;
|
|
|
|
if (RIGHT)
|
|
|
|
stickyOffsetXR += wd->positioningInfo.desiredExtents.bottomRight.x;
|
|
|
|
if (TOP)
|
|
|
|
stickyOffsetYT += wd->positioningInfo.desiredExtents.topLeft.y;
|
|
|
|
if (BOTTOM)
|
|
|
|
stickyOffsetYB += wd->positioningInfo.desiredExtents.bottomRight.y;
|
|
|
|
}
|
2023-11-11 15:37:17 +01:00
|
|
|
|
|
|
|
wd->lastReply = {};
|
|
|
|
wd->pDecoration->onPositioningReply({});
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wd->positioningInfo.policy == DECORATION_POSITION_STICKY) {
|
2023-12-10 17:28:12 +01:00
|
|
|
if (EDGESNO != 1 && EDGESNO != 4) {
|
2023-11-11 15:37:17 +01:00
|
|
|
wd->lastReply = {};
|
|
|
|
wd->pDecoration->onPositioningReply({});
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto desiredSize = 0;
|
|
|
|
if (LEFT)
|
|
|
|
desiredSize = wd->positioningInfo.desiredExtents.topLeft.x;
|
|
|
|
else if (RIGHT)
|
|
|
|
desiredSize = wd->positioningInfo.desiredExtents.bottomRight.x;
|
|
|
|
else if (TOP)
|
|
|
|
desiredSize = wd->positioningInfo.desiredExtents.topLeft.y;
|
|
|
|
else
|
|
|
|
desiredSize = wd->positioningInfo.desiredExtents.bottomRight.y;
|
|
|
|
|
|
|
|
const auto EDGEPOINT = getEdgeDefinedPoint(wd->positioningInfo.edges, pWindow);
|
|
|
|
|
|
|
|
Vector2D pos, size;
|
|
|
|
|
2023-12-10 17:28:12 +01:00
|
|
|
if (EDGESNO == 4) {
|
|
|
|
pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL + desiredSize, stickyOffsetYT + desiredSize};
|
|
|
|
size = wb.size() + Vector2D{stickyOffsetXL + stickyOffsetXR + desiredSize * 2, stickyOffsetYB + stickyOffsetYT + desiredSize * 2};
|
|
|
|
|
|
|
|
stickyOffsetXL += desiredSize;
|
|
|
|
stickyOffsetXR += desiredSize;
|
|
|
|
stickyOffsetYT += desiredSize;
|
|
|
|
stickyOffsetYB += desiredSize;
|
|
|
|
} else if (LEFT) {
|
2023-12-11 17:46:20 +01:00
|
|
|
pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL, -stickyOffsetYT};
|
2023-11-11 15:37:17 +01:00
|
|
|
pos.x -= desiredSize;
|
2023-12-11 17:46:20 +01:00
|
|
|
size = {desiredSize, wb.size().y + stickyOffsetYB + stickyOffsetYT};
|
2023-11-11 15:37:17 +01:00
|
|
|
|
2023-11-12 14:01:23 +01:00
|
|
|
if (SOLID)
|
|
|
|
stickyOffsetXL += desiredSize;
|
2023-11-11 15:37:17 +01:00
|
|
|
} else if (RIGHT) {
|
2023-12-11 17:46:20 +01:00
|
|
|
pos = wb.pos() + Vector2D{wb.size().x, 0} - EDGEPOINT + Vector2D{stickyOffsetXR, -stickyOffsetYT};
|
|
|
|
size = {desiredSize, wb.size().y + stickyOffsetYB + stickyOffsetYT};
|
2023-11-11 15:37:17 +01:00
|
|
|
|
2023-11-12 14:01:23 +01:00
|
|
|
if (SOLID)
|
|
|
|
stickyOffsetXR += desiredSize;
|
2023-11-11 15:37:17 +01:00
|
|
|
} else if (TOP) {
|
2023-12-11 17:46:20 +01:00
|
|
|
pos = wb.pos() - EDGEPOINT - Vector2D{stickyOffsetXL, stickyOffsetYT};
|
2023-11-11 15:37:17 +01:00
|
|
|
pos.y -= desiredSize;
|
2023-12-11 17:46:20 +01:00
|
|
|
size = {wb.size().x + stickyOffsetXL + stickyOffsetXR, desiredSize};
|
2023-11-11 15:37:17 +01:00
|
|
|
|
2023-11-12 14:01:23 +01:00
|
|
|
if (SOLID)
|
|
|
|
stickyOffsetYT += desiredSize;
|
2023-11-11 15:37:17 +01:00
|
|
|
} else {
|
2023-12-11 17:46:20 +01:00
|
|
|
pos = wb.pos() + Vector2D{0, wb.size().y} - EDGEPOINT - Vector2D{stickyOffsetXL, stickyOffsetYB};
|
|
|
|
size = {wb.size().x + stickyOffsetXL + stickyOffsetXR, desiredSize};
|
2023-11-11 15:37:17 +01:00
|
|
|
|
2023-11-12 14:01:23 +01:00
|
|
|
if (SOLID)
|
|
|
|
stickyOffsetYB += desiredSize;
|
2023-11-11 15:37:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
wd->lastReply = {{pos, size}, EPHEMERAL};
|
|
|
|
wd->pDecoration->onPositioningReply(wd->lastReply);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
// invalid
|
|
|
|
wd->lastReply = {};
|
|
|
|
wd->pDecoration->onPositioningReply({});
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WINDOWDATA->extents = {{stickyOffsetXL + reservedXL, stickyOffsetYT + reservedYT}, {stickyOffsetXR + reservedXR, stickyOffsetYB + reservedYB}};
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDecorationPositioner::onWindowUnmap(CWindow* pWindow) {
|
|
|
|
std::erase_if(m_vWindowPositioningDatas, [&](const auto& data) { return data->pWindow == pWindow; });
|
|
|
|
m_mWindowDatas.erase(pWindow);
|
|
|
|
}
|
|
|
|
|
2023-11-11 19:07:56 +01:00
|
|
|
void CDecorationPositioner::onWindowMap(CWindow* pWindow) {
|
|
|
|
m_mWindowDatas[pWindow] = {};
|
|
|
|
}
|
|
|
|
|
2023-11-11 15:37:17 +01:00
|
|
|
SWindowDecorationExtents CDecorationPositioner::getWindowDecorationReserved(CWindow* pWindow) {
|
2023-11-11 19:07:56 +01:00
|
|
|
try {
|
|
|
|
const auto E = m_mWindowDatas.at(pWindow);
|
|
|
|
return E.reserved;
|
|
|
|
} catch (std::out_of_range& e) { return {}; }
|
2023-11-11 15:37:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
SWindowDecorationExtents CDecorationPositioner::getWindowDecorationExtents(CWindow* pWindow, bool inputOnly) {
|
2023-12-10 17:28:12 +01:00
|
|
|
CBox accum = pWindow->getWindowMainSurfaceBox();
|
2023-11-11 16:18:04 +01:00
|
|
|
|
|
|
|
for (auto& data : m_vWindowPositioningDatas) {
|
|
|
|
if (data->pWindow != pWindow)
|
|
|
|
continue;
|
|
|
|
|
2023-11-11 19:07:56 +01:00
|
|
|
if (!data->pWindow || !data->pDecoration)
|
|
|
|
continue;
|
|
|
|
|
2023-11-11 16:18:04 +01:00
|
|
|
if (!(data->pDecoration->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT) && inputOnly)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
CBox decoBox;
|
|
|
|
|
|
|
|
if (data->positioningInfo.policy == DECORATION_POSITION_ABSOLUTE) {
|
|
|
|
decoBox = data->pWindow->getWindowMainSurfaceBox();
|
|
|
|
decoBox.addExtents(data->positioningInfo.desiredExtents);
|
|
|
|
} else {
|
|
|
|
decoBox = data->lastReply.assignedGeometry;
|
|
|
|
const auto EDGEPOINT = getEdgeDefinedPoint(data->positioningInfo.edges, pWindow);
|
|
|
|
decoBox.translate(EDGEPOINT);
|
|
|
|
}
|
|
|
|
|
|
|
|
SWindowDecorationExtents extentsToAdd;
|
|
|
|
|
|
|
|
if (decoBox.x < accum.x)
|
|
|
|
extentsToAdd.topLeft.x = accum.x - decoBox.x;
|
|
|
|
if (decoBox.y < accum.y)
|
|
|
|
extentsToAdd.topLeft.y = accum.y - decoBox.y;
|
|
|
|
if (decoBox.x + decoBox.w > accum.x + accum.w)
|
|
|
|
extentsToAdd.bottomRight.x = (decoBox.x + decoBox.w) - (accum.x + accum.w);
|
|
|
|
if (decoBox.y + decoBox.h > accum.y + accum.h)
|
|
|
|
extentsToAdd.bottomRight.y = (decoBox.y + decoBox.h) - (accum.y + accum.h);
|
|
|
|
|
|
|
|
accum.addExtents(extentsToAdd);
|
|
|
|
}
|
2023-11-11 15:37:17 +01:00
|
|
|
|
2023-11-11 16:18:04 +01:00
|
|
|
return accum.extentsFrom(pWindow->getWindowMainSurfaceBox());
|
2023-11-11 15:37:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
CBox CDecorationPositioner::getBoxWithIncludedDecos(CWindow* pWindow) {
|
2023-12-10 17:28:12 +01:00
|
|
|
CBox accum = pWindow->getWindowMainSurfaceBox();
|
2023-11-11 15:37:17 +01:00
|
|
|
|
|
|
|
for (auto& data : m_vWindowPositioningDatas) {
|
|
|
|
if (data->pWindow != pWindow)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!(data->pDecoration->getDecorationFlags() & DECORATION_PART_OF_MAIN_WINDOW))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
CBox decoBox;
|
|
|
|
|
|
|
|
if (data->positioningInfo.policy == DECORATION_POSITION_ABSOLUTE) {
|
|
|
|
decoBox = data->pWindow->getWindowMainSurfaceBox();
|
|
|
|
decoBox.addExtents(data->positioningInfo.desiredExtents);
|
|
|
|
} else {
|
|
|
|
decoBox = data->lastReply.assignedGeometry;
|
|
|
|
const auto EDGEPOINT = getEdgeDefinedPoint(data->positioningInfo.edges, pWindow);
|
|
|
|
decoBox.translate(EDGEPOINT);
|
|
|
|
}
|
|
|
|
|
|
|
|
SWindowDecorationExtents extentsToAdd;
|
|
|
|
|
|
|
|
if (decoBox.x < accum.x)
|
|
|
|
extentsToAdd.topLeft.x = accum.x - decoBox.x;
|
|
|
|
if (decoBox.y < accum.y)
|
|
|
|
extentsToAdd.topLeft.y = accum.y - decoBox.y;
|
|
|
|
if (decoBox.x + decoBox.w > accum.x + accum.w)
|
2023-12-10 17:28:12 +01:00
|
|
|
extentsToAdd.bottomRight.x = (decoBox.x + decoBox.w) - (accum.x + accum.w);
|
2023-11-11 15:37:17 +01:00
|
|
|
if (decoBox.y + decoBox.h > accum.y + accum.h)
|
2023-12-10 17:28:12 +01:00
|
|
|
extentsToAdd.bottomRight.y = (decoBox.y + decoBox.h) - (accum.y + accum.h);
|
2023-11-11 15:37:17 +01:00
|
|
|
|
|
|
|
accum.addExtents(extentsToAdd);
|
|
|
|
}
|
|
|
|
|
|
|
|
return accum;
|
|
|
|
}
|
|
|
|
|
|
|
|
CBox CDecorationPositioner::getWindowDecorationBox(IHyprWindowDecoration* deco) {
|
|
|
|
const auto DATA = getDataFor(deco, deco->m_pWindow);
|
|
|
|
|
|
|
|
CBox box = DATA->lastReply.assignedGeometry;
|
|
|
|
box.translate(getEdgeDefinedPoint(DATA->positioningInfo.edges, deco->m_pWindow));
|
|
|
|
return box;
|
2023-12-30 15:18:53 +01:00
|
|
|
}
|