From df9466243504a00240f7048a1f9644cb002776a8 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Fri, 4 Apr 2025 12:10:17 +0300 Subject: 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. --- src/layout/monitor.rs | 4 ++++ src/layout/scrolling.rs | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'src') 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 Monitor { 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 ScrollingSpace { // 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 { -- cgit