wayland/fractional: Avoid deadlock
This commit is contained in:
parent
8dbdd4a13e
commit
cf5b4017ba
1 changed files with 27 additions and 26 deletions
|
|
@ -22,34 +22,35 @@ impl FractionalScaleHandler for State {
|
|||
// If all the above tests do not lead to a output we just use the active output
|
||||
// of the last active seat (which will also be the output a toplevel will
|
||||
// initially be placed on)
|
||||
let mut root = surface.clone();
|
||||
while let Some(parent) = get_parent(&root) {
|
||||
root = parent;
|
||||
}
|
||||
let output = with_states(&surface, |states| {
|
||||
surface_primary_scanout_output(&surface, states)
|
||||
})
|
||||
.or_else(|| {
|
||||
let mut root = surface.clone();
|
||||
while let Some(parent) = get_parent(&root) {
|
||||
root = parent;
|
||||
}
|
||||
|
||||
(root != surface)
|
||||
.then(|| {
|
||||
with_states(&root, |states| {
|
||||
surface_primary_scanout_output(&root, states)
|
||||
})
|
||||
})
|
||||
.flatten()
|
||||
.or_else(|| {
|
||||
self.common
|
||||
.shell
|
||||
.visible_outputs_for_surface(&surface)
|
||||
.next()
|
||||
})
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
let seat = self.common.last_active_seat();
|
||||
seat.active_output()
|
||||
});
|
||||
|
||||
with_states(&surface, |states| {
|
||||
let output = surface_primary_scanout_output(&surface, states)
|
||||
.or_else(|| {
|
||||
if root != surface {
|
||||
with_states(&root, |states| {
|
||||
surface_primary_scanout_output(&root, states).or_else(|| {
|
||||
self.common
|
||||
.shell
|
||||
.visible_outputs_for_surface(&surface)
|
||||
.next()
|
||||
})
|
||||
})
|
||||
} else {
|
||||
self.common
|
||||
.shell
|
||||
.visible_outputs_for_surface(&surface)
|
||||
.next()
|
||||
}
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
let seat = self.common.last_active_seat();
|
||||
seat.active_output()
|
||||
});
|
||||
with_fractional_scale(states, |fractional_scale| {
|
||||
fractional_scale.set_preferred_scale(output.current_scale().fractional_scale());
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue