1 From 999a419f4b36764a7269650a7f965d48bd4b73f7 Mon Sep 17 00:00:00 2001
2 From: Louis Bettens <louis@bettens.info>
3 Date: Sat, 28 Dec 2019 14:30:58 +0100
4 Subject: [PATCH] honor $XKB_CONFIG_ROOT
7 libxklavier/xklavier_config_xkb.c | 30 +++++++++++++++++++++++++-----
8 1 file changed, 25 insertions(+), 5 deletions(-)
10 diff --git a/libxklavier/xklavier_config_xkb.c b/libxklavier/xklavier_config_xkb.c
11 index baec569..00e8de5 100644
12 --- a/libxklavier/xklavier_config_xkb.c
13 +++ b/libxklavier/xklavier_config_xkb.c
16 #include <X11/keysymdef.h>
19 +xkl_xkb_get_base_path(void)
21 + const gchar *base_path;
23 + base_path = g_getenv ("XKB_CONFIG_ROOT");
25 + base_path = XKB_BASE;
30 #ifdef LIBXKBFILE_PRESENT
31 static XkbRF_RulesPtr xkl_rules;
33 @@ -65,7 +77,8 @@ xkl_rules_set_load(XklEngine * engine)
35 locale = setlocale(LC_ALL, NULL);
37 - g_snprintf(file_name, sizeof file_name, XKB_BASE "/rules/%s", rf);
38 + g_snprintf(file_name, sizeof file_name, "%s/rules/%s",
39 + xkl_xkb_get_base_path(), rf);
40 xkl_debug(160, "Loading rules from [%s]\n", file_name);
42 rules_set = XkbRF_Load(file_name, locale, True, True);
43 @@ -98,10 +111,14 @@ gboolean
44 xkl_xkb_load_config_registry(XklConfigRegistry * config,
45 gboolean if_extras_needed)
47 - return xkl_config_registry_load_helper(config,
48 + const gchar *rules_path = g_strdup_printf("%s/rules",
49 + xkl_xkb_get_base_path());
50 + gboolean ok = xkl_config_registry_load_helper(config,
59 #ifdef LIBXKBFILE_PRESENT
60 @@ -249,6 +266,7 @@ xkl_config_get_keyboard(XklEngine * engine,
66 xkl_debug(150, "tmp XKB/XKM file names: [%s]/[%s]\n",
68 @@ -296,14 +314,16 @@ xkl_config_get_keyboard(XklEngine * engine,
72 + opt_I = g_strdup_printf("-I%s", xkl_xkb_get_base_path());
73 xkl_debug(160, "Executing %s\n", XKBCOMP);
74 xkl_debug(160, "%s %s %s %s %s %s %s %s\n",
75 XKBCOMP, XKBCOMP, "-w0", "-I",
76 - "-I" XKB_BASE, "-xkm", xkb_fn,
77 + opt_I, "-xkm", xkb_fn,
79 execl(XKBCOMP, XKBCOMP, "-w0", "-I",
80 - "-I" XKB_BASE, "-xkm", xkb_fn,
81 + opt_I, "-xkm", xkb_fn,
84 xkl_debug(0, "Could not exec %s: %d\n",