summaryrefslogtreecommitdiff
path: root/src/layout/algorithm/tiled
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2026-05-08 11:18:31 +0800
committerlittleblack111 <littleblack11111@gmail.com>2026-05-08 11:18:31 +0800
commitc8b23f1ea8c4198c60b08e5aebfb920b2a33a8e3 (patch)
treef66c6c2ca7ace6076e799b304729b5616db89347 /src/layout/algorithm/tiled
parentde9f8dc9831d921cd1ee30d5d14f45f0e345a8ca (diff)
t
Diffstat (limited to 'src/layout/algorithm/tiled')
-rw-r--r--src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp16
-rw-r--r--src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.hpp4
2 files changed, 18 insertions, 2 deletions
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<ITarget> target, eInputMode input) {
static const auto PFOLLOW_FOCUS_MIN_PERC = CConfigValue<Config::FLOAT>("scrolling:follow_min_visible");
+ static const auto PHOVERDELAY = CConfigValue<Config::FLOAT>("scrolling:focus_edge_ms");
if (!target || target->space() != m_parent->space())
return;
@@ -635,8 +636,19 @@ void CScrollingAlgorithm::focusOnInput(SP<ITarget> 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 <optional>
#include <vector>
@@ -176,6 +177,9 @@ namespace Layout::Tiled {
std::vector<SFullscreenScrollState> m_fullscreenTargets;
bool m_lastFullscreenCover = false;
+ CTimer m_hoverTimer;
+ WP<ITarget> m_hoveredTarget;
+
friend struct SScrollingData;
};
};