aboutsummaryrefslogtreecommitdiff
path: root/src/layout/monitor.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-04-04 12:10:17 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-04-10 10:49:35 +0300
commitdf9466243504a00240f7048a1f9644cb002776a8 (patch)
tree4b0bf61e03631dccf371016d8ace359036d3dca1 /src/layout/monitor.rs
parent430b155929a60644ea223012ee0c1389fc5e3755 (diff)
downloadniri-df9466243504a00240f7048a1f9644cb002776a8.tar.gz
niri-df9466243504a00240f7048a1f9644cb002776a8.tar.bz2
niri-df9466243504a00240f7048a1f9644cb002776a8.zip
layout: Take into account idle time between last gesture event and end
Fixes cases like: do a quick movement with mouse, then hold it in-place for a while (no events generated), then release the gesture (it uses all that built-up speed). This also happens with DnD scroll and makes it go further than intended.
Diffstat (limited to 'src/layout/monitor.rs')
-rw-r--r--src/layout/monitor.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs
index b0879606..c088f5bc 100644
--- a/src/layout/monitor.rs
+++ b/src/layout/monitor.rs
@@ -1035,6 +1035,10 @@ impl<W: LayoutElement> Monitor<W> {
return true;
}
+ // Take into account any idle time between the last event and now.
+ let now = self.clock.now_unadjusted();
+ gesture.tracker.push(0., now);
+
let total_height = if gesture.is_touchpad {
WORKSPACE_GESTURE_MOVEMENT
} else {