diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-04-24 21:24:39 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-04-25 02:00:18 -0700 |
| commit | 929eaf0d694a9f0e8aa9b436004f0d054c9e2919 (patch) | |
| tree | ba9d951fc42d70f5d5b2b9a05aa8ead4f4c5dafb /src/layout | |
| parent | ce3103949fe07bb656970da30c87accde83852fa (diff) | |
| download | niri-929eaf0d694a9f0e8aa9b436004f0d054c9e2919.tar.gz niri-929eaf0d694a9f0e8aa9b436004f0d054c9e2919.tar.bz2 niri-929eaf0d694a9f0e8aa9b436004f0d054c9e2919.zip | |
Pass target workspace to view offset grab
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/mod.rs | 11 | ||||
| -rw-r--r-- | src/layout/tests.rs | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index ceed2f60..9347fc73 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -3601,7 +3601,12 @@ impl<W: LayoutElement> Layout<W> { None } - pub fn view_offset_gesture_begin(&mut self, output: &Output, is_touchpad: bool) { + pub fn view_offset_gesture_begin( + &mut self, + output: &Output, + workspace_idx: Option<usize>, + is_touchpad: bool, + ) { let monitors = match &mut self.monitor_set { MonitorSet::Normal { monitors, .. } => monitors, MonitorSet::NoOutputs { .. } => unreachable!(), @@ -3610,7 +3615,9 @@ impl<W: LayoutElement> Layout<W> { for monitor in monitors { for (idx, ws) in monitor.workspaces.iter_mut().enumerate() { // Cancel the gesture on other workspaces. - if &monitor.output != output || idx != monitor.active_workspace_idx { + if &monitor.output != output + || idx != workspace_idx.unwrap_or(monitor.active_workspace_idx) + { ws.view_offset_gesture_end(None); continue; } diff --git a/src/layout/tests.rs b/src/layout/tests.rs index a49552a8..af8ba284 100644 --- a/src/layout/tests.rs +++ b/src/layout/tests.rs @@ -576,6 +576,8 @@ enum Op { ViewOffsetGestureBegin { #[proptest(strategy = "1..=5usize")] output_idx: usize, + #[proptest(strategy = "proptest::option::of(0..=4usize)")] + workspace_idx: Option<usize>, is_touchpad: bool, }, ViewOffsetGestureUpdate { @@ -1344,6 +1346,7 @@ impl Op { } Op::ViewOffsetGestureBegin { output_idx: id, + workspace_idx, is_touchpad: normalize, } => { let name = format!("output{id}"); @@ -1351,7 +1354,7 @@ impl Op { return; }; - layout.view_offset_gesture_begin(&output, normalize); + layout.view_offset_gesture_begin(&output, workspace_idx, normalize); } Op::ViewOffsetGestureUpdate { delta, @@ -2260,6 +2263,7 @@ fn unfullscreen_view_offset_not_reset_on_gesture() { Op::FullscreenWindow(1), Op::ViewOffsetGestureBegin { output_idx: 1, + workspace_idx: None, is_touchpad: true, }, Op::ViewOffsetGestureEnd { |
