seat: Workaround old active outputs on hotplug

This commit is contained in:
Victoria Brekenfeld 2022-11-22 10:07:17 +01:00
parent 9c41c80345
commit b2686424ea
9 changed files with 69 additions and 14 deletions

View file

@ -167,6 +167,10 @@ impl Common {
let seats = state.common.seats().cloned().collect::<Vec<_>>();
for seat in seats {
let output = seat.active_output();
if !state.common.shell.outputs.contains(&output) {
seat.set_active_output(&state.common.shell.outputs[0]);
continue;
}
let last_known_focus = ActiveFocus::get(&seat);
if let Some(target) = last_known_focus {

View file

@ -448,7 +448,15 @@ impl Shell {
}
}
pub fn remove_output(&mut self, output: &Output) {
pub fn remove_output(&mut self, output: &Output, seats: impl Iterator<Item = Seat<State>>) {
if let Some(first_output) = self.outputs.get(0) {
for seat in seats {
if &seat.active_output() == output {
seat.set_active_output(first_output);
}
}
}
if !self.outputs.contains(output) {
return;
}