From 34b0ce66b3727d5061a3cec2ac96124470b748da Mon Sep 17 00:00:00 2001 From: dranull <150595692+dranull@users.noreply.github.com> Date: Tue, 26 Dec 2023 16:24:31 +0000 Subject: dwindle: Use window->middle() when cursor is on reserved area (#4253) --- src/Compositor.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/Compositor.cpp') diff --git a/src/Compositor.cpp b/src/Compositor.cpp index a2b11727..38304f33 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1723,6 +1723,15 @@ bool CCompositor::isPointOnAnyMonitor(const Vector2D& point) { return false; } +bool CCompositor::isPointOnReservedArea(const Vector2D& point, const CMonitor* pMonitor) { + const auto PMONITOR = pMonitor ? pMonitor : getMonitorFromVector(point); + + const auto XY1 = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft; + const auto XY2 = PMONITOR->vecPosition + PMONITOR->vecSize - PMONITOR->vecReservedBottomRight; + + return !VECINRECT(point, XY1.x, XY1.y, XY2.x, XY2.y); +} + void checkFocusSurfaceIter(wlr_surface* pSurface, int x, int y, void* data) { auto pair = (std::pair*)data; pair->second = pair->second || pSurface == pair->first; @@ -2528,17 +2537,6 @@ void CCompositor::forceReportSizesToWindowsOnWorkspace(const int& wid) { } } -bool CCompositor::cursorOnReservedArea() { - const auto PMONITOR = getMonitorFromCursor(); - - const auto XY1 = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft; - const auto XY2 = PMONITOR->vecPosition + PMONITOR->vecSize - PMONITOR->vecReservedBottomRight; - - const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal(); - - return !VECINRECT(CURSORPOS, XY1.x, XY1.y, XY2.x, XY2.y); -} - CWorkspace* CCompositor::createNewWorkspace(const int& id, const int& monid, const std::string& name) { const auto NAME = name == "" ? std::to_string(id) : name; auto monID = monid; -- cgit v1.2.3