diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-06-04 19:44:33 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-06-04 19:46:19 +0300 |
| commit | c6c17cccac979575b6402729af39f7c998e90874 (patch) | |
| tree | 257860ff0450dbef776b3f30a8ea7e5697a7dd55 /src/layout/mod.rs | |
| parent | b5ad0e12fd46f7ab06f4bbc0e80bf3f2d4395cbf (diff) | |
| download | niri-c6c17cccac979575b6402729af39f7c998e90874.tar.gz niri-c6c17cccac979575b6402729af39f7c998e90874.tar.bz2 niri-c6c17cccac979575b6402729af39f7c998e90874.zip | |
Add missing fullscreen check
Fixes crash when a window in a column requests to be unfullscreened.
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index a444601b..ac8db5d3 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -2625,6 +2625,11 @@ mod tests { }, CloseWindow(#[proptest(strategy = "1..=5usize")] usize), FullscreenWindow(#[proptest(strategy = "1..=5usize")] usize), + SetFullscreenWindow { + #[proptest(strategy = "1..=5usize")] + window: usize, + is_fullscreen: bool, + }, FocusColumnLeft, FocusColumnRight, FocusColumnFirst, @@ -2913,6 +2918,12 @@ mod tests { Op::FullscreenWindow(id) => { layout.toggle_fullscreen(&id); } + Op::SetFullscreenWindow { + window, + is_fullscreen, + } => { + layout.set_fullscreen(&window, is_fullscreen); + } Op::FocusColumnLeft => layout.focus_left(), Op::FocusColumnRight => layout.focus_right(), Op::FocusColumnFirst => layout.focus_column_first(), @@ -3288,6 +3299,22 @@ mod tests { Op::FullscreenWindow(1), Op::FullscreenWindow(2), Op::FullscreenWindow(3), + Op::SetFullscreenWindow { + window: 1, + is_fullscreen: false, + }, + Op::SetFullscreenWindow { + window: 1, + is_fullscreen: true, + }, + Op::SetFullscreenWindow { + window: 2, + is_fullscreen: false, + }, + Op::SetFullscreenWindow { + window: 2, + is_fullscreen: true, + }, Op::FocusColumnLeft, Op::FocusColumnRight, Op::FocusWindowUp, @@ -3663,6 +3690,30 @@ mod tests { } #[test] + fn unfullscreen_window_in_column() { + let ops = [ + Op::AddOutput(1), + Op::AddWindow { + id: 1, + bbox: Rectangle::from_loc_and_size((0, 0), (100, 200)), + min_max_size: (Size::from((0, 0)), Size::from((i32::MAX, i32::MAX))), + }, + Op::AddWindow { + id: 2, + bbox: Rectangle::from_loc_and_size((0, 0), (100, 200)), + min_max_size: (Size::from((0, 0)), Size::from((i32::MAX, i32::MAX))), + }, + Op::ConsumeOrExpelWindowLeft, + Op::SetFullscreenWindow { + window: 2, + is_fullscreen: false, + }, + ]; + + check_ops(&ops); + } + + #[test] fn open_right_of_on_different_workspace() { let ops = [ Op::AddOutput(1), |
