mirror of
https://github.com/swaywm/sway.git
synced 2024-11-25 09:21:28 +00:00
config: add fallback without env vars for keysym translation XKB keymap
This commit is contained in:
parent
fd9ab9ee06
commit
59f6292383
|
@ -37,8 +37,8 @@
|
||||||
struct sway_config *config = NULL;
|
struct sway_config *config = NULL;
|
||||||
|
|
||||||
static struct xkb_state *keysym_translation_state_create(
|
static struct xkb_state *keysym_translation_state_create(
|
||||||
struct xkb_rule_names rules) {
|
struct xkb_rule_names rules, uint32_t context_flags) {
|
||||||
struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_SECURE_GETENV);
|
struct xkb_context *context = xkb_context_new(context_flags | XKB_CONTEXT_NO_SECURE_GETENV);
|
||||||
struct xkb_keymap *xkb_keymap = xkb_keymap_new_from_names(
|
struct xkb_keymap *xkb_keymap = xkb_keymap_new_from_names(
|
||||||
context,
|
context,
|
||||||
&rules,
|
&rules,
|
||||||
|
@ -344,8 +344,11 @@ static void config_defaults(struct sway_config *config) {
|
||||||
|
|
||||||
// The keysym to keycode translation
|
// The keysym to keycode translation
|
||||||
struct xkb_rule_names rules = {0};
|
struct xkb_rule_names rules = {0};
|
||||||
config->keysym_translation_state =
|
config->keysym_translation_state = keysym_translation_state_create(rules, 0);
|
||||||
keysym_translation_state_create(rules);
|
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) {
|
if (config->keysym_translation_state == NULL) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -995,8 +998,7 @@ void translate_keysyms(struct input_config *input_config) {
|
||||||
|
|
||||||
struct xkb_rule_names rules = {0};
|
struct xkb_rule_names rules = {0};
|
||||||
input_config_fill_rule_names(input_config, &rules);
|
input_config_fill_rule_names(input_config, &rules);
|
||||||
config->keysym_translation_state =
|
config->keysym_translation_state = keysym_translation_state_create(rules, 0);
|
||||||
keysym_translation_state_create(rules);
|
|
||||||
if (config->keysym_translation_state == NULL) {
|
if (config->keysym_translation_state == NULL) {
|
||||||
sway_log(SWAY_ERROR, "Failed to create keysym translation XKB state "
|
sway_log(SWAY_ERROR, "Failed to create keysym translation XKB state "
|
||||||
"for device '%s'", input_config->identifier);
|
"for device '%s'", input_config->identifier);
|
||||||
|
|
Loading…
Reference in a new issue