Implement input type configs (#3784)

Add support for configurations that apply to a type of inputs
(i.e. natural scrolling on all touchpads). A type config is
differentiated by a `type:` prefix followed by the type it
corresponds to.

When new devices appear, the device config is merged on top of its
type config (if it exists). New type configs are applied on top of
existing configs.
This commit is contained in:
Benjamin Cheng 2019-03-25 22:05:49 -04:00 committed by Brian Ashworth
parent 6737b90cb9
commit bd3720585e
5 changed files with 109 additions and 6 deletions

View file

@ -113,6 +113,12 @@ void free_config(struct sway_config *config) {
}
list_free(config->input_configs);
}
if (config->input_type_configs) {
for (int i = 0; i < config->input_type_configs->length; i++) {
free_input_config(config->input_type_configs->items[i]);
}
list_free(config->input_type_configs);
}
if (config->seat_configs) {
for (int i = 0; i < config->seat_configs->length; i++) {
free_seat_config(config->seat_configs->items[i]);
@ -189,10 +195,12 @@ static void config_defaults(struct sway_config *config) {
if (!(config->workspace_configs = create_list())) goto cleanup;
if (!(config->criteria = create_list())) goto cleanup;
if (!(config->no_focus = create_list())) goto cleanup;
if (!(config->input_configs = create_list())) goto cleanup;
if (!(config->seat_configs = create_list())) goto cleanup;
if (!(config->output_configs = create_list())) goto cleanup;
if (!(config->input_type_configs = create_list())) goto cleanup;
if (!(config->input_configs = create_list())) goto cleanup;
if (!(config->cmd_queue = create_list())) goto cleanup;
if (!(config->current_mode = malloc(sizeof(struct sway_mode))))