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>
master
Ran Benita 2012-06-30 00:49:41 +03:00
parent 337c3007ac
commit 37f4384947
5 changed files with 7 additions and 30 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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),

View File

@ -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);