From 9f354ab45f5d5efda295526bfcb65dab5a849146 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Wed, 13 Nov 2024 12:50:14 -0800 Subject: [PATCH] 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. --- src/wayland/protocols/output_configuration/mod.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/wayland/protocols/output_configuration/mod.rs b/src/wayland/protocols/output_configuration/mod.rs index e575a126..9ba707fb 100644 --- a/src/wayland/protocols/output_configuration/mod.rs +++ b/src/wayland/protocols/output_configuration/mod.rs @@ -203,12 +203,22 @@ where .collect::>(); 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::() + .unwrap() + .lock() + .unwrap(); + inner.enabled = true; + } self.outputs.push(output.clone()); } } @@ -219,8 +229,7 @@ where self.removed_outputs.push(output.clone()); if let Some(inner) = output.user_data().get::() { 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::(global); }