diff options
author | Kenny Levinsen <kl@kl.wtf> | 2024-03-16 00:37:06 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2024-03-28 10:45:20 +0100 |
commit | e2f3ebad8c1943800dd5f017d547d9d98bfb8bb1 (patch) | |
tree | 906ea9e81cc2923849503f1d460e5407bc64b5a4 /sway | |
parent | man: document supported modifier names (diff) | |
download | sway-e2f3ebad8c1943800dd5f017d547d9d98bfb8bb1.tar.gz sway-e2f3ebad8c1943800dd5f017d547d9d98bfb8bb1.tar.zst sway-e2f3ebad8c1943800dd5f017d547d9d98bfb8bb1.zip |
config/output: Split apply_output_config
Applying an output config has two stages: Atomic application of
wlr_output_state, and applicaiton of non-atomic state like output
layout.
Split the latter out into finalize_output_config for use in a later
commit.
Diffstat (limited to 'sway')
-rw-r--r-- | sway/config/output.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/sway/config/output.c b/sway/config/output.c index 1b2332e9..fd1d6e3c 100644 --- a/sway/config/output.c +++ b/sway/config/output.c | |||
@@ -503,25 +503,12 @@ static void queue_output_config(struct output_config *oc, | |||
503 | } | 503 | } |
504 | } | 504 | } |
505 | 505 | ||
506 | bool apply_output_config(struct output_config *oc, struct sway_output *output) { | 506 | static bool finalize_output_config(struct output_config *oc, struct sway_output *output) { |
507 | if (output == root->fallback_output) { | 507 | if (output == root->fallback_output) { |
508 | return false; | 508 | return false; |
509 | } | 509 | } |
510 | 510 | ||
511 | struct wlr_output *wlr_output = output->wlr_output; | 511 | struct wlr_output *wlr_output = output->wlr_output; |
512 | |||
513 | struct wlr_output_state pending = {0}; | ||
514 | queue_output_config(oc, output, &pending); | ||
515 | |||
516 | sway_log(SWAY_DEBUG, "Committing output %s", wlr_output->name); | ||
517 | if (!wlr_output_commit_state(wlr_output, &pending)) { | ||
518 | // Failed to commit output changes, maybe the output is missing a CRTC. | ||
519 | // Leave the output disabled for now and try again when the output gets | ||
520 | // the mode we asked for. | ||
521 | sway_log(SWAY_ERROR, "Failed to commit output %s", wlr_output->name); | ||
522 | return false; | ||
523 | } | ||
524 | |||
525 | if (oc && !oc->enabled) { | 512 | if (oc && !oc->enabled) { |
526 | sway_log(SWAY_DEBUG, "Disabling output %s", oc->name); | 513 | sway_log(SWAY_DEBUG, "Disabling output %s", oc->name); |
527 | if (output->enabled) { | 514 | if (output->enabled) { |
@@ -577,6 +564,30 @@ bool apply_output_config(struct output_config *oc, struct sway_output *output) { | |||
577 | output->max_render_time = oc->max_render_time; | 564 | output->max_render_time = oc->max_render_time; |
578 | } | 565 | } |
579 | 566 | ||
567 | return true; | ||
568 | } | ||
569 | |||
570 | bool apply_output_config(struct output_config *oc, struct sway_output *output) { | ||
571 | if (output == root->fallback_output) { | ||
572 | return false; | ||
573 | } | ||
574 | |||
575 | struct wlr_output_state pending = {0}; | ||
576 | queue_output_config(oc, output, &pending); | ||
577 | |||
578 | sway_log(SWAY_DEBUG, "Committing output %s", output->wlr_output->name); | ||
579 | if (!wlr_output_commit_state(output->wlr_output, &pending)) { | ||
580 | // Failed to commit output changes, maybe the output is missing a CRTC. | ||
581 | // Leave the output disabled for now and try again when the output gets | ||
582 | // the mode we asked for. | ||
583 | sway_log(SWAY_ERROR, "Failed to commit output %s", output->wlr_output->name); | ||
584 | return false; | ||
585 | } | ||
586 | |||
587 | if (!finalize_output_config(oc, output)) { | ||
588 | return false; | ||
589 | } | ||
590 | |||
580 | // Reconfigure all devices, since input config may have been applied before | 591 | // Reconfigure all devices, since input config may have been applied before |
581 | // this output came online, and some config items (like map_to_output) are | 592 | // this output came online, and some config items (like map_to_output) are |
582 | // dependent on an output being present. | 593 | // dependent on an output being present. |