mirror of
https://github.com/swaywm/sway.git
synced 2024-11-25 01:11:28 +00:00
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.
This commit is contained in:
parent
56e97b7d60
commit
9becff0ba5
|
@ -701,10 +701,6 @@ struct output_config *store_output_config(struct output_config *oc);
|
||||||
|
|
||||||
struct output_config *find_output_config(struct sway_output *output);
|
struct output_config *find_output_config(struct sway_output *output);
|
||||||
|
|
||||||
void apply_output_config_to_outputs(struct output_config *oc);
|
|
||||||
|
|
||||||
void reset_outputs(void);
|
|
||||||
|
|
||||||
void free_output_config(struct output_config *oc);
|
void free_output_config(struct output_config *oc);
|
||||||
|
|
||||||
bool spawn_swaybg(void);
|
bool spawn_swaybg(void);
|
||||||
|
|
|
@ -532,7 +532,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
|
||||||
}
|
}
|
||||||
sway_switch_retrigger_bindings_for_all();
|
sway_switch_retrigger_bindings_for_all();
|
||||||
|
|
||||||
reset_outputs();
|
apply_all_output_configs();
|
||||||
spawn_swaybg();
|
spawn_swaybg();
|
||||||
|
|
||||||
config->reloading = false;
|
config->reloading = false;
|
||||||
|
|
|
@ -807,59 +807,6 @@ void apply_all_output_configs(void) {
|
||||||
free(configs);
|
free(configs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply_output_config_to_outputs(struct output_config *oc) {
|
|
||||||
size_t configs_len = wl_list_length(&root->all_outputs);
|
|
||||||
struct matched_output_config *configs = calloc(configs_len, sizeof(*configs));
|
|
||||||
if (!configs) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to find the output container and apply configuration now. If
|
|
||||||
// this is during startup then there will be no container and config
|
|
||||||
// will be applied during normal "new output" event from wlroots.
|
|
||||||
int config_idx = 0;
|
|
||||||
struct sway_output *sway_output;
|
|
||||||
wl_list_for_each(sway_output, &root->all_outputs, link) {
|
|
||||||
if (sway_output == root->fallback_output) {
|
|
||||||
configs_len--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct matched_output_config *config = &configs[config_idx++];
|
|
||||||
config->output = sway_output;
|
|
||||||
config->config = find_output_config(sway_output);
|
|
||||||
|
|
||||||
if (!output_match_name_or_id(sway_output, oc->name)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!config->config && oc) {
|
|
||||||
// No stored output config matched, apply oc directly
|
|
||||||
sway_log(SWAY_DEBUG, "Applying oc directly");
|
|
||||||
config->config = new_output_config(oc->name);
|
|
||||||
merge_output_config(config->config, oc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apply_output_configs(configs, configs_len, false);
|
|
||||||
for (size_t idx = 0; idx < configs_len; idx++) {
|
|
||||||
struct matched_output_config *cfg = &configs[idx];
|
|
||||||
free_output_config(cfg->config);
|
|
||||||
}
|
|
||||||
free(configs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset_outputs(void) {
|
|
||||||
struct output_config *oc = NULL;
|
|
||||||
int i = list_seq_find(config->output_configs, output_name_cmp, "*");
|
|
||||||
if (i >= 0) {
|
|
||||||
oc = config->output_configs->items[i];
|
|
||||||
} else {
|
|
||||||
oc = store_output_config(new_output_config("*"));
|
|
||||||
}
|
|
||||||
apply_output_config_to_outputs(oc);
|
|
||||||
}
|
|
||||||
|
|
||||||
void free_output_config(struct output_config *oc) {
|
void free_output_config(struct output_config *oc) {
|
||||||
if (!oc) {
|
if (!oc) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue