mirror of
https://github.com/swaywm/sway.git
synced 2026-04-18 06:46:56 -04:00
config/output: Add test_only/degrade to apply_all_output_configs
This will be used in a follow-up commit for testing configuration.
This commit is contained in:
parent
639162dad3
commit
fe1cbfaf08
5 changed files with 8 additions and 7 deletions
|
|
@ -696,7 +696,7 @@ struct output_config *new_output_config(const char *name);
|
||||||
bool apply_output_configs(struct matched_output_config *configs,
|
bool apply_output_configs(struct matched_output_config *configs,
|
||||||
size_t configs_len, bool test_only, bool degrade_to_off);
|
size_t configs_len, bool test_only, bool degrade_to_off);
|
||||||
|
|
||||||
void apply_all_output_configs(void);
|
bool apply_all_output_configs(bool test_only, bool degrade_to_off);
|
||||||
|
|
||||||
void sort_output_configs_by_priority(struct matched_output_config *configs,
|
void sort_output_configs_by_priority(struct matched_output_config *configs,
|
||||||
size_t configs_len);
|
size_t configs_len);
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ struct cmd_results *cmd_output(int argc, char **argv) {
|
||||||
// entire config and before the deferred commands so that an auto generated
|
// entire config and before the deferred commands so that an auto generated
|
||||||
// workspace name is not given to re-enabled outputs.
|
// workspace name is not given to re-enabled outputs.
|
||||||
if (!config->reloading && !config->validating) {
|
if (!config->reloading && !config->validating) {
|
||||||
apply_all_output_configs();
|
apply_all_output_configs(false, true);
|
||||||
if (background) {
|
if (background) {
|
||||||
if (!spawn_swaybg()) {
|
if (!spawn_swaybg()) {
|
||||||
return cmd_results_new(CMD_FAILURE,
|
return cmd_results_new(CMD_FAILURE,
|
||||||
|
|
|
||||||
|
|
@ -533,7 +533,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();
|
||||||
|
|
||||||
apply_all_output_configs();
|
apply_all_output_configs(false, true);
|
||||||
spawn_swaybg();
|
spawn_swaybg();
|
||||||
|
|
||||||
config->reloading = false;
|
config->reloading = false;
|
||||||
|
|
|
||||||
|
|
@ -997,11 +997,11 @@ out:
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply_all_output_configs(void) {
|
bool apply_all_output_configs(bool test_only, bool degrade_to_off) {
|
||||||
size_t configs_len = wl_list_length(&root->all_outputs);
|
size_t configs_len = wl_list_length(&root->all_outputs);
|
||||||
struct matched_output_config *configs = calloc(configs_len, sizeof(*configs));
|
struct matched_output_config *configs = calloc(configs_len, sizeof(*configs));
|
||||||
if (!configs) {
|
if (!configs) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int config_idx = 0;
|
int config_idx = 0;
|
||||||
|
|
@ -1018,12 +1018,13 @@ void apply_all_output_configs(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sort_output_configs_by_priority(configs, configs_len);
|
sort_output_configs_by_priority(configs, configs_len);
|
||||||
apply_output_configs(configs, configs_len, false, true);
|
bool ok = apply_output_configs(configs, configs_len, test_only, degrade_to_off);
|
||||||
for (size_t idx = 0; idx < configs_len; idx++) {
|
for (size_t idx = 0; idx < configs_len; idx++) {
|
||||||
struct matched_output_config *cfg = &configs[idx];
|
struct matched_output_config *cfg = &configs[idx];
|
||||||
free_output_config(cfg->config);
|
free_output_config(cfg->config);
|
||||||
}
|
}
|
||||||
free(configs);
|
free(configs);
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_output_config(struct output_config *oc) {
|
void free_output_config(struct output_config *oc) {
|
||||||
|
|
|
||||||
|
|
@ -386,7 +386,7 @@ static int timer_modeset_handle(void *data) {
|
||||||
wl_event_source_remove(server->delayed_modeset);
|
wl_event_source_remove(server->delayed_modeset);
|
||||||
server->delayed_modeset = NULL;
|
server->delayed_modeset = NULL;
|
||||||
|
|
||||||
apply_all_output_configs();
|
apply_all_output_configs(false, true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue