output_configuration: Set enabled to false in remove_heads
`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.
This commit is contained in:
parent
8d5541b27f
commit
9f354ab45f
1 changed files with 12 additions and 3 deletions
|
|
@ -203,12 +203,22 @@ where
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
for output in new_outputs {
|
for output in new_outputs {
|
||||||
output.user_data().insert_if_missing(|| {
|
let added = output.user_data().insert_if_missing(|| {
|
||||||
OutputState::new(OutputStateInner {
|
OutputState::new(OutputStateInner {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
global: None,
|
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());
|
self.outputs.push(output.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -219,8 +229,7 @@ where
|
||||||
self.removed_outputs.push(output.clone());
|
self.removed_outputs.push(output.clone());
|
||||||
if let Some(inner) = output.user_data().get::<OutputState>() {
|
if let Some(inner) = output.user_data().get::<OutputState>() {
|
||||||
let mut inner = inner.lock().unwrap();
|
let mut inner = inner.lock().unwrap();
|
||||||
// if it gets re-added it should start with being enabled and no global
|
inner.enabled = false;
|
||||||
inner.enabled = true;
|
|
||||||
if let Some(global) = inner.global.take() {
|
if let Some(global) = inner.global.take() {
|
||||||
self.dh.remove_global::<D>(global);
|
self.dh.remove_global::<D>(global);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue