diff options
author | Konstantin Pospelov <kupospelov@gmail.com> | 2019-02-20 14:54:59 +0300 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-04-26 20:56:48 +0300 |
commit | ddf63ffabefd740bf2afa1addaf6e859d65aba6a (patch) | |
tree | d9bbf2dbe7ade0b7c4121a3afcaa2bfd4b5488f9 /sway/input | |
parent | bindsym: update the man page to include --to-code (diff) | |
download | sway-ddf63ffabefd740bf2afa1addaf6e859d65aba6a.tar.gz sway-ddf63ffabefd740bf2afa1addaf6e859d65aba6a.tar.zst sway-ddf63ffabefd740bf2afa1addaf6e859d65aba6a.zip |
bindsym: consider xkb_rule_names for --to-code
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/keyboard.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index 5a965185..04b8b0ce 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c | |||
@@ -477,39 +477,31 @@ struct sway_keyboard *sway_keyboard_create(struct sway_seat *seat, | |||
477 | } | 477 | } |
478 | 478 | ||
479 | void sway_keyboard_configure(struct sway_keyboard *keyboard) { | 479 | void sway_keyboard_configure(struct sway_keyboard *keyboard) { |
480 | struct xkb_rule_names rules; | ||
481 | memset(&rules, 0, sizeof(rules)); | ||
482 | struct input_config *input_config = | 480 | struct input_config *input_config = |
483 | input_device_get_config(keyboard->seat_device->input_device); | 481 | input_device_get_config(keyboard->seat_device->input_device); |
484 | struct wlr_input_device *wlr_device = | 482 | struct wlr_input_device *wlr_device = |
485 | keyboard->seat_device->input_device->wlr_device; | 483 | keyboard->seat_device->input_device->wlr_device; |
486 | 484 | ||
487 | if (input_config && input_config->xkb_layout) { | 485 | struct xkb_rule_names rules; |
488 | rules.layout = input_config->xkb_layout; | 486 | if (input_config) { |
487 | rules = input_config_get_rule_names(input_config); | ||
489 | } else { | 488 | } else { |
489 | memset(&rules, 0, sizeof(rules)); | ||
490 | } | ||
491 | |||
492 | if (!rules.layout) { | ||
490 | rules.layout = getenv("XKB_DEFAULT_LAYOUT"); | 493 | rules.layout = getenv("XKB_DEFAULT_LAYOUT"); |
491 | } | 494 | } |
492 | if (input_config && input_config->xkb_model) { | 495 | if (!rules.model) { |
493 | rules.model = input_config->xkb_model; | ||
494 | } else { | ||
495 | rules.model = getenv("XKB_DEFAULT_MODEL"); | 496 | rules.model = getenv("XKB_DEFAULT_MODEL"); |
496 | } | 497 | } |
497 | 498 | if (!rules.options) { | |
498 | if (input_config && input_config->xkb_options) { | ||
499 | rules.options = input_config->xkb_options; | ||
500 | } else { | ||
501 | rules.options = getenv("XKB_DEFAULT_OPTIONS"); | 499 | rules.options = getenv("XKB_DEFAULT_OPTIONS"); |
502 | } | 500 | } |
503 | 501 | if (!rules.rules) { | |
504 | if (input_config && input_config->xkb_rules) { | ||
505 | rules.rules = input_config->xkb_rules; | ||
506 | } else { | ||
507 | rules.rules = getenv("XKB_DEFAULT_RULES"); | 502 | rules.rules = getenv("XKB_DEFAULT_RULES"); |
508 | } | 503 | } |
509 | 504 | if (!rules.variant) { | |
510 | if (input_config && input_config->xkb_variant) { | ||
511 | rules.variant = input_config->xkb_variant; | ||
512 | } else { | ||
513 | rules.variant = getenv("XKB_DEFAULT_VARIANT"); | 505 | rules.variant = getenv("XKB_DEFAULT_VARIANT"); |
514 | } | 506 | } |
515 | 507 | ||