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 | |
parent | Add missing description for focus_on_window_activation command in docs. (diff) | |
download | sway-eb770e88b7396e892898d6a71867d2a603e707ff.tar.gz sway-eb770e88b7396e892898d6a71867d2a603e707ff.tar.zst sway-eb770e88b7396e892898d6a71867d2a603e707ff.zip |
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')
-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) { | |||
39 | input->repeat_rate = INT_MIN; | 39 | input->repeat_rate = INT_MIN; |
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 | 43 | ||
43 | return input; | 44 | return input; |
44 | } | 45 | } |
@@ -95,6 +96,11 @@ void merge_input_config(struct input_config *dst, struct input_config *src) { | |||
95 | if (src->tap_button_map != INT_MIN) { | 96 | if (src->tap_button_map != INT_MIN) { |
96 | dst->tap_button_map = src->tap_button_map; | 97 | dst->tap_button_map = src->tap_button_map; |
97 | } | 98 | } |
99 | if (src->xkb_file_is_set) { | ||
100 | free(dst->xkb_file); | ||
101 | dst->xkb_file = src->xkb_file ? strdup(src->xkb_file) : NULL; | ||
102 | dst->xkb_file_is_set = dst->xkb_file != NULL; | ||
103 | } | ||
98 | if (src->xkb_layout) { | 104 | if (src->xkb_layout) { |
99 | free(dst->xkb_layout); | 105 | free(dst->xkb_layout); |
100 | dst->xkb_layout = strdup(src->xkb_layout); | 106 | dst->xkb_layout = strdup(src->xkb_layout); |
@@ -284,6 +290,8 @@ struct input_config *store_input_config(struct input_config *ic, | |||
284 | ic = current; | 290 | ic = current; |
285 | } | 291 | } |
286 | 292 | ||
293 | ic->xkb_file_is_set = ic->xkb_file != NULL; | ||
294 | |||
287 | if (!current || new_current) { | 295 | if (!current || new_current) { |
288 | list_add(config_list, ic); | 296 | list_add(config_list, ic); |
289 | } | 297 | } |
@@ -307,6 +315,7 @@ void free_input_config(struct input_config *ic) { | |||
307 | return; | 315 | return; |
308 | } | 316 | } |
309 | free(ic->identifier); | 317 | free(ic->identifier); |
318 | free(ic->xkb_file); | ||
310 | free(ic->xkb_layout); | 319 | free(ic->xkb_layout); |
311 | free(ic->xkb_model); | 320 | free(ic->xkb_model); |
312 | free(ic->xkb_options); | 321 | free(ic->xkb_options); |