diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-05-08 18:47:01 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-05-08 18:53:18 +0800 |
| commit | 32fcd204b0dc587fa44f3335bcb0b9e8cd817e97 (patch) | |
| tree | 48d1eadfff1677ba25a19b2858ee3f78bd9ad1c3 /src/layout/algorithm/tiled | |
| parent | c8b23f1ea8c4198c60b08e5aebfb920b2a33a8e3 (diff) | |
fix
Diffstat (limited to 'src/layout/algorithm/tiled')
| -rw-r--r-- | src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp | 25 | ||||
| -rw-r--r-- | src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.hpp | 4 |
2 files changed, 25 insertions, 4 deletions
diff --git a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp index c505be4c..e4943371 100644 --- a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp +++ b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp @@ -13,6 +13,8 @@ #include "../../../../managers/input/InputManager.hpp" #include "../../../../managers/animation/DesktopAnimationManager.hpp" #include "../../../../event/EventBus.hpp" +#include "../../../../managers/eventLoop/EventLoopTimer.hpp" +#include "../../../../managers/eventLoop/EventLoopManager.hpp" #include <hyprutils/string/VarList2.hpp> #include <hyprutils/string/VarList.hpp> @@ -610,6 +612,9 @@ CScrollingAlgorithm::~CScrollingAlgorithm() { m_configCallback.reset(); m_focusCallback.reset(); + + if (m_hoverTimer) + m_hoverTimer->cancel(); } void CScrollingAlgorithm::focusOnInput(SP<ITarget> target, eInputMode input) { @@ -640,9 +645,21 @@ void CScrollingAlgorithm::focusOnInput(SP<ITarget> target, eInputMode input) { if (*PHOVERDELAY > 0.F) { if (m_hoveredTarget.lock() != target) { m_hoveredTarget = target; - m_hoverTimer.reset(); + if (m_hoverTimer) + m_hoverTimer->cancel(); + + m_hoverTimer = makeShared<CEventLoopTimer>( + std::chrono::milliseconds((int)*PHOVERDELAY), + [this, target, input](SP<CEventLoopTimer> self, void* data) { + if (m_hoveredTarget.lock() == target) { + m_hoverTimer.reset(); + focusOnInput(target, input); + } + }, + nullptr); + g_pEventLoopManager->addTimer(m_hoverTimer); return; - } else if (m_hoverTimer.getMillis() < *PHOVERDELAY) { + } else if (m_hoverTimer && !m_hoverTimer->passed() && !m_hoverTimer->cancelled()) { return; } } else { @@ -651,6 +668,10 @@ void CScrollingAlgorithm::focusOnInput(SP<ITarget> target, eInputMode input) { } } + m_hoveredTarget.reset(); + if (m_hoverTimer) + m_hoverTimer->cancel(); + // if we moved via non-kb, and it's fully visible, ignore if (m_scrollingData->visible(TARGETDATA->column.lock(), true) && input != INPUT_MODE_KB) return; diff --git a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.hpp b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.hpp index b8e175d7..1d83b325 100644 --- a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.hpp +++ b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.hpp @@ -4,7 +4,7 @@ #include "../../../../helpers/math/Direction.hpp" #include "ScrollTapeController.hpp" #include "../../../../helpers/signal/Signal.hpp" -#include "../../../../helpers/time/Timer.hpp" +#include "../../../../managers/eventLoop/EventLoopTimer.hpp" #include <optional> #include <vector> @@ -177,7 +177,7 @@ namespace Layout::Tiled { std::vector<SFullscreenScrollState> m_fullscreenTargets; bool m_lastFullscreenCover = false; - CTimer m_hoverTimer; + SP<CEventLoopTimer> m_hoverTimer; WP<ITarget> m_hoveredTarget; friend struct SScrollingData; |
