aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config.c
diff options
context:
space:
mode:
authorLibravatar Benjamin Cheng <ben@bcheng.me>2019-03-25 22:05:49 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-04-14 19:31:36 -0400
commitbd3720585e91ae0dfcc4be30149ae4f8f5218174 (patch)
tree3a44b51a2c5a78bfbde227180c3853875a2258a4 /sway/config.c
parentAdd heuristics to differentiate touchpads (diff)
downloadsway-bd3720585e91ae0dfcc4be30149ae4f8f5218174.tar.gz
sway-bd3720585e91ae0dfcc4be30149ae4f8f5218174.tar.zst
sway-bd3720585e91ae0dfcc4be30149ae4f8f5218174.zip
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.
Diffstat (limited to 'sway/config.c')
-rw-r--r--sway/config.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sway/config.c b/sway/config.c
index 4944ec02..e14ea83a 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -113,6 +113,12 @@ void free_config(struct sway_config *config) {
113 } 113 }
114 list_free(config->input_configs); 114 list_free(config->input_configs);
115 } 115 }
116 if (config->input_type_configs) {
117 for (int i = 0; i < config->input_type_configs->length; i++) {
118 free_input_config(config->input_type_configs->items[i]);
119 }
120 list_free(config->input_type_configs);
121 }
116 if (config->seat_configs) { 122 if (config->seat_configs) {
117 for (int i = 0; i < config->seat_configs->length; i++) { 123 for (int i = 0; i < config->seat_configs->length; i++) {
118 free_seat_config(config->seat_configs->items[i]); 124 free_seat_config(config->seat_configs->items[i]);
@@ -189,10 +195,12 @@ static void config_defaults(struct sway_config *config) {
189 if (!(config->workspace_configs = create_list())) goto cleanup; 195 if (!(config->workspace_configs = create_list())) goto cleanup;
190 if (!(config->criteria = create_list())) goto cleanup; 196 if (!(config->criteria = create_list())) goto cleanup;
191 if (!(config->no_focus = create_list())) goto cleanup; 197 if (!(config->no_focus = create_list())) goto cleanup;
192 if (!(config->input_configs = create_list())) goto cleanup;
193 if (!(config->seat_configs = create_list())) goto cleanup; 198 if (!(config->seat_configs = create_list())) goto cleanup;
194 if (!(config->output_configs = create_list())) goto cleanup; 199 if (!(config->output_configs = create_list())) goto cleanup;
195 200
201 if (!(config->input_type_configs = create_list())) goto cleanup;
202 if (!(config->input_configs = create_list())) goto cleanup;
203
196 if (!(config->cmd_queue = create_list())) goto cleanup; 204 if (!(config->cmd_queue = create_list())) goto cleanup;
197 205
198 if (!(config->current_mode = malloc(sizeof(struct sway_mode)))) 206 if (!(config->current_mode = malloc(sizeof(struct sway_mode))))