aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2024-03-05 08:47:21 +0100
committerSimon Zeni <simon@bl4ckb0ne.ca>2024-03-06 11:14:50 -0500
commit59f629238309e230b0e353e73d4f37a7de7fe820 (patch)
treee2678cab75a278229a3e1caf454971cea8705a2d
parentfd9ab9ee0659d5b4c2bd148e25b8bc6378f604d6 (diff)
config: add fallback without env vars for keysym translation XKB keymap
-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 @@
struct sway_config *config = NULL;
static struct xkb_state *keysym_translation_state_create(
- struct xkb_rule_names rules) {
- struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_SECURE_GETENV);
+ struct xkb_rule_names rules, uint32_t context_flags) {
+ struct xkb_context *context = xkb_context_new(context_flags | XKB_CONTEXT_NO_SECURE_GETENV);
struct xkb_keymap *xkb_keymap = xkb_keymap_new_from_names(
context,
&rules,
@@ -344,8 +344,11 @@ static void config_defaults(struct sway_config *config) {
// The keysym to keycode translation
struct xkb_rule_names rules = {0};
- config->keysym_translation_state =
- keysym_translation_state_create(rules);
+ config->keysym_translation_state = keysym_translation_state_create(rules, 0);
+ if (config->keysym_translation_state == NULL) {
+ config->keysym_translation_state = keysym_translation_state_create(rules,
+ XKB_CONTEXT_NO_ENVIRONMENT_NAMES);
+ }
if (config->keysym_translation_state == NULL) {
goto cleanup;
}
@@ -995,8 +998,7 @@ void translate_keysyms(struct input_config *input_config) {
struct xkb_rule_names rules = {0};
input_config_fill_rule_names(input_config, &rules);
- config->keysym_translation_state =
- keysym_translation_state_create(rules);
+ config->keysym_translation_state = keysym_translation_state_create(rules, 0);
if (config->keysym_translation_state == NULL) {
sway_log(SWAY_ERROR, "Failed to create keysym translation XKB state "
"for device '%s'", input_config->identifier);