Stop calling apply_output_config from output_enable

The only output_enable caller is now apply_output_config. Stop calling
apply_output_config from output_enable to simplify the code and avoid
the back-and-forth between these two functions.

output_enable is now the symmetric of output_disable: it just marks the
output as enabled and performs bookkeeping (e.g. creating teh default
workspace). It is called from apply_output_config after the output
commit, so that it can read the current output state and act
accordingly.

This change also allows us to avoid an extraneous wlr_output_commit.

References: https://github.com/swaywm/sway/issues/4921
This commit is contained in:
Simon Ser 2020-02-11 14:17:33 +01:00 committed by Brian Ashworth
parent 5e90080468
commit f5fa0c7124
3 changed files with 7 additions and 18 deletions

View file

@ -105,9 +105,9 @@ struct sway_output *output_create(struct wlr_output *wlr_output) {
return output;
}
bool output_enable(struct sway_output *output, struct output_config *oc) {
void output_enable(struct sway_output *output) {
if (!sway_assert(!output->enabled, "output is already enabled")) {
return false;
return;
}
struct wlr_output *wlr_output = output->wlr_output;
size_t len = sizeof(output->layers) / sizeof(output->layers[0]);
@ -116,11 +116,6 @@ bool output_enable(struct sway_output *output, struct output_config *oc) {
}
output->enabled = true;
if (!apply_output_config(oc, output)) {
output->enabled = false;
return false;
}
output->configured = true;
list_add(root->outputs, output);
@ -156,8 +151,6 @@ bool output_enable(struct sway_output *output, struct output_config *oc) {
arrange_layers(output);
arrange_root();
return true;
}
static void evacuate_sticky(struct sway_workspace *old_ws,