Terminate swaybg in output_disable

Moves the call to `terminate_swaybg` from inside `apply_output_config` to
`output_disable`. The former was only called when an output was being
disabled. The latter is called when an output is being disabled and when
an output becomes disconnected. Without this, disconnecting an enabled
output would result in a defunct swaybg process.
This commit is contained in:
Brian Ashworth 2018-12-19 03:21:41 -05:00 committed by emersion
parent 3a4f4f5d66
commit 477bca5e28
2 changed files with 5 additions and 4 deletions

View file

@ -179,10 +179,6 @@ void apply_output_config(struct output_config *oc, struct sway_output *output) {
if (oc && oc->enabled == 0) { if (oc && oc->enabled == 0) {
if (output->enabled) { if (output->enabled) {
if (output->bg_pid != 0) {
terminate_swaybg(output->bg_pid);
output->bg_pid = 0;
}
output_disable(output); output_disable(output);
wlr_output_layout_remove(root->output_layout, wlr_output); wlr_output_layout_remove(root->output_layout, wlr_output);
} }

View file

@ -225,6 +225,11 @@ void output_disable(struct sway_output *output) {
root_for_each_container(untrack_output, output); root_for_each_container(untrack_output, output);
if (output->bg_pid) {
terminate_swaybg(output->bg_pid);
output->bg_pid = 0;
}
int index = list_find(root->outputs, output); int index = list_find(root->outputs, output);
list_del(root->outputs, index); list_del(root->outputs, index);