From eb770e88b7396e892898d6a71867d2a603e707ff Mon Sep 17 00:00:00 2001 From: Ed Younis Date: Fri, 12 Jul 2019 19:04:29 -0700 Subject: Implement input_cmd_xkb_file (#3999) Adds a new commend "xkb_file", which constructs the internal xkb_keymap from a xkb file rather than an RMLVO configuration. This allows greater flexibility when specifying xkb configurations. An xkb file can be dumped with the xkbcomp program. --- sway/config/input.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sway/config/input.c') diff --git a/sway/config/input.c b/sway/config/input.c index b5be4f26..ad4a64ee 100644 --- a/sway/config/input.c +++ b/sway/config/input.c @@ -39,6 +39,7 @@ struct input_config *new_input_config(const char* identifier) { input->repeat_rate = INT_MIN; input->xkb_numlock = INT_MIN; input->xkb_capslock = INT_MIN; + input->xkb_file_is_set = false; return input; } @@ -95,6 +96,11 @@ void merge_input_config(struct input_config *dst, struct input_config *src) { if (src->tap_button_map != INT_MIN) { dst->tap_button_map = src->tap_button_map; } + if (src->xkb_file_is_set) { + free(dst->xkb_file); + dst->xkb_file = src->xkb_file ? strdup(src->xkb_file) : NULL; + dst->xkb_file_is_set = dst->xkb_file != NULL; + } if (src->xkb_layout) { free(dst->xkb_layout); dst->xkb_layout = strdup(src->xkb_layout); @@ -284,6 +290,8 @@ struct input_config *store_input_config(struct input_config *ic, ic = current; } + ic->xkb_file_is_set = ic->xkb_file != NULL; + if (!current || new_current) { list_add(config_list, ic); } @@ -307,6 +315,7 @@ void free_input_config(struct input_config *ic) { return; } free(ic->identifier); + free(ic->xkb_file); free(ic->xkb_layout); free(ic->xkb_model); free(ic->xkb_options); -- cgit v1.2.3