1 /************************************************************
2 * Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
4 * Permission to use, copy, modify, and distribute this
5 * software and its documentation for any purpose and without
6 * fee is hereby granted, provided that the above copyright
7 * notice appear in all copies and that both that copyright
8 * notice and this permission notice appear in supporting
9 * documentation, and that the name of Silicon Graphics not be
10 * used in advertising or publicity pertaining to distribution
11 * of the software without specific prior written permission.
12 * Silicon Graphics makes no representation about the suitability
13 * of this software for any purpose. It is provided "as is"
14 * without any express or implied warranty.
16 * SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18 * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
19 * GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
20 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
22 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
23 * THE USE OR PERFORMANCE OF THIS SOFTWARE.
25 ********************************************************/
27 #include "xkbcomp-priv.h"
34 * The xkb_types section
35 * =====================
36 * This section is the second to be processesed, after xkb_keycodes.
37 * However, it is completely independent and could have been the first
38 * to be processed (it does not refer to specific keys as specified in
39 * the xkb_keycodes section).
41 * This section defines key types, which, given a key and a keyboard
42 * state (i.e. modifier state and group), determine the shift level to
43 * be used in translating the key to keysyms. These types are assigned
44 * to each group in each key, in the xkb_symbols section.
46 * Key types are called this way because, in a way, they really describe
47 * the "type" of the key (or more correctly, a specific group of the
48 * key). For example, an ordinary keymap will provide a type called
49 * "KEYPAD", which consists of two levels, with the second level being
50 * chosen according to the state of the Num Lock (or Shift) modifiers.
51 * Another example is a type called "ONE_LEVEL", which is usually
52 * assigned to keys such as Escape; these have just one level and are
53 * not affected by the modifier state. Yet more common examples are
54 * "TWO_LEVEL" (with Shift choosing the second level), "ALPHABETIC"
55 * (where Caps Lock may also choose the second level), etc.
59 * Statements of the form:
60 * type "FOUR_LEVEL" { ... }
62 * The above would create a new type named "FOUR_LEVEL".
63 * The body of the definition may include statements of the following
66 * - level_name statements (mandatory for each level in the type):
67 * level_name[Level1] = "Base";
69 * Gives each level in this type a descriptive name. It isn't used
71 * Note: A level may be specified as Level[1-8] or just a number (can
74 * - modifiers statement (mandatory, should be specified only once):
75 * modifiers = Shift+Lock+LevelThree;
77 * A mask of real and virtual modifiers. These are the only modifiers
78 * being considered when matching the modifier state against the type.
79 * The other modifiers, whether active or not, are masked out in the
82 * - map entry statements (should have at least as many mappings as there
83 * are levels in the type):
84 * map[Shift+LevelThree] = Level4;
86 * If the active modifiers, masked with the type's modifiers (as stated
87 * above), match (i.e. equal) the modifiers inside the map[] statement,
88 * then the level in the right hand side is chosen. For example, in the
89 * above, if in the current keyboard state the Shift and LevelThree
90 * modifiers are active, while the Lock modifier is not, then the
91 * keysym(s) in the 4th level of the group will be returned to the
94 * - preserve statements:
95 * map[Shift+Lock+LevelThree] = Level5;
96 * preserve[Shift+Lock+LevelThree] = Lock;
98 * When a map entry matches the active modifiers and the level it
99 * specified is chosen, then these modifiers are said to be "consumed";
100 * for example, in a simple US keymap where the "g" key is assigned an
101 * ordinary ALPHABETIC key type, if the Lock (Caps Lock) modifier is
102 * active and the key is pressed, then a "G" keysym is produced (as
103 * opposed to lower-case "g"). This is because the type definition has
104 * a map entry like the following:
105 * map[Lock] = Level2;
106 * And as such the Lock modifier is consumed. This information is
107 * relevant for applications which further process the modifiers,
108 * since by then the consumed modifiers have already "done their part"
109 * and should be masked out.
111 * However, sometimes even if a modifier is actually used to choose
112 * the shift level (as Lock above), it should *not* be reported as
113 * consumed, for various reasons. In this case, a preserve[] statement
114 * can be used to augment the map entry. The modifiers inside the square
115 * brackets should match one of the map[] statements in the type. The
116 * right hand side should consists of modifiers from the left hand
117 * side; these modifiers are then "preserved" and not reported as
120 * Virtual modifier statements
121 * ---------------------------
122 * Statements of the form:
123 * virtual_modifiers LControl;
125 * Can appear in the xkb_types, xkb_compat, xkb_symbols sections.
130 * After all of the xkb_types sections have been compiled, the following
131 * members of struct xkb_keymap are finalized:
132 * struct xkb_key_type *types;
133 * unsigned int num_types;
134 * char *types_section_name;
135 * TODO: virtual modifiers.
139 TYPE_FIELD_MASK = (1 << 0),
140 TYPE_FIELD_MAP = (1 << 1),
141 TYPE_FIELD_PRESERVE = (1 << 2),
142 TYPE_FIELD_LEVEL_NAME = (1 << 3),
145 typedef struct _KeyTypeInfo {
146 enum type_field defined;
148 enum merge_mode merge;
153 xkb_level_index_t num_levels;
154 darray(struct xkb_kt_map_entry) entries;
155 darray(xkb_atom_t) level_names;
158 typedef struct _KeyTypesInfo {
165 struct xkb_keymap *keymap;
168 /***====================================================================***/
170 static inline const char *
171 MapEntryTxt(KeyTypesInfo *info, struct xkb_kt_map_entry *entry)
173 return VModMaskText(info->keymap, entry->mods.mods);
176 static inline const char *
177 TypeTxt(KeyTypesInfo *info, KeyTypeInfo *type)
179 return xkb_atom_text(info->keymap->ctx, type->name);
182 static inline const char *
183 TypeMaskTxt(KeyTypesInfo *info, KeyTypeInfo *type)
185 return VModMaskText(info->keymap, type->mods);
189 ReportTypeShouldBeArray(KeyTypesInfo *info, KeyTypeInfo *type,
192 return ReportShouldBeArray(info->keymap, "key type", field,
193 TypeTxt(info, type));
197 ReportTypeBadType(KeyTypesInfo *info, KeyTypeInfo *type,
198 const char *field, const char *wanted)
200 return ReportBadType(info->keymap->ctx, "key type", field,
201 TypeTxt(info, type), wanted);
205 ReportTypeBadWidth(KeyTypesInfo *info, const char *type, int has, int needs)
207 log_err(info->keymap->ctx,
208 "Key type \"%s\" has %d levels, must have %d; "
209 "Illegal type definition ignored\n",
214 /***====================================================================***/
217 InitKeyTypesInfo(KeyTypesInfo *info, struct xkb_keymap *keymap,
220 info->name = strdup("default");
221 info->errorCount = 0;
223 list_init(&info->types);
224 info->file_id = file_id;
225 InitVModInfo(&info->vmods, keymap);
226 info->keymap = keymap;
230 FreeKeyTypeInfo(KeyTypeInfo * type)
232 darray_free(type->entries);
233 darray_free(type->level_names);
237 FreeKeyTypesInfo(KeyTypesInfo * info)
239 KeyTypeInfo *type, *next_type;
242 list_foreach_safe(type, next_type, &info->types, entry) {
243 FreeKeyTypeInfo(type);
249 NextKeyType(KeyTypesInfo * info)
253 type = calloc(1, sizeof(*type));
257 type->file_id = info->file_id;
259 list_append(&type->entry, &info->types);
265 FindMatchingKeyType(KeyTypesInfo *info, xkb_atom_t name)
269 list_foreach(old, &info->types, entry)
270 if (old->name == name)
277 AddKeyType(KeyTypesInfo *info, KeyTypeInfo *new)
281 int verbosity = xkb_get_log_verbosity(info->keymap->ctx);
283 old = FindMatchingKeyType(info, new->name);
285 if (new->merge == MERGE_REPLACE || new->merge == MERGE_OVERRIDE) {
286 if ((old->file_id == new->file_id && verbosity > 0) ||
288 log_warn(info->keymap->ctx,
289 "Multiple definitions of the %s key type; "
290 "Earlier definition ignored\n",
291 xkb_atom_text(info->keymap->ctx, new->name));
295 FreeKeyTypeInfo(old);
298 darray_init(new->entries);
299 darray_init(new->level_names);
303 if (old->file_id == new->file_id)
304 log_lvl(info->keymap->ctx, 4,
305 "Multiple definitions of the %s key type; "
306 "Later definition ignored\n",
307 xkb_atom_text(info->keymap->ctx, new->name));
309 FreeKeyTypeInfo(new);
313 old = NextKeyType(info);
320 darray_init(new->entries);
321 darray_init(new->level_names);
325 /***====================================================================***/
328 MergeIncludedKeyTypes(KeyTypesInfo *into, KeyTypesInfo *from,
329 enum merge_mode merge)
331 KeyTypeInfo *type, *next_type;
333 if (from->errorCount > 0) {
334 into->errorCount += from->errorCount;
338 if (into->name == NULL) {
339 into->name = from->name;
343 list_foreach_safe(type, next_type, &from->types, entry) {
344 type->merge = (merge == MERGE_DEFAULT ? type->merge : merge);
345 if (!AddKeyType(into, type))
351 HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge);
354 HandleIncludeKeyTypes(KeyTypesInfo *info, IncludeStmt *stmt)
356 enum merge_mode merge = MERGE_DEFAULT;
358 KeyTypesInfo included, next_incl;
360 InitKeyTypesInfo(&included, info->keymap, info->file_id);
363 included.name = stmt->stmt;
367 for (; stmt; stmt = stmt->next_incl) {
368 if (!ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_TYPES,
370 info->errorCount += 10;
371 FreeKeyTypesInfo(&included);
375 InitKeyTypesInfo(&next_incl, info->keymap, rtrn->id);
377 HandleKeyTypesFile(&next_incl, rtrn, merge);
379 MergeIncludedKeyTypes(&included, &next_incl, merge);
381 FreeKeyTypesInfo(&next_incl);
385 MergeIncludedKeyTypes(info, &included, merge);
386 FreeKeyTypesInfo(&included);
388 return (info->errorCount == 0);
391 /***====================================================================***/
394 SetModifiers(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
400 log_warn(info->keymap->ctx,
401 "The modifiers field of a key type is not an array; "
402 "Illegal array subscript ignored\n");
404 /* get modifier mask for current type */
405 if (!ExprResolveVModMask(info->keymap, value, &mods)) {
406 log_err(info->keymap->ctx,
407 "Key type mask field must be a modifier mask; "
408 "Key type definition ignored\n");
412 if (type->defined & TYPE_FIELD_MASK) {
413 log_warn(info->keymap->ctx,
414 "Multiple modifier mask definitions for key type %s; "
415 "Using %s, ignoring %s\n",
416 xkb_atom_text(info->keymap->ctx, type->name),
417 TypeMaskTxt(info, type),
418 VModMaskText(info->keymap, mods));
426 /***====================================================================***/
428 static struct xkb_kt_map_entry *
429 FindMatchingMapEntry(KeyTypeInfo *type, xkb_mod_mask_t mods)
431 struct xkb_kt_map_entry *entry;
433 darray_foreach(entry, type->entries)
434 if (entry->mods.mods == mods)
441 * Add a new KTMapEntry to the given key type. If an entry with the same mods
442 * already exists, the level is updated (if clobber is TRUE). Otherwise, a new
445 * @param clobber Overwrite existing entry.
446 * @param report true if a warning is to be printed on.
449 AddMapEntry(KeyTypesInfo *info, KeyTypeInfo *type,
450 struct xkb_kt_map_entry *new, bool clobber, bool report)
452 struct xkb_kt_map_entry * old;
454 old = FindMatchingMapEntry(type, new->mods.mods);
456 if (report && old->level != new->level) {
457 log_warn(info->keymap->ctx,
458 "Multiple map entries for %s in %s; "
459 "Using %d, ignoring %d\n",
460 MapEntryTxt(info, new), TypeTxt(info, type),
461 (clobber ? new->level : old->level) + 1,
462 (clobber ? old->level : new->level) + 1);
465 log_lvl(info->keymap->ctx, 10,
466 "Multiple occurences of map[%s]= %d in %s; Ignored\n",
467 MapEntryTxt(info, new), new->level + 1,
468 TypeTxt(info, type));
473 if (new->level >= type->num_levels)
474 type->num_levels = new->level + 1;
475 old->level = new->level;
481 if (new->level >= type->num_levels)
482 type->num_levels = new->level + 1;
484 darray_append(type->entries, *new);
489 SetMapEntry(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
492 struct xkb_kt_map_entry entry;
494 if (arrayNdx == NULL)
495 return ReportTypeShouldBeArray(info, type, "map entry");
497 if (!ExprResolveVModMask(info->keymap, arrayNdx, &entry.mods.mods))
498 return ReportTypeBadType(info, type, "map entry", "modifier mask");
500 if (entry.mods.mods & (~type->mods)) {
501 log_lvl(info->keymap->ctx, 1,
502 "Map entry for unused modifiers in %s; "
503 "Using %s instead of %s\n",
505 VModMaskText(info->keymap, entry.mods.mods & type->mods),
506 MapEntryTxt(info, &entry));
507 entry.mods.mods &= type->mods;
510 if (!ExprResolveLevel(info->keymap->ctx, value, &entry.level)) {
511 log_err(info->keymap->ctx,
512 "Level specifications in a key type must be integer; "
513 "Ignoring malformed level specification\n");
517 entry.preserve.mods = 0;
519 return AddMapEntry(info, type, &entry, true, true);
522 /***====================================================================***/
525 AddPreserve(KeyTypesInfo *info, KeyTypeInfo *type,
526 xkb_mod_mask_t mods, xkb_mod_mask_t preserve_mods)
528 struct xkb_kt_map_entry *entry;
529 struct xkb_kt_map_entry new;
531 darray_foreach(entry, type->entries) {
532 if (entry->mods.mods != mods)
535 /* Map exists without previous preserve (or "None"); override. */
536 if (entry->preserve.mods == 0) {
537 entry->preserve.mods = preserve_mods;
541 /* Map exists with same preserve; do nothing. */
542 if (entry->preserve.mods == preserve_mods) {
543 log_lvl(info->keymap->ctx, 10,
544 "Identical definitions for preserve[%s] in %s; "
546 VModMaskText(info->keymap, mods),
547 TypeTxt(info, type));
551 /* Map exists with different preserve; latter wins. */
552 log_lvl(info->keymap->ctx, 1,
553 "Multiple definitions for preserve[%s] in %s; "
554 "Using %s, ignoring %s\n",
555 VModMaskText(info->keymap, mods),
557 VModMaskText(info->keymap, preserve_mods),
558 VModMaskText(info->keymap, entry->preserve.mods));
560 entry->preserve.mods = preserve_mods;
565 * Map does not exist, i.e. preserve[] came before map[].
566 * Create a map with the specified mask mapping to Level1. The level
567 * may be overriden later with an explicit map[] statement.
570 new.mods.mods = mods;
571 new.preserve.mods = preserve_mods;
572 darray_append(type->entries, new);
577 SetPreserve(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
580 xkb_mod_mask_t mods, preserve_mods;
582 if (arrayNdx == NULL)
583 return ReportTypeShouldBeArray(info, type, "preserve entry");
585 if (!ExprResolveVModMask(info->keymap, arrayNdx, &mods))
586 return ReportTypeBadType(info, type, "preserve entry",
589 if (mods & ~type->mods) {
590 const char *before, *after;
592 before = VModMaskText(info->keymap, mods);
594 after = VModMaskText(info->keymap, mods);
596 log_lvl(info->keymap->ctx, 1,
597 "Preserve for modifiers not used by the %s type; "
598 "Index %s converted to %s\n",
599 TypeTxt(info, type), before, after);
602 if (!ExprResolveVModMask(info->keymap, value, &preserve_mods)) {
603 log_err(info->keymap->ctx,
604 "Preserve value in a key type is not a modifier mask; "
605 "Ignoring preserve[%s] in type %s\n",
606 VModMaskText(info->keymap, mods),
607 TypeTxt(info, type));
611 if (preserve_mods & ~mods) {
612 const char *before, *after;
614 before = VModMaskText(info->keymap, preserve_mods);
615 preserve_mods &= mods;
616 after = VModMaskText(info->keymap, preserve_mods);
618 log_lvl(info->keymap->ctx, 1,
619 "Illegal value for preserve[%s] in type %s; "
620 "Converted %s to %s\n",
621 VModMaskText(info->keymap, mods),
622 TypeTxt(info, type), before, after);
625 return AddPreserve(info, type, mods, preserve_mods);
628 /***====================================================================***/
631 AddLevelName(KeyTypesInfo *info, KeyTypeInfo *type,
632 xkb_level_index_t level, xkb_atom_t name, bool clobber)
635 if (level >= darray_size(type->level_names)) {
636 darray_resize0(type->level_names, level + 1);
640 /* Same level, same name. */
641 if (darray_item(type->level_names, level) == name) {
642 log_lvl(info->keymap->ctx, 10,
643 "Duplicate names for level %d of key type %s; Ignored\n",
644 level + 1, TypeTxt(info, type));
648 /* Same level, different name. */
649 if (darray_item(type->level_names, level) != XKB_ATOM_NONE) {
650 const char *old, *new;
651 old = xkb_atom_text(info->keymap->ctx,
652 darray_item(type->level_names, level));
653 new = xkb_atom_text(info->keymap->ctx, name);
654 log_lvl(info->keymap->ctx, 1,
655 "Multiple names for level %d of key type %s; "
656 "Using %s, ignoring %s\n",
657 level + 1, TypeTxt(info, type),
658 (clobber ? new : old), (clobber ? old : new));
664 /* XXX: What about different level, same name? */
667 darray_item(type->level_names, level) = name;
672 SetLevelName(KeyTypesInfo *info, KeyTypeInfo *type, ExprDef *arrayNdx,
675 xkb_level_index_t level;
676 xkb_atom_t level_name;
677 struct xkb_context *ctx = info->keymap->ctx;
680 if (arrayNdx == NULL)
681 return ReportTypeShouldBeArray(info, type, "level name");
683 if (!ExprResolveLevel(ctx, arrayNdx, &level))
684 return ReportTypeBadType(info, type, "level name", "integer");
686 if (!ExprResolveString(ctx, value, &str)) {
687 log_err(info->keymap->ctx,
688 "Non-string name for level %d in key type %s; "
689 "Ignoring illegal level name definition\n",
690 level + 1, xkb_atom_text(ctx, type->name));
694 level_name = xkb_atom_intern(ctx, str);
696 return AddLevelName(info, type, level, level_name, true);
699 /***====================================================================***/
702 * Parses the fields in a type "..." { } description.
704 * @param field The field to parse (e.g. modifiers, map, level_name)
707 SetKeyTypeField(KeyTypesInfo *info, KeyTypeInfo *type,
708 const char *field, ExprDef *arrayNdx, ExprDef *value)
711 enum type_field type_field = 0;
713 if (istreq(field, "modifiers")) {
714 type_field = TYPE_FIELD_MASK;
715 ok = SetModifiers(info, type, arrayNdx, value);
717 else if (istreq(field, "map")) {
718 type_field = TYPE_FIELD_MAP;
719 ok = SetMapEntry(info, type, arrayNdx, value);
721 else if (istreq(field, "preserve")) {
722 type_field = TYPE_FIELD_PRESERVE;
723 ok = SetPreserve(info, type, arrayNdx, value);
725 else if (istreq(field, "levelname") || istreq(field, "level_name")) {
726 type_field = TYPE_FIELD_LEVEL_NAME;
727 ok = SetLevelName(info, type, arrayNdx, value);
729 log_err(info->keymap->ctx,
730 "Unknown field %s in key type %s; Definition ignored\n",
731 field, TypeTxt(info, type));
734 type->defined |= type_field;
739 HandleKeyTypeBody(KeyTypesInfo *info, VarDef *def, KeyTypeInfo *type)
742 const char *elem, *field;
745 for (; def; def = (VarDef *) def->common.next) {
746 ok = ExprResolveLhs(info->keymap->ctx, def->name, &elem, &field,
751 if (elem && istreq(elem, "type")) {
752 log_err(info->keymap->ctx,
753 "Support for changing the default type has been removed; "
754 "Statement ignored\n");
758 ok = SetKeyTypeField(info, type, field, arrayNdx, def->value);
765 * Process a type "XYZ" { } specification in the xkb_types section.
769 HandleKeyTypeDef(KeyTypesInfo *info, KeyTypeDef *def, enum merge_mode merge)
773 .file_id = info->file_id,
774 .merge = (def->merge == MERGE_DEFAULT ? merge : def->merge),
778 .entries = darray_new(),
779 .level_names = darray_new(),
782 /* Parse the actual content. */
783 if (!HandleKeyTypeBody(info, def->body, &type)) {
788 /* Now add the new keytype to the info struct */
789 if (!AddKeyType(info, &type)) {
798 * Process an xkb_types section.
800 * @param file The parsed xkb_types section.
801 * @param merge Merge Strategy (e.g. MERGE_OVERRIDE)
802 * @param info Pointer to memory where the outcome will be stored.
805 HandleKeyTypesFile(KeyTypesInfo *info, XkbFile *file, enum merge_mode merge)
811 info->name = strdup_safe(file->name);
813 for (stmt = file->defs; stmt; stmt = stmt->next) {
814 switch (stmt->type) {
816 ok = HandleIncludeKeyTypes(info, (IncludeStmt *) stmt);
818 case STMT_TYPE: /* e.g. type "ONE_LEVEL" */
819 ok = HandleKeyTypeDef(info, (KeyTypeDef *) stmt, merge);
822 log_err(info->keymap->ctx,
823 "Support for changing the default type has been removed; "
824 "Statement ignored\n");
827 case STMT_VMOD: /* virtual_modifiers NumLock, ... */
828 ok = HandleVModDef((VModDef *) stmt, info->keymap, merge,
832 log_err(info->keymap->ctx,
833 "Key type files may not include other declarations; "
834 "Ignoring %s\n", stmt_type_to_string(stmt->type));
842 if (info->errorCount > 10) {
843 log_err(info->keymap->ctx,
844 "Abandoning keytypes file \"%s\"\n", file->topName);
851 CopyDefToKeyType(KeyTypesInfo *info, KeyTypeInfo *def,
852 struct xkb_key_type *type)
854 type->mods.mods = def->mods;
855 type->num_levels = def->num_levels;
856 type->map = darray_mem(def->entries, 0);
857 type->num_entries = darray_size(def->entries);
858 darray_init(def->entries);
859 type->name = def->name;
860 type->level_names = darray_mem(def->level_names, 0);
861 darray_init(def->level_names);
865 CopyKeyTypesToKeymap(struct xkb_keymap *keymap, KeyTypesInfo *info)
868 unsigned int num_types;
871 num_types = info->num_types ? info->num_types : 1;
872 keymap->types = calloc(num_types, sizeof(*keymap->types));
876 keymap->num_types = num_types;
879 * If no types were specified, a default unnamed one-level type is
882 if (info->num_types == 0) {
884 .name = xkb_atom_intern(keymap->ctx, "default"),
887 .entries = darray_new(),
888 .level_names = darray_new(),
891 CopyDefToKeyType(info, &dflt, &keymap->types[0]);
894 list_foreach(def, &info->types, entry)
895 CopyDefToKeyType(info, def, &keymap->types[i++]);
898 keymap->types_section_name = strdup_safe(info->name);
904 CompileKeyTypes(XkbFile *file, struct xkb_keymap *keymap,
905 enum merge_mode merge)
909 InitKeyTypesInfo(&info, keymap, file->id);
911 HandleKeyTypesFile(&info, file, merge);
912 if (info.errorCount != 0)
915 if (!CopyKeyTypesToKeymap(keymap, &info))
918 FreeKeyTypesInfo(&info);
922 FreeKeyTypesInfo(&info);