From 5f416abcf9053cf61323921b6218d72a77e2dceb Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 2 Mar 2024 15:23:40 +0400 Subject: Change horizontal gesture to focus furthest window --- src/layout/mod.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/layout/mod.rs') diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 6ec3ca8c..2985a29e 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -1660,7 +1660,11 @@ impl Layout { } } - pub fn view_offset_gesture_update(&mut self, delta_x: f64) -> Option> { + pub fn view_offset_gesture_update( + &mut self, + delta_x: f64, + timestamp: Duration, + ) -> Option> { let monitors = match &mut self.monitor_set { MonitorSet::Normal { monitors, .. } => monitors, MonitorSet::NoOutputs { .. } => return None, @@ -1668,7 +1672,7 @@ impl Layout { for monitor in monitors { for ws in &mut monitor.workspaces { - if let Some(refresh) = ws.view_offset_gesture_update(delta_x) { + if let Some(refresh) = ws.view_offset_gesture_update(delta_x, timestamp) { if refresh { return Some(Some(monitor.output.clone())); } else { @@ -2036,6 +2040,7 @@ mod tests { ViewOffsetGestureUpdate { #[proptest(strategy = "arbitrary_view_offset_gesture_delta()")] delta: f64, + timestamp: Duration, }, ViewOffsetGestureEnd, WorkspaceSwitchGestureBegin { @@ -2293,8 +2298,8 @@ mod tests { layout.view_offset_gesture_begin(&output); } - Op::ViewOffsetGestureUpdate { delta } => { - layout.view_offset_gesture_update(delta); + Op::ViewOffsetGestureUpdate { delta, timestamp } => { + layout.view_offset_gesture_update(delta, timestamp); } Op::ViewOffsetGestureEnd => { // We don't handle cancels in this gesture. -- cgit