diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-12-05 14:16:22 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-05 14:16:22 +0000 |
| commit | 9264436f35e2c4e94adfdf2a8ea23a346ace3a65 (patch) | |
| tree | 9fe48ff4728060445e655d8a3b528999fd124ff8 /src/Compositor.cpp | |
| parent | d5c52ef58e57b371a9df8fd4404c5d55a1b26f34 (diff) | |
desktop: rewrite reserved area handling + improve tests (#12383)
Diffstat (limited to 'src/Compositor.cpp')
| -rw-r--r-- | src/Compositor.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 9c812b37..39aaee37 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1607,10 +1607,13 @@ bool CCompositor::isPointOnAnyMonitor(const Vector2D& point) { bool CCompositor::isPointOnReservedArea(const Vector2D& point, const PHLMONITOR pMonitor) { const auto PMONITOR = pMonitor ? pMonitor : getMonitorFromVector(point); - const auto XY1 = PMONITOR->m_position + PMONITOR->m_reservedTopLeft; - const auto XY2 = PMONITOR->m_position + PMONITOR->m_size - PMONITOR->m_reservedBottomRight; + auto box = PMONITOR->logicalBox(); + if (VECNOTINRECT(point, box.x - 1, box.y - 1, box.w + 2, box.h + 2)) + return false; + + PMONITOR->m_reservedArea.applyip(box); - return VECNOTINRECT(point, XY1.x, XY1.y, XY2.x, XY2.y); + return VECNOTINRECT(point, box.x, box.y, box.x, box.y); } CBox CCompositor::calculateX11WorkArea() { @@ -1620,11 +1623,7 @@ CBox CCompositor::calculateX11WorkArea() { for (const auto& monitor : m_monitors) { // we ignore monitor->m_position on purpose - auto x = monitor->m_reservedTopLeft.x; - auto y = monitor->m_reservedTopLeft.y; - auto w = monitor->m_size.x - monitor->m_reservedBottomRight.x - x; - auto h = monitor->m_size.y - monitor->m_reservedBottomRight.y - y; - CBox box = {x, y, w, h}; + CBox box = monitor->logicalBoxMinusReserved().translate(-monitor->m_position); if ((*PXWLFORCESCALEZERO)) box.scale(monitor->m_scale); |
