From 23001f6144bd4abb0a5b35558fd55f9cc0df2a6d Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 3 Apr 2023 23:15:33 +0100 Subject: [PATCH] input: don't overset resize icons on drag --- src/managers/input/InputManager.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index ad1093cda..947d8704d 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -1462,14 +1462,19 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) { return; } - static auto* const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue; - static const auto* PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue; + static auto* const PROUNDING = &g_pConfigManager->getConfigValuePtr("decoration:rounding")->intValue; + static const auto* PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue; + static const auto* PEXTENDBORDERGRAB = &g_pConfigManager->getConfigValuePtr("general:extend_border_grab_area")->intValue; // give a small leeway (10 px) for corner icon - const auto CORNER = *PROUNDING + *PBORDERSIZE + 10; - const auto mouseCoords = getMouseCoordsInternal(); - wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; - eBorderIconDirection direction = BORDERICON_NONE; - if (wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y)) { + const auto CORNER = *PROUNDING + *PBORDERSIZE + 10; + const auto mouseCoords = getMouseCoordsInternal(); + wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; + eBorderIconDirection direction = BORDERICON_NONE; + wlr_box boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB, box.y - *PEXTENDBORDERGRAB, box.width + 2 * *PEXTENDBORDERGRAB, box.height + 2 * *PEXTENDBORDERGRAB}; + + if (!wlr_box_contains_point(&boxFullGrabInput, mouseCoords.x, mouseCoords.y)) { + direction = BORDERICON_NONE; + } else if (wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y)) { if (!w->isInCurvedCorner(mouseCoords.x, mouseCoords.y)) { direction = BORDERICON_NONE; } else {