aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config/output.c
diff options
context:
space:
mode:
authorLibravatar Kenny Levinsen <kl@kl.wtf>2024-03-16 01:11:35 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2024-03-28 10:45:20 +0100
commit9becff0ba56ac7da8b1235aa5740fb04414636a2 (patch)
tree9909fa4c64f2f9abace29d6d2a4aad1d49cb8b22 /sway/config/output.c
parentconfig/output: Remove apply_output_config (diff)
downloadsway-9becff0ba56ac7da8b1235aa5740fb04414636a2.tar.gz
sway-9becff0ba56ac7da8b1235aa5740fb04414636a2.tar.zst
sway-9becff0ba56ac7da8b1235aa5740fb04414636a2.zip
output/config: Remove reset_outputs and co.
apply_output_config_to_outputs uses the specified output config to check which outputs to apply to, and to use as backup when no config is found. If any config matches the output, the specified config will be disregarded. The only remaining user of apply_output_config_to_outputs is reset_outputs, which called apply_output_config_to_outputs with either the first stored wildcard config, or a new empty wildcard config. Providing a stored or empty wildcard config is practically the same as calling `apply_all_output_configs`. Replace uses of `reset_outputs` with `apply_all_output_configs` and remove the now unused functions.
Diffstat (limited to 'sway/config/output.c')
-rw-r--r--sway/config/output.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/sway/config/output.c b/sway/config/output.c
index cb12683d..a7c2f9b8 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -807,59 +807,6 @@ void apply_all_output_configs(void) {
807 free(configs); 807 free(configs);
808} 808}
809 809
810void apply_output_config_to_outputs(struct output_config *oc) {
811 size_t configs_len = wl_list_length(&root->all_outputs);
812 struct matched_output_config *configs = calloc(configs_len, sizeof(*configs));
813 if (!configs) {
814 return;
815 }
816
817 // Try to find the output container and apply configuration now. If
818 // this is during startup then there will be no container and config
819 // will be applied during normal "new output" event from wlroots.
820 int config_idx = 0;
821 struct sway_output *sway_output;
822 wl_list_for_each(sway_output, &root->all_outputs, link) {
823 if (sway_output == root->fallback_output) {
824 configs_len--;
825 continue;
826 }
827
828 struct matched_output_config *config = &configs[config_idx++];
829 config->output = sway_output;
830 config->config = find_output_config(sway_output);
831
832 if (!output_match_name_or_id(sway_output, oc->name)) {
833 continue;
834 }
835
836 if (!config->config && oc) {
837 // No stored output config matched, apply oc directly
838 sway_log(SWAY_DEBUG, "Applying oc directly");
839 config->config = new_output_config(oc->name);
840 merge_output_config(config->config, oc);
841 }
842 }
843
844 apply_output_configs(configs, configs_len, false);
845 for (size_t idx = 0; idx < configs_len; idx++) {
846 struct matched_output_config *cfg = &configs[idx];
847 free_output_config(cfg->config);
848 }
849 free(configs);
850}
851
852void reset_outputs(void) {
853 struct output_config *oc = NULL;
854 int i = list_seq_find(config->output_configs, output_name_cmp, "*");
855 if (i >= 0) {
856 oc = config->output_configs->items[i];
857 } else {
858 oc = store_output_config(new_output_config("*"));
859 }
860 apply_output_config_to_outputs(oc);
861}
862
863void free_output_config(struct output_config *oc) { 810void free_output_config(struct output_config *oc) {
864 if (!oc) { 811 if (!oc) {
865 return; 812 return;