mirror of
https://github.com/swaywm/sway.git
synced 2025-11-24 06:59:51 -05:00
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:
parent
5e90080468
commit
f5fa0c7124
3 changed files with 7 additions and 18 deletions
|
|
@ -343,14 +343,6 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
|
|||
}
|
||||
wlr_output_enable(wlr_output, false);
|
||||
return wlr_output_commit(wlr_output);
|
||||
} else if (!output->enabled) {
|
||||
// Output is not enabled. Enable it, output_enable will call us again.
|
||||
if (!oc || oc->dpms_state != DPMS_OFF) {
|
||||
sway_log(SWAY_DEBUG, "Enabling output %s", oc->name);
|
||||
wlr_output_enable(wlr_output, true);
|
||||
wlr_output_commit(wlr_output);
|
||||
}
|
||||
return output_enable(output, oc);
|
||||
}
|
||||
|
||||
if (!oc || oc->dpms_state != DPMS_OFF) {
|
||||
|
|
@ -440,6 +432,10 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) {
|
|||
output->width = output_box->width;
|
||||
output->height = output_box->height;
|
||||
|
||||
if ((!oc || oc->enabled) && !output->enabled) {
|
||||
output_enable(output);
|
||||
}
|
||||
|
||||
if (oc && oc->dpms_state == DPMS_OFF) {
|
||||
sway_log(SWAY_DEBUG, "Turning off output %s", oc->name);
|
||||
wlr_output_enable(wlr_output, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue