summaryrefslogtreecommitdiff
path: root/src/context.c
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2019-10-03 17:27:00 +0300
committerRan Benita <ran@unusedvar.com>2019-10-03 17:27:00 +0300
commit3a91788d9254b4571ff883439931f497d8a0663f (patch)
treef6f3de3f734b0a577a697de2fa6cd9c0ac4ed800 /src/context.c
parent934d5741727886fe90e9c2a4d90e63bbd2cb2226 (diff)
downloadxorg-lib-libxkbcommon-3a91788d9254b4571ff883439931f497d8a0663f.tar.gz
context: move ~/.xkb to before XKB_CONFIG_ROOT in the default include path
Previously, the default include path was XKB_CONFIG_ROOT:~/.xkb. The ~/.xkb include path is intended to allow the local user to customize their keymaps without having to modify system paths. But usually, the user only wants to customize specific parts. When XKB_CONFIG_ROOT is first, the user can only customize through the "entry point" (the RMLVO). When ~/.xkb is first, the user can drop in a file and it will override the system one. The impetus for this change is the rules file. "evdev" is hard-coded everywhere, so it not often not possible to change to something else. And the rules files determines how the rest of the RMLVO is interpreted. So, to enable customization, we have these options: A: System includes user. B: User includes system. C: Library goes over both in one or the other order. Option A is problematic due to backward compatibility and is also unnatural. Option B gives the user control and is backward compatible, so that's what we choose. This is also how Compose files are handled, and that seems to work fine in the wild. Option C is actually less flexible than B, and more complicated. (The rules file format doesn't have an include statement yet, but it's planned). Signed-off-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'src/context.c')
-rw-r--r--src/context.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/context.c b/src/context.c
index 50993e1..f43ee0a 100644
--- a/src/context.c
+++ b/src/context.c
@@ -80,12 +80,6 @@ xkb_context_include_path_append_default(struct xkb_context *ctx)
int err;
int ret = 0;
- root = secure_getenv("XKB_CONFIG_ROOT");
- if (root != NULL)
- ret |= xkb_context_include_path_append(ctx, root);
- else
- ret |= xkb_context_include_path_append(ctx, DFLT_XKB_CONFIG_ROOT);
-
home = secure_getenv("HOME");
if (!home)
return ret;
@@ -95,6 +89,12 @@ xkb_context_include_path_append_default(struct xkb_context *ctx)
ret |= xkb_context_include_path_append(ctx, user_path);
free(user_path);
+ root = secure_getenv("XKB_CONFIG_ROOT");
+ if (root != NULL)
+ ret |= xkb_context_include_path_append(ctx, root);
+ else
+ ret |= xkb_context_include_path_append(ctx, DFLT_XKB_CONFIG_ROOT);
+
return ret;
}