diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-04-04 12:10:17 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-04-10 10:49:35 +0300 |
| commit | df9466243504a00240f7048a1f9644cb002776a8 (patch) | |
| tree | 4b0bf61e03631dccf371016d8ace359036d3dca1 /src/layout | |
| parent | 430b155929a60644ea223012ee0c1389fc5e3755 (diff) | |
| download | niri-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')
| -rw-r--r-- | src/layout/monitor.rs | 4 | ||||
| -rw-r--r-- | src/layout/scrolling.rs | 4 |
2 files changed, 8 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 { diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs index 29cf9585..657c4162 100644 --- a/src/layout/scrolling.rs +++ b/src/layout/scrolling.rs @@ -3004,6 +3004,10 @@ impl<W: LayoutElement> ScrollingSpace<W> { // it in all the right places (adding columns, removing columns, etc.) -- quite a bit of // effort and bug potential. + // Take into account any idle time between the last event and now. + let now = self.clock.now_unadjusted(); + gesture.tracker.push(0., now); + let norm_factor = if gesture.is_touchpad { self.working_area.size.w / VIEW_GESTURE_WORKING_AREA_MOVEMENT } else { |
