config: improvements to the reload validation

For the validation pass of reloading, there is no need to touch swaybg,
swaynag, inputs, outputs, or seats. This drastically improves the speed
of a reload by skipping over the expensive I/O configuration and
handling of wayland clients. As long as the syntax is valid, the
CMD_FAILURE's can be relayed during the actual reload.
This commit is contained in:
Brian Ashworth 2019-11-26 19:43:06 -05:00 committed by Simon Ser
parent 90e3d25009
commit 1a5797803a
3 changed files with 37 additions and 27 deletions

View file

@ -447,15 +447,17 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
old_config->xwayland ? "enabled" : "disabled");
config->xwayland = old_config->xwayland;
if (old_config->swaybg_client != NULL) {
wl_client_destroy(old_config->swaybg_client);
}
if (!config->validating) {
if (old_config->swaybg_client != NULL) {
wl_client_destroy(old_config->swaybg_client);
}
if (old_config->swaynag_config_errors.client != NULL) {
wl_client_destroy(old_config->swaynag_config_errors.client);
}
if (old_config->swaynag_config_errors.client != NULL) {
wl_client_destroy(old_config->swaynag_config_errors.client);
}
input_manager_reset_all_inputs();
input_manager_reset_all_inputs();
}
}
config->current_config_path = path;
@ -520,8 +522,13 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
return success;
}
if (is_active) {
if (is_active && !validating) {
input_manager_verify_fallback_seat();
for (int i = 0; i < config->input_configs->length; i++) {
input_manager_apply_input_config(config->input_configs->items[i]);
}
for (int i = 0; i < config->seat_configs->length; i++) {
input_manager_apply_seat_config(config->seat_configs->items[i]);
}