focus: Fix crash when no output is available

This commit is contained in:
Victoria Brekenfeld 2024-06-26 17:24:46 +02:00 committed by Victoria Brekenfeld
parent 26ccb653b7
commit 953c277cb0
2 changed files with 4 additions and 8 deletions

View file

@ -266,7 +266,9 @@ impl Common {
let mut shell = state.common.shell.write().unwrap();
let output = seat.active_output();
if !shell.outputs().any(|o| o == &output) {
seat.set_active_output(&shell.outputs().next().unwrap());
if let Some(other) = shell.outputs().next() {
seat.set_active_output(other);
}
continue;
}
let last_known_focus = ActiveFocus::get(&seat);

View file

@ -1455,13 +1455,7 @@ impl Shell {
}
pub fn outputs(&self) -> impl DoubleEndedIterator<Item = &Output> {
self.workspaces.sets.keys().chain(
self.workspaces
.backup_set
.as_ref()
.into_iter()
.map(|set| &set.output),
)
self.workspaces.sets.keys()
}
pub fn next_output(&self, current_output: &Output, direction: Direction) -> Option<&Output> {