Change CompileKeymapFromRules to take XkbRMLVOSet Let's use a nice interface now that it's available from XKBrulescommon.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
diff --git a/include/X11/extensions/XKBcommon.h b/include/X11/extensions/XKBcommon.h
index 39679f3..ebac78e 100644
--- a/include/X11/extensions/XKBcommon.h
+++ b/include/X11/extensions/XKBcommon.h
@@ -126,7 +126,7 @@ typedef struct _XkbcDesc {
_XFUNCPROTOBEGIN
extern XkbcDescPtr
-XkbcCompileKeymapFromRules(const char *rules, XkbRF_VarDefsPtr defs);
+XkbcCompileKeymapFromRules(XkbRMLVOSet *rmlvo);
extern XkbcDescPtr
XkbcCompileKeymapFromComponents(XkbComponentNamesPtr ktcsg);
diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c
index 05cb7ad..a9db543 100644
--- a/src/xkbcomp/xkbcomp.c
+++ b/src/xkbcomp/xkbcomp.c
@@ -111,29 +111,35 @@ fail:
}
XkbcDescPtr
-XkbcCompileKeymapFromRules(const char *rules, XkbRF_VarDefsPtr defs)
+XkbcCompileKeymapFromRules(XkbRMLVOSet *rmlvo)
{
char rulesPath[PATH_MAX];
int pathlen;
+ XkbRF_VarDefsRec defs;
XkbComponentNamesPtr names;
XkbcDescPtr xkb;
- if (ISEMPTY(rules) || !defs || ISEMPTY(defs->layout)) {
+ if (!rmlvo || ISEMPTY(rmlvo->rules) || ISEMPTY(rmlvo->layout)) {
ERROR("rules and layout required to generate XKB keymap\n");
return NULL;
}
pathlen = snprintf(rulesPath, sizeof(rulesPath),
- DFLT_XKB_CONFIG_ROOT "/rules/%s", rules);
+ DFLT_XKB_CONFIG_ROOT "/rules/%s", rmlvo->rules);
if (pathlen >= sizeof(rulesPath)) {
ERROR("XKB rules path truncated\n");
return NULL;
}
- names = XkbComponentsFromRules(rulesPath, defs);
+ defs.model = rmlvo->model;
+ defs.layout = rmlvo->layout;
+ defs.variant = rmlvo->variant;
+ defs.options = rmlvo->options;
+
+ names = XkbComponentsFromRules(rulesPath, &defs);
if (!names) {
ERROR("failed to generate XKB components from rules \"%s\"\n",
- rules);
+ rmlvo->rules);
return NULL;
}
diff --git a/test/rulescomp.c b/test/rulescomp.c
index 01aecc7..4dbe353 100644
--- a/test/rulescomp.c
+++ b/test/rulescomp.c
@@ -34,8 +34,7 @@ authorization from the authors.
int main(int argc, char *argv[])
{
- char *rules = NULL;
- XkbRF_VarDefsRec defs;
+ XkbRMLVOSet rmlvo;
XkbcDescPtr xkb;
/* Require rmlvo */
@@ -46,16 +45,16 @@ int main(int argc, char *argv[])
exit(1);
}
- rules = argv[1];
- defs.model = argv[2];
- defs.layout = argv[3];
- defs.variant = argv[4];
- defs.options = argv[5];
+ rmlvo.rules = argv[1];
+ rmlvo.model = argv[2];
+ rmlvo.layout = argv[3];
+ rmlvo.variant = argv[4];
+ rmlvo.options = argv[5];
uSetErrorFile(NULL);
XkbcInitAtoms();
- xkb = XkbcCompileKeymapFromRules(rules, &defs);
+ xkb = XkbcCompileKeymapFromRules(&rmlvo);
if (!xkb) {
fprintf(stderr, "Failed to compile keymap\n");