dump: add back kccgst names

Readd the component names to the keymap->names struct. This is used when
printing the component, e.g.

xkb_keymap {
	xkb_keycodes "evdev+aliases(qwerty)" {

instead of

xkb_keymap {
	xkb_keycodes {

This makes diffing against xkbcomp $DISPLAY a bit easier and is kind of
useful anyway.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-07-11 16:16:20 +03:00 committed by Daniel Stone
parent 2ec0a22d55
commit f059967592
8 changed files with 53 additions and 8 deletions

View File

@ -352,6 +352,11 @@ XkbcFreeNames(struct xkb_keymap *keymap)
}
}
free(names->keycodes);
free(names->symbols);
free(names->keytypes);
free(names->compat);
for (i = 0; i < XkbNumVirtualMods; i++)
free(names->vmods[i]);
for (i = 0; i < XkbNumIndicators; i++)

View File

@ -311,7 +311,12 @@ write_keycodes(struct xkb_keymap *keymap, char **buf, size_t *size,
struct xkb_key_alias *alias;
int i;
write_buf(keymap, buf, size, offset, "\txkb_keycodes {\n");
if (keymap->names->keycodes)
write_buf(keymap, buf, size, offset, "\txkb_keycodes \"%s\" {\n",
keymap->names->keycodes);
else
write_buf(keymap, buf, size, offset, "\txkb_keycodes {\n");
write_buf(keymap, buf, size, offset, "\t\tminimum = %d;\n",
keymap->min_key_code);
write_buf(keymap, buf, size, offset, "\t\tmaximum = %d;\n",
@ -355,7 +360,12 @@ write_types(struct xkb_keymap *keymap, char **buf, size_t *size,
int n;
struct xkb_key_type *type;
write_buf(keymap, buf, size, offset, "\txkb_types {\n\n");
if (keymap->names->keytypes)
write_buf(keymap, buf, size, offset, "\txkb_types \"%s\" {\n\n",
keymap->names->keytypes);
else
write_buf(keymap, buf, size, offset, "\txkb_types {\n\n");
write_vmods(keymap, buf, size, offset);
darray_foreach(type, keymap->map->types) {
@ -632,7 +642,11 @@ write_compat(struct xkb_keymap *keymap, char **buf, size_t *size,
int i;
struct xkb_sym_interpret *interp;
write_buf(keymap, buf, size, offset, "\txkb_compatibility {\n\n");
if (keymap->names->compat)
write_buf(keymap, buf, size, offset, "\txkb_compatibility \"%s\" {\n\n",
keymap->names->compat);
else
write_buf(keymap, buf, size, offset, "\txkb_compatibility {\n\n");
write_vmods(keymap, buf, size, offset);
@ -744,7 +758,11 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
int group, tmp;
bool showActions;
write_buf(keymap, buf, size, offset, "\txkb_symbols {\n\n");
if (keymap->names->symbols)
write_buf(keymap, buf, size, offset, "\txkb_symbols \"%s\" {\n\n",
keymap->names->symbols);
else
write_buf(keymap, buf, size, offset, "\txkb_symbols {\n\n");
for (tmp = group = 0; group < XkbNumKbdGroups; group++) {
if (!keymap->names->groups[group])

View File

@ -320,6 +320,11 @@ struct xkb_key_alias {
};
struct xkb_names {
char *keycodes;
char *symbols;
char *keytypes;
char *compat;
char *vmods[XkbNumVirtualMods];
char *indicators[XkbNumIndicators];
char *groups[XkbNumKbdGroups];

View File

@ -799,6 +799,12 @@ CompileCompatMap(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge
goto err_info;
}
if (info.name) {
if (XkbcAllocNames(keymap, 0, 0) != Success)
goto err_info;
keymap->names->compat = strdup(info.name);
}
if (info.nInterps > 0) {
CopyInterps(&info, keymap->compat, true, XkbSI_Exactly);
CopyInterps(&info, keymap->compat, true, XkbSI_AllOf | XkbSI_NoneOf);

View File

@ -846,6 +846,8 @@ CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
for (i = info.computedMin; i <= info.computedMax; i++)
LongToKeyName(darray_item(info.names, i),
darray_item(keymap->names->keys, i).name);
if (info.name)
keymap->names->keycodes = strdup(info.name);
} else {
WSGO("Cannot create struct xkb_names in CompileKeycodes\n");
goto err_info;

View File

@ -1074,6 +1074,12 @@ CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
if (info.errorCount != 0)
goto err_info;
if (info.name) {
if (XkbcAllocNames(keymap, 0, 0) != Success)
goto err_info;
keymap->names->keytypes = strdup(info.name);
}
i = info.nTypes;
if ((info.stdPresent & XkbOneLevelMask) == 0)
i++;

View File

@ -2116,6 +2116,9 @@ CompileSymbols(XkbFile *file, struct xkb_keymap *keymap, enum merge_mode merge)
goto err_info;
}
if (info.name)
keymap->names->symbols = strdup(info.name);
/* now copy info into xkb. */
ApplyAliases(keymap, &info.aliases);

View File

@ -1,5 +1,5 @@
xkb_keymap {
xkb_keycodes {
xkb_keycodes "evdev+aliases(qwerty)" {
minimum = 8;
maximum = 255;
<ESC> = 9;
@ -295,7 +295,7 @@ xkb_keymap {
alias <LatM> = <AB07>;
};
xkb_types {
xkb_types "complete" {
virtual_modifiers NumLock,Alt,LevelThree,LAlt,RAlt,RControl,LControl,ScrollLock,LevelFive,AltGr,Meta,Super,Hyper;
@ -592,7 +592,7 @@ xkb_keymap {
};
};
xkb_compatibility {
xkb_compatibility "complete+caps(caps_lock):4+misc(assign_shift_left_action):4+level5(level5_lock):4" {
virtual_modifiers NumLock,Alt,LevelThree,LAlt,RAlt,RControl,LControl,ScrollLock,LevelFive,AltGr,Meta,Super,Hyper;
@ -1080,7 +1080,7 @@ xkb_keymap {
};
};
xkb_symbols {
xkb_symbols "pc+us+ru:2+ca(multix):3+de(neo):4+inet(evdev)" {
name[group1]="English (US)";
name[group2]="Russian";