diff options
-rw-r--r-- | include/sway/config.h | 4 | ||||
-rw-r--r-- | sway/config.c | 2 | ||||
-rw-r--r-- | sway/config/output.c | 53 |
3 files changed, 1 insertions, 58 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index 69b14446..7e67ba21 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -701,10 +701,6 @@ struct output_config *store_output_config(struct output_config *oc); | |||
701 | 701 | ||
702 | struct output_config *find_output_config(struct sway_output *output); | 702 | struct output_config *find_output_config(struct sway_output *output); |
703 | 703 | ||
704 | void apply_output_config_to_outputs(struct output_config *oc); | ||
705 | |||
706 | void reset_outputs(void); | ||
707 | |||
708 | void free_output_config(struct output_config *oc); | 704 | void free_output_config(struct output_config *oc); |
709 | 705 | ||
710 | bool spawn_swaybg(void); | 706 | bool spawn_swaybg(void); |
diff --git a/sway/config.c b/sway/config.c index 72fc41e7..f9131e0f 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -532,7 +532,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { | |||
532 | } | 532 | } |
533 | sway_switch_retrigger_bindings_for_all(); | 533 | sway_switch_retrigger_bindings_for_all(); |
534 | 534 | ||
535 | reset_outputs(); | 535 | apply_all_output_configs(); |
536 | spawn_swaybg(); | 536 | spawn_swaybg(); |
537 | 537 | ||
538 | config->reloading = false; | 538 | config->reloading = false; |
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 | ||
810 | void 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 | |||
852 | void 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 | |||
863 | void free_output_config(struct output_config *oc) { | 810 | void free_output_config(struct output_config *oc) { |
864 | if (!oc) { | 811 | if (!oc) { |
865 | return; | 812 | return; |