rules: remove support for keymap rule This commit removes the ability to specify a keymap *in a rules file*, e.g. in /usr/share/X11/xkb/rules/evdev or somesuch. This is unused in xkeyboard-data, and the current code has never even supported it, because xkb_map_new_from_kccgst (which is no longer exposed in the API) checks to see that one of the usual components (e.g. symbols, types, ..) has been filled, while the rules parser, on the other hand, doesn't allow to specify a keymap and other stuff at the same time. ( The idea was to remove xkb_map_new_from_kccgst entirely, but it's used by a test so it can stay. ) tl;dr: dead code. Of course passing a keymap file to xkb_map_new_from_file still works. Signed-off-by: Ran Benita <ran234@gmail.com>
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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index 75f0004..1b416bc 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -112,7 +112,6 @@ enum xkb_file_type {
* Legacy names for the components of an XKB keymap, also known as KcCGST.
*/
struct xkb_component_names {
- char *keymap;
char *keycodes;
char *types;
char *compat;
diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c
index dc02cb3..6c7f4fd 100644
--- a/src/xkbcomp/rules.c
+++ b/src/xkbcomp/rules.c
@@ -140,11 +140,10 @@ enum {
TYPES,
COMPAT,
GEOMETRY,
- KEYMAP,
#define COMPONENT_MASK \
((1 << KEYCODES) | (1 << SYMBOLS) | (1 << TYPES) | (1 << COMPAT) | \
- (1 << GEOMETRY) | (1 << KEYMAP))
+ (1 << GEOMETRY))
MAX_WORDS
};
@@ -160,7 +159,6 @@ static const char *cname[] = {
[TYPES] = "types",
[COMPAT] = "compat",
[GEOMETRY] = "geometry",
- [KEYMAP] = "keymap",
};
struct multi_defs {
@@ -215,7 +213,6 @@ struct rule {
char *symbols;
char *types;
char *compat;
- char *keymap;
unsigned flags;
};
@@ -353,14 +350,6 @@ match_mapping_line(darray_char *line, struct mapping *mapping)
return;
}
- if (((present & COMPONENT_MASK) & (1 << KEYMAP)) &&
- ((present & COMPONENT_MASK) != (1 << KEYMAP))) {
- WARN("Keymap cannot appear with other components\n");
- ACTION("Illegal mapping ignored\n");
- mapping->num_maps = 0;
- return;
- }
-
mapping->number++;
}
@@ -467,7 +456,6 @@ match_rule_line(darray_char *line, struct mapping *mapping,
rule->symbols = uDupString(names[SYMBOLS]);
rule->types = uDupString(names[TYPES]);
rule->compat = uDupString(names[COMPAT]);
- rule->keymap = uDupString(names[KEYMAP]);
rule->layout_num = rule->variant_num = 0;
for (i = 0; i < nread; i++) {
@@ -652,7 +640,6 @@ apply_rule(struct rule *rule, struct xkb_component_names *kccgst)
apply(rule->symbols, &kccgst->symbols);
apply(rule->types, &kccgst->types);
apply(rule->compat, &kccgst->compat);
- apply(rule->keymap, &kccgst->keymap);
}
/*
@@ -972,12 +959,11 @@ get_components(struct rules *rules, const struct xkb_rule_names *mlvo,
kccgst->symbols = substitute_vars(kccgst->symbols, &mdefs);
kccgst->types = substitute_vars(kccgst->types, &mdefs);
kccgst->compat = substitute_vars(kccgst->compat, &mdefs);
- kccgst->keymap = substitute_vars(kccgst->keymap, &mdefs);
free_multi_defs(&mdefs);
- return (kccgst->keycodes && kccgst->symbols && kccgst->types &&
- kccgst->compat) || kccgst->keymap;
+ return
+ kccgst->keycodes && kccgst->symbols && kccgst->types && kccgst->compat;
}
static struct rules *
@@ -1036,7 +1022,6 @@ free_rules(struct rules *rules)
free(rule->symbols);
free(rule->types);
free(rule->compat);
- free(rule->keymap);
}
darray_free(rules->rules);
@@ -1082,7 +1067,6 @@ xkb_components_from_rules(struct xkb_context *ctx,
}
if (!get_components(rules, rmlvo, kccgst)) {
- free(kccgst->keymap);
free(kccgst->keycodes);
free(kccgst->types);
free(kccgst->compat);
diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c
index d105672..f041f70 100644
--- a/src/xkbcomp/xkbcomp.c
+++ b/src/xkbcomp/xkbcomp.c
@@ -59,8 +59,7 @@ XkbKeymapFileFromComponents(struct xkb_context *ctx,
(ParseCommon *)inc, 0);
AppendStmt(&keycodes->common, &symbols->common);
- return CreateXKBFile(ctx, FILE_TYPE_KEYMAP,
- ktcsg->keymap ? ktcsg->keymap : strdup(""),
+ return CreateXKBFile(ctx, FILE_TYPE_KEYMAP, strdup(""),
&keycodes->common, 0);
}
@@ -86,7 +85,6 @@ xkb_map_new_from_names(struct xkb_context *ctx,
keymap = xkb_map_new_from_kccgst(ctx, kkctgs, 0);
- free(kkctgs->keymap);
free(kkctgs->keycodes);
free(kkctgs->types);
free(kkctgs->compat);
diff --git a/test/namescomp.c b/test/namescomp.c
index 81ef369..0668e40 100644
--- a/test/namescomp.c
+++ b/test/namescomp.c
@@ -40,7 +40,6 @@ test_names(const char *keycodes, const char *types,
struct xkb_context *context;
struct xkb_keymap *keymap;
struct xkb_component_names kccgst = {
- .keymap = NULL,
.keycodes = strdup(keycodes),
.types = strdup(types),
.compat = strdup(compat),
diff --git a/test/rules-file.c b/test/rules-file.c
index 90981a2..8e301b2 100644
--- a/test/rules-file.c
+++ b/test/rules-file.c
@@ -40,7 +40,6 @@ struct test_data {
const char *options;
/* Expected output */
- const char *keymap;
const char *keycodes;
const char *types;
const char *compat;
@@ -73,7 +72,7 @@ test_rules(struct xkb_context *ctx, struct test_data *data)
if (data->should_fail)
fprintf(stderr, "Expecting: NULL\n");
else
- fprintf(stderr, "Expecting: %s\t%s\t%s\t%s\t%s\n", data->keymap,
+ fprintf(stderr, "Expecting: %s\t%s\t%s\t%s\n",
data->keycodes, data->types, data->compat, data->symbols);
kccgst = xkb_components_from_rules(ctx, &rmlvo);
@@ -82,16 +81,14 @@ test_rules(struct xkb_context *ctx, struct test_data *data)
return data->should_fail;
}
- fprintf(stderr, "Received : %s\t%s\t%s\t%s\t%s\n", kccgst->keymap,
+ fprintf(stderr, "Received : %s\t%s\t%s\t%s\n",
kccgst->keycodes, kccgst->types, kccgst->compat, kccgst->symbols);
- passed = streq(kccgst->keymap, data->keymap) &&
- streq(kccgst->keycodes, data->keycodes) &&
+ passed = streq(kccgst->keycodes, data->keycodes) &&
streq(kccgst->types, data->types) &&
streq(kccgst->compat, data->compat) &&
streq(kccgst->symbols, data->symbols);
- free(kccgst->keymap);
free(kccgst->keycodes);
free(kccgst->types);
free(kccgst->compat);