From c8b23f1ea8c4198c60b08e5aebfb920b2a33a8e3 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Fri, 8 May 2026 11:18:31 +0800 Subject: t --- .../algorithm/tiled/scrolling/ScrollingAlgorithm.cpp | 16 ++++++++++++++-- .../algorithm/tiled/scrolling/ScrollingAlgorithm.hpp | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src/layout/algorithm') diff --git a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp index c6cfbada..c505be4c 100644 --- a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp +++ b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp @@ -614,6 +614,7 @@ CScrollingAlgorithm::~CScrollingAlgorithm() { void CScrollingAlgorithm::focusOnInput(SP target, eInputMode input) { static const auto PFOLLOW_FOCUS_MIN_PERC = CConfigValue("scrolling:follow_min_visible"); + static const auto PHOVERDELAY = CConfigValue("scrolling:focus_edge_ms"); if (!target || target->space() != m_parent->space()) return; @@ -635,8 +636,19 @@ void CScrollingAlgorithm::focusOnInput(SP target, eInputMode input) { std::abs(std::min(MON_BOX.y + MON_BOX.h, TARGET_POS.y + TARGET_POS.h) - (std::max(MON_BOX.y, TARGET_POS.y))); // if the amount of visible X is below minimum, reject - if (VISIBLE_LEN < (IS_HORIZ ? MON_BOX.w : MON_BOX.h) * std::clamp(*PFOLLOW_FOCUS_MIN_PERC, 0.F, 1.F)) - return; + if (VISIBLE_LEN < (IS_HORIZ ? MON_BOX.w : MON_BOX.h) * std::clamp(*PFOLLOW_FOCUS_MIN_PERC, 0.F, 1.F)) { + if (*PHOVERDELAY > 0.F) { + if (m_hoveredTarget.lock() != target) { + m_hoveredTarget = target; + m_hoverTimer.reset(); + return; + } else if (m_hoverTimer.getMillis() < *PHOVERDELAY) { + return; + } + } else { + return; + } + } } // if we moved via non-kb, and it's fully visible, ignore diff --git a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.hpp b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.hpp index a7c64aa8..b8e175d7 100644 --- a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.hpp +++ b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.hpp @@ -4,6 +4,7 @@ #include "../../../../helpers/math/Direction.hpp" #include "ScrollTapeController.hpp" #include "../../../../helpers/signal/Signal.hpp" +#include "../../../../helpers/time/Timer.hpp" #include #include @@ -176,6 +177,9 @@ namespace Layout::Tiled { std::vector m_fullscreenTargets; bool m_lastFullscreenCover = false; + CTimer m_hoverTimer; + WP m_hoveredTarget; + friend struct SScrollingData; }; }; -- cgit v1.2.3