From 9264436f35e2c4e94adfdf2a8ea23a346ace3a65 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Fri, 5 Dec 2025 14:16:22 +0000 Subject: desktop: rewrite reserved area handling + improve tests (#12383) --- src/Compositor.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/Compositor.cpp') 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); -- cgit v1.2.3