aboutsummaryrefslogtreecommitdiffstats
path: root/sway
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2024-03-05 08:47:21 +0100
committerLibravatar Simon Zeni <simon@bl4ckb0ne.ca>2024-03-06 11:14:50 -0500
commit59f629238309e230b0e353e73d4f37a7de7fe820 (patch)
treee2678cab75a278229a3e1caf454971cea8705a2d /sway
parentconfig: error out on keysym translation XKB state failure (diff)
downloadsway-59f629238309e230b0e353e73d4f37a7de7fe820.tar.gz
sway-59f629238309e230b0e353e73d4f37a7de7fe820.tar.zst
sway-59f629238309e230b0e353e73d4f37a7de7fe820.zip
config: add fallback without env vars for keysym translation XKB keymap
Diffstat (limited to 'sway')
-rw-r--r--sway/config.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sway/config.c b/sway/config.c
index d46b81ee..72fc41e7 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -37,8 +37,8 @@
37struct sway_config *config = NULL; 37struct sway_config *config = NULL;
38 38
39static struct xkb_state *keysym_translation_state_create( 39static struct xkb_state *keysym_translation_state_create(
40 struct xkb_rule_names rules) { 40 struct xkb_rule_names rules, uint32_t context_flags) {
41 struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_SECURE_GETENV); 41 struct xkb_context *context = xkb_context_new(context_flags | XKB_CONTEXT_NO_SECURE_GETENV);
42 struct xkb_keymap *xkb_keymap = xkb_keymap_new_from_names( 42 struct xkb_keymap *xkb_keymap = xkb_keymap_new_from_names(
43 context, 43 context,
44 &rules, 44 &rules,
@@ -344,8 +344,11 @@ static void config_defaults(struct sway_config *config) {
344 344
345 // The keysym to keycode translation 345 // The keysym to keycode translation
346 struct xkb_rule_names rules = {0}; 346 struct xkb_rule_names rules = {0};
347 config->keysym_translation_state = 347 config->keysym_translation_state = keysym_translation_state_create(rules, 0);
348 keysym_translation_state_create(rules); 348 if (config->keysym_translation_state == NULL) {
349 config->keysym_translation_state = keysym_translation_state_create(rules,
350 XKB_CONTEXT_NO_ENVIRONMENT_NAMES);
351 }
349 if (config->keysym_translation_state == NULL) { 352 if (config->keysym_translation_state == NULL) {
350 goto cleanup; 353 goto cleanup;
351 } 354 }
@@ -995,8 +998,7 @@ void translate_keysyms(struct input_config *input_config) {
995 998
996 struct xkb_rule_names rules = {0}; 999 struct xkb_rule_names rules = {0};
997 input_config_fill_rule_names(input_config, &rules); 1000 input_config_fill_rule_names(input_config, &rules);
998 config->keysym_translation_state = 1001 config->keysym_translation_state = keysym_translation_state_create(rules, 0);
999 keysym_translation_state_create(rules);
1000 if (config->keysym_translation_state == NULL) { 1002 if (config->keysym_translation_state == NULL) {
1001 sway_log(SWAY_ERROR, "Failed to create keysym translation XKB state " 1003 sway_log(SWAY_ERROR, "Failed to create keysym translation XKB state "
1002 "for device '%s'", input_config->identifier); 1004 "for device '%s'", input_config->identifier);