diff options
author | Ed Younis <edyounis123@gmail.com> | 2019-07-12 19:04:29 -0700 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-07-17 19:26:58 -0400 |
commit | eb770e88b7396e892898d6a71867d2a603e707ff (patch) | |
tree | b4f04a7316b1c25286daabee57025fb1e7307919 /sway/config/input.c | |
parent | 3716c53d358fce7503ed0f59fcb5622c5e1a5a8f (diff) |
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.
Diffstat (limited to 'sway/config/input.c')
-rw-r--r-- | sway/config/input.c | 9 |
1 files changed, 9 insertions, 0 deletions
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); |