diff options
-rw-r--r-- | sway/commands/input.c | 11 | ||||
-rw-r--r-- | sway/config.c | 2 |
2 files changed, 3 insertions, 10 deletions
diff --git a/sway/commands/input.c b/sway/commands/input.c index 903d574f..2de07de6 100644 --- a/sway/commands/input.c +++ b/sway/commands/input.c | |||
@@ -43,24 +43,17 @@ static struct cmd_handler input_config_handlers[] = { | |||
43 | * Re-translate keysyms if a change in the input config could affect them. | 43 | * Re-translate keysyms if a change in the input config could affect them. |
44 | */ | 44 | */ |
45 | static void retranslate_keysyms(struct input_config *input_config) { | 45 | static void retranslate_keysyms(struct input_config *input_config) { |
46 | bool matched = false; | ||
47 | for (int i = 0; i < config->input_configs->length; ++i) { | 46 | for (int i = 0; i < config->input_configs->length; ++i) { |
48 | struct input_config *ic = config->input_configs->items[i]; | 47 | struct input_config *ic = config->input_configs->items[i]; |
49 | matched |= ic->identifier == input_config->identifier; | ||
50 | |||
51 | // the first configured xkb_layout | ||
52 | if (ic->xkb_layout) { | 48 | if (ic->xkb_layout) { |
53 | if (matched) { | 49 | // this is the first config with xkb_layout |
50 | if (ic->identifier == input_config->identifier) { | ||
54 | translate_keysyms(ic->xkb_layout); | 51 | translate_keysyms(ic->xkb_layout); |
55 | } | 52 | } |
56 | 53 | ||
57 | // nothing has changed | ||
58 | return; | 54 | return; |
59 | } | 55 | } |
60 | } | 56 | } |
61 | |||
62 | // no xkb_layout has been set, restore the default | ||
63 | translate_keysyms(getenv("XKB_DEFAULT_LAYOUT")); | ||
64 | } | 57 | } |
65 | 58 | ||
66 | struct cmd_results *cmd_input(int argc, char **argv) { | 59 | struct cmd_results *cmd_input(int argc, char **argv) { |
diff --git a/sway/config.c b/sway/config.c index c5d892f3..8579e865 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -340,7 +340,7 @@ static void config_defaults(struct sway_config *config) { | |||
340 | 340 | ||
341 | // The keysym to keycode translation | 341 | // The keysym to keycode translation |
342 | config->keysym_translation_state = | 342 | config->keysym_translation_state = |
343 | keysym_translation_state_create(getenv("XKB_DEFAULT_LAYOUT")); | 343 | keysym_translation_state_create(NULL); |
344 | 344 | ||
345 | return; | 345 | return; |
346 | cleanup: | 346 | cleanup: |