aboutsummaryrefslogtreecommitdiffstats
path: root/sway/config
diff options
context:
space:
mode:
authorLibravatar Tudor Brindus <me@tbrindus.ca>2020-06-19 14:11:57 -0400
committerLibravatar Simon Ser <contact@emersion.fr>2020-10-12 15:01:37 +0200
commited247c031cb9783deb5c04631b53c5ac6c432eb7 (patch)
tree3b8aa74d49d6e6cb1518cd749854cba13728f259 /sway/config
parentinput/cursor: default tablet lens tool to relative motion (diff)
downloadsway-ed247c031cb9783deb5c04631b53c5ac6c432eb7.tar.gz
sway-ed247c031cb9783deb5c04631b53c5ac6c432eb7.tar.zst
sway-ed247c031cb9783deb5c04631b53c5ac6c432eb7.zip
input/tablet: add tool_mode option to set tablet tools as relative input
Closes #4139.
Diffstat (limited to 'sway/config')
-rw-r--r--sway/config/input.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sway/config/input.c b/sway/config/input.c
index 2ed9c016..a998e170 100644
--- a/sway/config/input.c
+++ b/sway/config/input.c
@@ -40,6 +40,7 @@ struct input_config *new_input_config(const char* identifier) {
40 input->xkb_numlock = INT_MIN; 40 input->xkb_numlock = INT_MIN;
41 input->xkb_capslock = INT_MIN; 41 input->xkb_capslock = INT_MIN;
42 input->xkb_file_is_set = false; 42 input->xkb_file_is_set = false;
43 input->tools = create_list();
43 44
44 return input; 45 return input;
45} 46}
@@ -153,6 +154,22 @@ void merge_input_config(struct input_config *dst, struct input_config *src) {
153 memcpy(dst->calibration_matrix.matrix, src->calibration_matrix.matrix, 154 memcpy(dst->calibration_matrix.matrix, src->calibration_matrix.matrix,
154 sizeof(src->calibration_matrix.matrix)); 155 sizeof(src->calibration_matrix.matrix));
155 } 156 }
157 for (int i = 0; i < src->tools->length; i++) {
158 struct input_config_tool *src_tool = src->tools->items[i];
159 for (int j = 0; j < dst->tools->length; j++) {
160 struct input_config_tool *dst_tool = dst->tools->items[j];
161 if (src_tool->type == dst_tool->type) {
162 dst_tool->mode = src_tool->mode;
163 goto tool_merge_outer;
164 }
165 }
166
167 struct input_config_tool *dst_tool = malloc(sizeof(*dst_tool));
168 memcpy(dst_tool, src_tool, sizeof(*dst_tool));
169 list_add(dst->tools, dst_tool);
170
171 tool_merge_outer:;
172 }
156} 173}
157 174
158static bool validate_xkb_merge(struct input_config *dest, 175static bool validate_xkb_merge(struct input_config *dest,
@@ -358,6 +375,7 @@ void free_input_config(struct input_config *ic) {
358 free(ic->mapped_from_region); 375 free(ic->mapped_from_region);
359 free(ic->mapped_to_output); 376 free(ic->mapped_to_output);
360 free(ic->mapped_to_region); 377 free(ic->mapped_to_region);
378 list_free_items_and_destroy(ic->tools);
361 free(ic); 379 free(ic);
362} 380}
363 381