Skip to content

Commit

Permalink
output_configuration: Set enabled to false in remove_heads
Browse files Browse the repository at this point in the history
`add_heads` will set it to `true` again, if used on the same `Output`.
It doesn't like like cosmic-comp's usage of this does that currently
though.
  • Loading branch information
ids1024 committed Nov 13, 2024
1 parent 8d5541b commit 8d98d25
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/wayland/protocols/output_configuration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,22 @@ where
.collect::<Vec<_>>();

for output in new_outputs {
output.user_data().insert_if_missing(|| {
let added = output.user_data().insert_if_missing(|| {
OutputState::new(OutputStateInner {
enabled: true,
global: None,
})
});
if !added {
// If head was previous added, enable it again
let mut inner = output
.user_data()
.get::<OutputState>()
.unwrap()
.lock()
.unwrap();
inner.enabled = true;
}
self.outputs.push(output.clone());
}
}
Expand All @@ -219,8 +229,7 @@ where
self.removed_outputs.push(output.clone());
if let Some(inner) = output.user_data().get::<OutputState>() {
let mut inner = inner.lock().unwrap();
// if it gets re-added it should start with being enabled and no global
inner.enabled = true;
inner.enabled = false;
if let Some(global) = inner.global.take() {
self.dh.remove_global::<D>(global);
}
Expand Down

0 comments on commit 8d98d25

Please sign in to comment.