int i;
for (i = 0; i < XkbNumVirtualMods; i++) {
- if (!keymap->names->vmods[i])
+ if (!keymap->vmod_names[i])
continue;
if (num_vmods == 0)
write_buf(keymap, buf, size, offset, "\t\tvirtual_modifiers ");
else
write_buf(keymap, buf, size, offset, ",");
- write_buf(keymap, buf, size, offset, "%s", keymap->names->vmods[i]);
+ write_buf(keymap, buf, size, offset, "%s", keymap->vmod_names[i]);
num_vmods++;
}
continue;
if (ret[0] != '\0') {
strcpy(ret2, ret);
- append_get_text("%s+%s", ret2, keymap->names->vmods[i]);
+ append_get_text("%s+%s", ret2, keymap->vmod_names[i]);
}
else {
- append_get_text("%s", keymap->names->vmods[i]);
+ append_get_text("%s", keymap->vmod_names[i]);
}
}
write_keycodes(struct xkb_keymap *keymap, char **buf, size_t *size,
size_t *offset)
{
- xkb_keycode_t key;
+ struct xkb_key *key;
struct xkb_key_alias *alias;
int i;
- if (keymap->names->keycodes)
+ if (keymap->keycodes_section_name)
write_buf(keymap, buf, size, offset, "\txkb_keycodes \"%s\" {\n",
- keymap->names->keycodes);
+ keymap->keycodes_section_name);
else
write_buf(keymap, buf, size, offset, "\txkb_keycodes {\n");
write_buf(keymap, buf, size, offset, "\t\tmaximum = %d;\n",
keymap->max_key_code);
- for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
- if (darray_item(keymap->names->keys, key).name[0] == '\0')
+ xkb_foreach_key(key, keymap) {
+ if (key->name[0] == '\0')
continue;
write_buf(keymap, buf, size, offset, "\t\t%6s = %d;\n",
- XkbcKeyNameText(darray_item(keymap->names->keys, key).name),
- key);
+ XkbcKeyNameText(key->name), XkbKeyGetKeycode(keymap, key));
}
for (i = 0; i < XkbNumIndicators; i++) {
- if (!keymap->names->indicators[i])
+ if (!keymap->indicator_names[i])
continue;
write_buf(keymap, buf, size, offset, "\t\tindicator %d = \"%s\";\n",
- i + 1, keymap->names->indicators[i]);
+ i + 1, keymap->indicator_names[i]);
}
- darray_foreach(alias, keymap->names->key_aliases)
- write_buf(keymap, buf, size, offset, "\t\talias %6s = %6s;\n",
- XkbcKeyNameText(alias->alias),
- XkbcKeyNameText(alias->real));
+
+ darray_foreach(alias, keymap->key_aliases)
+ write_buf(keymap, buf, size, offset, "\t\talias %6s = %6s;\n",
+ XkbcKeyNameText(alias->alias),
+ XkbcKeyNameText(alias->real));
write_buf(keymap, buf, size, offset, "\t};\n\n");
return true;
int n;
struct xkb_key_type *type;
- if (keymap->names->keytypes)
+ if (keymap->types_section_name)
write_buf(keymap, buf, size, offset, "\txkb_types \"%s\" {\n\n",
- keymap->names->keytypes);
+ keymap->types_section_name);
else
write_buf(keymap, buf, size, offset, "\txkb_types {\n\n");
write_indicator_map(struct xkb_keymap *keymap, char **buf, size_t *size,
size_t *offset, int num)
{
- struct xkb_indicator_map *led = &keymap->indicators->maps[num];
+ struct xkb_indicator_map *led = &keymap->indicators[num];
write_buf(keymap, buf, size, offset, "\t\tindicator \"%s\" {\n",
- keymap->names->indicators[num]);
+ keymap->indicator_names[num]);
if (led->which_groups) {
if (led->which_groups != XkbIM_UseEffective) {
int i;
struct xkb_sym_interpret *interp;
- if (keymap->names->compat)
+ if (keymap->compat_section_name)
write_buf(keymap, buf, size, offset,
"\txkb_compatibility \"%s\" {\n\n",
- keymap->names->compat);
+ keymap->compat_section_name);
else
write_buf(keymap, buf, size, offset, "\txkb_compatibility {\n\n");
if (interp->virtual_mod != XkbNoModifier) {
write_buf(keymap, buf, size, offset,
"\t\t\tvirtualModifier= %s;\n",
- keymap->names->vmods[interp->virtual_mod]);
+ keymap->vmod_names[interp->virtual_mod]);
}
if (interp->match & XkbSI_LevelOneOnly)
}
for (i = 0; i < XkbNumIndicators; i++) {
- struct xkb_indicator_map *map = &keymap->indicators->maps[i];
+ struct xkb_indicator_map *map = &keymap->indicators[i];
if (map->flags == 0 && map->which_groups == 0 &&
map->groups == 0 && map->which_mods == 0 &&
map->mods.real_mods == 0 && map->mods.vmods == 0 &&
static bool
write_keysyms(struct xkb_keymap *keymap, char **buf, size_t *size,
- size_t *offset, xkb_keycode_t key, unsigned int group)
+ size_t *offset, struct xkb_key *key, unsigned int group)
{
const xkb_keysym_t *syms;
int num_syms, level;
write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
size_t *offset)
{
- xkb_keycode_t key;
+ struct xkb_key *key;
int group, tmp;
bool showActions;
- if (keymap->names->symbols)
+ if (keymap->symbols_section_name)
write_buf(keymap, buf, size, offset, "\txkb_symbols \"%s\" {\n\n",
- keymap->names->symbols);
+ keymap->symbols_section_name);
else
write_buf(keymap, buf, size, offset, "\txkb_symbols {\n\n");
for (tmp = group = 0; group < XkbNumKbdGroups; group++) {
- if (!keymap->names->groups[group])
+ if (!keymap->group_names[group])
continue;
write_buf(keymap, buf, size, offset,
"\t\tname[group%d]=\"%s\";\n", group + 1,
- keymap->names->groups[group]);
+ keymap->group_names[group]);
tmp++;
}
if (tmp > 0)
write_buf(keymap, buf, size, offset, "\n");
- for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
+ xkb_foreach_key(key, keymap) {
bool simple = true;
- if (xkb_key_num_groups(keymap, key) == 0)
+ if (key->num_groups == 0)
continue;
write_buf(keymap, buf, size, offset, "\t\tkey %6s {",
- XkbcKeyNameText(darray_item(keymap->names->keys, key).name));
- if (keymap->explicit) {
- if ((keymap->explicit[key] & XkbExplicitKeyTypesMask)) {
- bool multi_type = false;
- int type = XkbKeyTypeIndex(keymap, key, 0);
-
- simple = false;
-
- for (group = 0; group < xkb_key_num_groups(keymap, key);
- group++) {
- if (XkbKeyTypeIndex(keymap, key, group) != type) {
- multi_type = true;
- break;
- }
- }
- if (multi_type) {
- for (group = 0;
- group < xkb_key_num_groups(keymap, key);
- group++) {
- if (!(keymap->explicit[key] & (1 << group)))
- continue;
- type = XkbKeyTypeIndex(keymap, key, group);
- write_buf(keymap, buf, size, offset,
- "\n\t\t\ttype[group%d]= \"%s\",",
- group + 1,
- darray_item(keymap->types, type).name);
- }
+ XkbcKeyNameText(key->name));
+
+ if (key->explicit & XkbExplicitKeyTypesMask) {
+ bool multi_type = false;
+ int type = XkbKeyTypeIndex(key, 0);
+
+ simple = false;
+
+ for (group = 0; group < key->num_groups; group++) {
+ if (XkbKeyTypeIndex(key, group) != type) {
+ multi_type = true;
+ break;
}
- else {
+ }
+
+ if (multi_type) {
+ for (group = 0; group < key->num_groups; group++) {
+ if (!(key->explicit & (1 << group)))
+ continue;
+ type = XkbKeyTypeIndex(key, group);
write_buf(keymap, buf, size, offset,
- "\n\t\t\ttype= \"%s\",",
+ "\n\t\t\ttype[group%d]= \"%s\",",
+ group + 1,
darray_item(keymap->types, type).name);
}
}
- if (keymap->ctrls &&
- (keymap->explicit[key] & XkbExplicitAutoRepeatMask)) {
- if (keymap->ctrls->per_key_repeat[key / 8] & (1 << (key % 8)))
- write_buf(keymap, buf, size, offset,
- "\n\t\t\trepeat= Yes,");
- else
- write_buf(keymap, buf, size, offset,
- "\n\t\t\trepeat= No,");
- simple = false;
- }
- if (keymap->vmodmap[key] &&
- (keymap->explicit[key] & XkbExplicitVModMapMask)) {
+ else {
write_buf(keymap, buf, size, offset,
- "\n\t\t\tvirtualMods= %s,",
- get_mod_mask_text(keymap, 0, keymap->vmodmap[key]));
+ "\n\t\t\ttype= \"%s\",",
+ darray_item(keymap->types, type).name);
}
}
- switch (XkbOutOfRangeGroupAction(XkbKeyGroupInfo(keymap, key))) {
+ if (key->explicit & XkbExplicitAutoRepeatMask) {
+ if (key->repeats)
+ write_buf(keymap, buf, size, offset,
+ "\n\t\t\trepeat= Yes,");
+ else
+ write_buf(keymap, buf, size, offset,
+ "\n\t\t\trepeat= No,");
+ simple = false;
+ }
+
+ if (key->vmodmap && (key->explicit & XkbExplicitVModMapMask)) {
+ write_buf(keymap, buf, size, offset, "\n\t\t\tvirtualMods= %s,",
+ get_mod_mask_text(keymap, 0, key->vmodmap));
+ }
+
+ switch (key->out_of_range_group_action) {
case XkbClampIntoRange:
write_buf(keymap, buf, size, offset, "\n\t\t\tgroupsClamp,");
break;
case XkbRedirectIntoRange:
write_buf(keymap, buf, size, offset,
"\n\t\t\tgroupsRedirect= Group%d,",
- XkbOutOfRangeGroupNumber(XkbKeyGroupInfo(keymap,
- key)) + 1);
+ key->out_of_range_group_number + 1);
break;
}
- if (keymap->explicit == NULL ||
- (keymap->explicit[key] & XkbExplicitInterpretMask))
- showActions = XkbKeyHasActions(keymap, key);
+ if (key->explicit & XkbExplicitInterpretMask)
+ showActions = XkbKeyHasActions(key);
else
showActions = false;
- if (xkb_key_num_groups(keymap, key) > 1 || showActions)
+ if (key->num_groups > 1 || showActions)
simple = false;
if (simple) {
int level;
acts = XkbKeyActionsPtr(keymap, key);
- for (group = 0; group < xkb_key_num_groups(keymap, key);
- group++) {
+ for (group = 0; group < key->num_groups; group++) {
if (group != 0)
write_buf(keymap, buf, size, offset, ",");
write_buf(keymap, buf, size, offset,
NULL, NULL);
}
write_buf(keymap, buf, size, offset, " ]");
- acts += XkbKeyGroupsWidth(keymap, key);
+ acts += key->width;
}
}
write_buf(keymap, buf, size, offset, "\n\t\t};\n");
}
}
- if (keymap->modmap) {
- for (key = keymap->min_key_code; key <= keymap->max_key_code;
- key++) {
- int mod;
- if (keymap->modmap[key] == 0)
- continue;
+ xkb_foreach_key(key, keymap) {
+ int mod;
- for (mod = 0; mod < XkbNumModifiers; mod++) {
- if (!(keymap->modmap[key] & (1 << mod)))
- continue;
+ if (key->modmap == 0)
+ continue;
- write_buf(keymap, buf, size, offset,
- "\t\tmodifier_map %s { %s };\n",
- get_mod_index_text(mod),
- XkbcKeyNameText(darray_item(keymap->names->keys,
- key).name));
- }
+ for (mod = 0; mod < XkbNumModifiers; mod++) {
+ if (!(key->modmap & (1 << mod)))
+ continue;
+
+ write_buf(keymap, buf, size, offset,
+ "\t\tmodifier_map %s { %s };\n",
+ get_mod_index_text(mod),
+ XkbcKeyNameText(key->name));
}
}