diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/layout/mod.rs | 36 | ||||
| -rw-r--r-- | src/layout/monitor.rs | 13 |
2 files changed, 6 insertions, 43 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 6407c7a1..ac46d5b8 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -1011,7 +1011,7 @@ impl<W: LayoutElement> Layout<W> { Some(WorkspaceSwitch::Gesture(gesture)) if gesture.current_idx.floor() == workspace_idx as f64 || gesture.current_idx.ceil() == workspace_idx as f64 => {} - _ => mon.switch_workspace(workspace_idx, true), + _ => mon.switch_workspace(workspace_idx), } break; @@ -1532,7 +1532,7 @@ impl<W: LayoutElement> Layout<W> { let Some(monitor) = self.active_monitor() else { return; }; - monitor.switch_workspace(idx, false); + monitor.switch_workspace(idx); } pub fn switch_workspace_auto_back_and_forth(&mut self, idx: usize) { @@ -3777,38 +3777,6 @@ mod tests { } #[test] - fn focus_workspace_by_idx_does_not_leave_empty_workspaces() { - let ops = [ - Op::AddOutput(1), - Op::AddWindow { - id: 0, - bbox: Rectangle::from_loc_and_size((0, 0), (100, 200)), - min_max_size: Default::default(), - }, - Op::FocusWorkspaceDown, - Op::AddWindow { - id: 1, - bbox: Rectangle::from_loc_and_size((0, 0), (100, 200)), - min_max_size: Default::default(), - }, - Op::FocusWorkspaceUp, - Op::CloseWindow(0), - Op::FocusWorkspace(3), - ]; - - let mut layout = Layout::default(); - for op in ops { - op.apply(&mut layout); - } - - let MonitorSet::Normal { monitors, .. } = layout.monitor_set else { - unreachable!() - }; - - assert!(monitors[0].workspaces[0].has_windows()); - } - - #[test] fn empty_workspaces_dont_move_back_to_original_output() { let ops = [ Op::AddOutput(1), diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs index df63a189..6635de9b 100644 --- a/src/layout/monitor.rs +++ b/src/layout/monitor.rs @@ -594,13 +594,8 @@ impl<W: LayoutElement> Monitor<W> { self.workspaces.iter().position(|w| w.id() == id) } - pub fn switch_workspace(&mut self, idx: usize, animate: bool) { + pub fn switch_workspace(&mut self, idx: usize) { self.activate_workspace(min(idx, self.workspaces.len() - 1)); - - if !animate { - self.workspace_switch = None; - self.clean_up_workspaces(); - } } pub fn switch_workspace_auto_back_and_forth(&mut self, idx: usize) { @@ -608,16 +603,16 @@ impl<W: LayoutElement> Monitor<W> { if idx == self.active_workspace_idx { if let Some(prev_idx) = self.previous_workspace_idx() { - self.switch_workspace(prev_idx, false); + self.switch_workspace(prev_idx); } } else { - self.switch_workspace(idx, false); + self.switch_workspace(idx); } } pub fn switch_workspace_previous(&mut self) { if let Some(idx) = self.previous_workspace_idx() { - self.switch_workspace(idx, false); + self.switch_workspace(idx); } } |
