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"
29 #include "parseutils.h"
31 typedef struct _AliasInfo {
32 enum merge_mode merge;
36 char alias[XkbKeyNameLength + 1];
37 char real[XkbKeyNameLength + 1];
40 typedef struct _IndicatorNameInfo {
41 enum merge_mode merge;
50 typedef struct _KeyNamesInfo {
51 char *name; /* e.g. evdev+aliases(qwerty) */
54 enum merge_mode merge;
55 xkb_keycode_t computedMin; /* lowest keycode stored */
56 xkb_keycode_t computedMax; /* highest keycode stored */
57 xkb_keycode_t explicitMin;
58 xkb_keycode_t explicitMax;
59 darray(unsigned long) names;
60 darray(unsigned int) files;
64 struct xkb_keymap *keymap;
68 ResizeKeyNameArrays(KeyNamesInfo *info, int newMax)
70 if (newMax < darray_size(info->names))
73 darray_resize0(info->names, newMax + 1);
74 darray_resize0(info->files, newMax + 1);
78 InitAliasInfo(AliasInfo *info, enum merge_mode merge, unsigned file_id,
79 char *alias, char *real)
81 memset(info, 0, sizeof(*info));
83 info->file_id = file_id;
84 strncpy(info->alias, alias, XkbKeyNameLength);
85 strncpy(info->real, real, XkbKeyNameLength);
89 InitIndicatorNameInfo(IndicatorNameInfo * ii, KeyNamesInfo * info)
91 ii->merge = info->merge;
92 ii->file_id = info->file_id;
94 ii->name = XKB_ATOM_NONE;
98 static IndicatorNameInfo *
99 NextIndicatorName(KeyNamesInfo * info)
101 IndicatorNameInfo *ii;
103 ii = malloc(sizeof(*ii));
107 InitIndicatorNameInfo(ii, info);
108 list_append(&ii->entry, &info->leds);
113 static IndicatorNameInfo *
114 FindIndicatorByIndex(KeyNamesInfo * info, xkb_led_index_t ndx)
116 IndicatorNameInfo *old;
118 list_foreach(old, &info->leds, entry)
125 static IndicatorNameInfo *
126 FindIndicatorByName(KeyNamesInfo * info, xkb_atom_t name)
128 IndicatorNameInfo *old;
130 list_foreach(old, &info->leds, entry)
131 if (old->name == name)
138 AddIndicatorName(KeyNamesInfo *info, enum merge_mode merge,
139 IndicatorNameInfo *new)
141 IndicatorNameInfo *old;
143 int verbosity = xkb_get_log_verbosity(info->keymap->ctx);
145 replace = (merge == MERGE_REPLACE) || (merge == MERGE_OVERRIDE);
147 old = FindIndicatorByName(info, new->name);
149 if ((old->file_id == new->file_id && verbosity > 0) ||
151 if (old->ndx == new->ndx) {
152 if (old->virtual != new->virtual) {
154 old->virtual = new->virtual;
155 log_warn(info->keymap->ctx, "Multiple indicators named %s; "
156 "Using %s instead of %s\n",
157 xkb_atom_text(info->keymap->ctx, new->name),
158 (old->virtual ? "virtual" : "real"),
159 (old->virtual ? "real" : "virtual"));
162 log_warn(info->keymap->ctx, "Multiple indicators named %s; "
163 "Identical definitions ignored\n",
164 xkb_atom_text(info->keymap->ctx, new->name));
169 log_warn(info->keymap->ctx, "Multiple indicators named %s; "
170 "Using %d, ignoring %d\n",
171 xkb_atom_text(info->keymap->ctx, new->name),
172 (replace ? old->ndx : new->ndx),
173 (replace ? new->ndx : old->ndx));
177 list_del(&old->entry);
183 old = FindIndicatorByIndex(info, new->ndx);
185 if ((old->file_id == new->file_id && verbosity > 0) ||
187 if (old->name == new->name && old->virtual == new->virtual) {
188 log_warn(info->keymap->ctx,
189 "Multiple names for indicator %d; "
190 "Identical definitions ignored\n", new->ndx);
192 const char *oldType, *newType;
193 xkb_atom_t using, ignoring;
195 oldType = "virtual indicator";
197 oldType = "real indicator";
199 newType = "virtual indicator";
201 newType = "real indicator";
204 ignoring = old->name;
208 ignoring = new->name;
210 log_warn(info->keymap->ctx,
211 "Multiple names for indicator %d; "
212 "Using %s %s, ignoring %s %s\n",
214 oldType, xkb_atom_text(info->keymap->ctx, using),
215 newType, xkb_atom_text(info->keymap->ctx, ignoring));
219 old->name = new->name;
220 old->virtual = new->virtual;
225 new = NextIndicatorName(info);
227 log_wsgo(info->keymap->ctx,
228 "Couldn't allocate name for indicator %d; Ignored\n",
232 new->name = old->name;
234 new->virtual = old->virtual;
239 ClearKeyNamesInfo(KeyNamesInfo * info)
241 AliasInfo *alias, *next_alias;
242 IndicatorNameInfo *ii, *next_ii;
246 info->merge = MERGE_DEFAULT;
247 info->computedMax = info->explicitMax = info->explicitMin = 0;
248 info->computedMin = XKB_KEYCODE_MAX;
249 darray_free(info->names);
250 darray_free(info->files);
251 list_foreach_safe(ii, next_ii, &info->leds, entry)
253 list_init(&info->leds);
254 list_foreach_safe(alias, next_alias, &info->aliases, entry)
256 list_init(&info->aliases);
260 InitKeyNamesInfo(KeyNamesInfo *info, struct xkb_keymap *keymap,
264 info->merge = MERGE_DEFAULT;
265 list_init(&info->leds);
266 list_init(&info->aliases);
267 info->file_id = file_id;
268 darray_init(info->names);
269 darray_init(info->files);
270 ClearKeyNamesInfo(info);
271 info->errorCount = 0;
272 info->keymap = keymap;
276 FindKeyByLong(KeyNamesInfo * info, unsigned long name)
280 for (i = info->computedMin; i <= info->computedMax; i++)
281 if (darray_item(info->names, i) == name)
288 * Store the name of the key as a long in the info struct under the given
289 * keycode. If the same keys is referred to twice, print a warning.
290 * Note that the key's name is stored as a long, the keycode is the index.
293 AddKeyName(KeyNamesInfo * info,
294 xkb_keycode_t kc, char *name, enum merge_mode merge,
295 unsigned file_id, bool reportCollisions)
299 int verbosity = xkb_get_log_verbosity(info->keymap->ctx);
301 ResizeKeyNameArrays(info, kc);
303 if (kc < info->computedMin)
304 info->computedMin = kc;
305 if (kc > info->computedMax)
306 info->computedMax = kc;
307 lval = KeyNameToLong(name);
309 if (reportCollisions)
310 reportCollisions = (verbosity > 7 ||
312 file_id == darray_item(info->files, kc)));
314 if (darray_item(info->names, kc) != 0) {
317 LongToKeyName(darray_item(info->names, kc), buf);
319 if (darray_item(info->names, kc) == lval && reportCollisions) {
320 log_warn(info->keymap->ctx,
321 "Multiple identical key name definitions; "
322 "Later occurences of \"<%s> = %d\" ignored\n", buf, kc);
326 if (merge == MERGE_AUGMENT) {
327 if (reportCollisions)
328 log_warn(info->keymap->ctx,
329 "Multiple names for keycode %d; "
330 "Using <%s>, ignoring <%s>\n", kc, buf, name);
334 if (reportCollisions)
335 log_warn(info->keymap->ctx,
336 "Multiple names for keycode %d; "
337 "Using <%s>, ignoring <%s>\n", kc, name, buf);
338 darray_item(info->names, kc) = 0;
339 darray_item(info->files, kc) = 0;
343 old = FindKeyByLong(info, lval);
344 if ((old != 0) && (old != kc)) {
345 if (merge == MERGE_OVERRIDE) {
346 darray_item(info->names, old) = 0;
347 darray_item(info->files, old) = 0;
348 if (reportCollisions)
349 log_warn(info->keymap->ctx,
350 "Key name <%s> assigned to multiple keys; "
351 "Using %d, ignoring %d\n", name, kc, old);
354 if (reportCollisions && verbosity > 3)
355 log_warn(info->keymap->ctx,
356 "Key name <%s> assigned to multiple keys; "
357 "Using %d, ignoring %d\n", name, old, kc);
361 darray_item(info->names, kc) = lval;
362 darray_item(info->files, kc) = file_id;
366 /***====================================================================***/
369 HandleAliasDef(KeyNamesInfo *info, KeyAliasDef *def, enum merge_mode merge,
373 MergeAliases(KeyNamesInfo *into, KeyNamesInfo *from, enum merge_mode merge)
375 AliasInfo *alias, *next;
378 if (list_empty(&from->aliases))
381 if (list_empty(&into->aliases)) {
382 list_replace(&from->aliases, &into->aliases);
383 list_init(&from->aliases);
387 memset(&def, 0, sizeof(def));
389 list_foreach_safe(alias, next, &from->aliases, entry) {
390 def.merge = (merge == MERGE_DEFAULT) ? alias->merge : merge;
391 memcpy(def.alias, alias->alias, XkbKeyNameLength);
392 memcpy(def.real, alias->real, XkbKeyNameLength);
394 if (!HandleAliasDef(into, &def, def.merge, alias->file_id))
402 MergeIncludedKeycodes(KeyNamesInfo *into, KeyNamesInfo *from,
403 enum merge_mode merge)
407 IndicatorNameInfo *led;
409 if (from->errorCount > 0) {
410 into->errorCount += from->errorCount;
413 if (into->name == NULL) {
414 into->name = from->name;
418 ResizeKeyNameArrays(into, from->computedMax);
420 for (i = from->computedMin; i <= from->computedMax; i++) {
421 if (darray_item(from->names, i) == 0)
423 LongToKeyName(darray_item(from->names, i), buf);
425 if (!AddKeyName(into, i, buf, merge, from->file_id, false))
429 list_foreach(led, &from->leds, entry) {
430 led->merge = (merge == MERGE_DEFAULT ? led->merge : merge);
431 if (!AddIndicatorName(into, led->merge, led))
435 if (!MergeAliases(into, from, merge))
437 if (from->explicitMin != 0) {
438 if ((into->explicitMin == 0)
439 || (into->explicitMin > from->explicitMin))
440 into->explicitMin = from->explicitMin;
442 if (from->explicitMax > 0) {
443 if ((into->explicitMax == 0)
444 || (into->explicitMax < from->explicitMax))
445 into->explicitMax = from->explicitMax;
450 HandleKeycodesFile(KeyNamesInfo *info, XkbFile *file, enum merge_mode merge);
453 * Handle the given include statement (e.g. "include "evdev+aliases(qwerty)").
455 * @param info Struct to store the key info in.
456 * @param stmt The include statement from the keymap file.
459 HandleIncludeKeycodes(KeyNamesInfo *info, IncludeStmt *stmt)
461 enum merge_mode merge = MERGE_DEFAULT;
463 KeyNamesInfo included, next_incl;
465 /* XXX: What's that? */
466 if (stmt->file && streq(stmt->file, "computed")) {
467 info->keymap->flags |= AutoKeyNames;
468 info->explicitMin = 0;
469 info->explicitMax = XKB_KEYCODE_MAX;
470 return (info->errorCount == 0);
473 InitKeyNamesInfo(&included, info->keymap, info->file_id);
476 included.name = stmt->stmt;
480 for (; stmt; stmt = stmt->next_incl) {
481 if (!ProcessIncludeFile(info->keymap->ctx, stmt, FILE_TYPE_KEYCODES,
483 info->errorCount += 10;
484 ClearKeyNamesInfo(&included);
488 InitKeyNamesInfo(&next_incl, info->keymap, rtrn->id);
490 HandleKeycodesFile(&next_incl, rtrn, MERGE_OVERRIDE);
492 MergeIncludedKeycodes(&included, &next_incl, merge);
494 ClearKeyNamesInfo(&next_incl);
498 MergeIncludedKeycodes(info, &included, merge);
499 ClearKeyNamesInfo(&included);
501 return (info->errorCount == 0);
505 * Parse the given statement and store the output in the info struct.
509 HandleKeycodeDef(KeyNamesInfo *info, KeycodeDef *stmt, enum merge_mode merge)
511 if ((info->explicitMin != 0 && stmt->value < info->explicitMin) ||
512 (info->explicitMax != 0 && stmt->value > info->explicitMax)) {
513 log_err(info->keymap->ctx,
514 "Illegal keycode %lu for name <%s>; "
515 "Must be in the range %d-%d inclusive\n",
516 stmt->value, stmt->name, info->explicitMin,
517 info->explicitMax ? info->explicitMax : XKB_KEYCODE_MAX);
520 if (stmt->merge != MERGE_DEFAULT) {
521 if (stmt->merge == MERGE_REPLACE)
522 merge = MERGE_OVERRIDE;
526 return AddKeyName(info, stmt->value, stmt->name, merge, info->file_id,
531 HandleAliasCollision(KeyNamesInfo *info, AliasInfo *old, AliasInfo *new)
533 int verbosity = xkb_get_log_verbosity(info->keymap->ctx);
535 if (strncmp(new->real, old->real, XkbKeyNameLength) == 0) {
536 if ((new->file_id == old->file_id && verbosity > 0) || verbosity > 9)
537 log_warn(info->keymap->ctx,
538 "Alias of %s for %s declared more than once; "
539 "First definition ignored\n",
540 KeyNameText(new->alias), KeyNameText(new->real));
545 if (new->merge == MERGE_AUGMENT) {
554 if ((old->file_id == new->file_id && verbosity > 0) || verbosity > 9)
555 log_warn(info->keymap->ctx,
556 "Multiple definitions for alias %s; "
557 "Using %s, ignoring %s\n",
558 KeyNameText(old->alias), KeyNameText(use),
559 KeyNameText(ignore));
561 if (use != old->real)
562 memcpy(old->real, use, XkbKeyNameLength);
565 old->file_id = new->file_id;
566 old->merge = new->merge;
570 HandleAliasDef(KeyNamesInfo *info, KeyAliasDef *def, enum merge_mode merge,
575 list_foreach(alias, &info->aliases, entry) {
576 if (strncmp(alias->alias, def->alias, XkbKeyNameLength) == 0) {
578 InitAliasInfo(&new, merge, file_id, def->alias, def->real);
579 HandleAliasCollision(info, alias, &new);
584 alias = calloc(1, sizeof(*alias));
586 log_wsgo(info->keymap->ctx, "Allocation failure in HandleAliasDef\n");
590 alias->file_id = file_id;
591 alias->merge = merge;
592 memcpy(alias->alias, def->alias, XkbKeyNameLength);
593 memcpy(alias->real, def->real, XkbKeyNameLength);
594 list_append(&alias->entry, &info->aliases);
599 #define MIN_KEYCODE_DEF 0
600 #define MAX_KEYCODE_DEF 1
603 * Handle the minimum/maximum statement of the xkb file.
604 * Sets explicitMin/Max of the info struct.
606 * @return 1 on success, 0 otherwise.
609 HandleKeyNameVar(KeyNamesInfo *info, VarDef *stmt)
611 const char *elem, *field;
616 if (!ExprResolveLhs(info->keymap->ctx, stmt->name, &elem, &field,
618 return false; /* internal error, already reported */
621 log_err(info->keymap->ctx,
622 "Unknown element %s encountered; "
623 "Default for field %s ignored\n", elem, field);
627 if (istreq(field, "minimum"))
628 which = MIN_KEYCODE_DEF;
629 else if (istreq(field, "maximum"))
630 which = MAX_KEYCODE_DEF;
632 log_err(info->keymap->ctx,
633 "Unknown field encountered; "
634 "Assigment to field %s ignored\n", field);
638 if (arrayNdx != NULL) {
639 log_err(info->keymap->ctx,
640 "The %s setting is not an array; "
641 "Illegal array reference ignored\n", field);
645 if (ExprResolveKeyCode(info->keymap->ctx, stmt->value, &kc) == 0) {
646 log_err(info->keymap->ctx,
647 "Illegal keycode encountered; "
648 "Assignment to field %s ignored\n", field);
652 if (kc > XKB_KEYCODE_MAX) {
653 log_err(info->keymap->ctx,
654 "Illegal keycode %d (must be in the range %d-%d inclusive); "
655 "Value of \"%s\" not changed\n",
656 kc, 0, XKB_KEYCODE_MAX, field);
660 if (which == MIN_KEYCODE_DEF) {
661 if (info->explicitMax > 0 && info->explicitMax < kc) {
662 log_err(info->keymap->ctx,
663 "Minimum key code (%d) must be <= maximum key code (%d); "
664 "Minimum key code value not changed\n",
665 kc, info->explicitMax);
669 if (info->computedMax > 0 && info->computedMin < kc) {
670 log_err(info->keymap->ctx,
671 "Minimum key code (%d) must be <= lowest defined key (%d); "
672 "Minimum key code value not changed\n",
673 kc, info->computedMin);
677 info->explicitMin = kc;
680 if (which == MAX_KEYCODE_DEF) {
681 if (info->explicitMin > 0 && info->explicitMin > kc) {
682 log_err(info->keymap->ctx,
683 "Maximum code (%d) must be >= minimum key code (%d); "
684 "Maximum code value not changed\n",
685 kc, info->explicitMin);
689 if (info->computedMax > 0 && info->computedMax > kc) {
690 log_err(info->keymap->ctx,
691 "Maximum code (%d) must be >= highest defined key (%d); "
692 "Maximum code value not changed\n",
693 kc, info->computedMax);
697 info->explicitMax = kc;
704 HandleIndicatorNameDef(KeyNamesInfo *info, IndicatorNameDef *def,
705 enum merge_mode merge)
707 IndicatorNameInfo ii;
710 if (def->ndx < 1 || def->ndx > XkbNumIndicators) {
712 log_err(info->keymap->ctx,
713 "Name specified for illegal indicator index %d\n; Ignored\n",
718 InitIndicatorNameInfo(&ii, info);
719 ii.ndx = (xkb_led_index_t) def->ndx;
721 if (!ExprResolveString(info->keymap->ctx, def->name, &str)) {
723 snprintf(buf, sizeof(buf), "%d", def->ndx);
725 return ReportBadType(info->keymap, "indicator", "name", buf,
729 ii.name = xkb_atom_intern(info->keymap->ctx, str);
730 ii.virtual = def->virtual;
732 return AddIndicatorName(info, merge, &ii);
736 * Handle the xkb_keycodes section of a xkb file.
737 * All information about parsed keys is stored in the info struct.
739 * Such a section may have include statements, in which case this function is
740 * semi-recursive (it calls HandleIncludeKeycodes, which may call
741 * HandleKeycodesFile again).
743 * @param info Struct to contain the fully parsed key information.
744 * @param file The input file (parsed xkb_keycodes section)
745 * @param merge Merge strategy (MERGE_OVERRIDE, etc.)
748 HandleKeycodesFile(KeyNamesInfo *info, XkbFile *file, enum merge_mode merge)
753 info->name = strdup_safe(file->name);
757 switch (stmt->type) {
758 case STMT_INCLUDE: /* e.g. include "evdev+aliases(qwerty)" */
759 if (!HandleIncludeKeycodes(info, (IncludeStmt *) stmt))
762 case STMT_KEYCODE: /* e.g. <ESC> = 9; */
763 if (!HandleKeycodeDef(info, (KeycodeDef *) stmt, merge))
766 case STMT_ALIAS: /* e.g. alias <MENU> = <COMP>; */
767 if (!HandleAliasDef(info, (KeyAliasDef *) stmt, merge,
771 case STMT_VAR: /* e.g. minimum, maximum */
772 if (!HandleKeyNameVar(info, (VarDef *) stmt))
775 case STMT_INDICATOR_NAME: /* e.g. indicator 1 = "Caps Lock"; */
776 if (!HandleIndicatorNameDef(info, (IndicatorNameDef *) stmt,
782 log_err(info->keymap->ctx,
783 "Keycode files may define key and indicator names only; "
784 "Ignoring definition of %s\n",
785 (stmt->type == STMT_INTERP ?
786 "a symbol interpretation" : "virtual modifiers"));
790 log_wsgo(info->keymap->ctx,
791 "Unexpected statement type %d in HandleKeycodesFile\n",
796 if (info->errorCount > 10) {
797 log_err(info->keymap->ctx, "Abandoning keycodes file \"%s\"\n",
805 ApplyAliases(KeyNamesInfo *info)
809 struct xkb_key_alias *old, *a;
810 AliasInfo *alias, *next;
812 struct xkb_keymap *keymap = info->keymap;
814 nOld = darray_size(keymap->key_aliases);
815 old = &darray_item(keymap->key_aliases, 0);
817 list_foreach(alias, &info->aliases, entry) {
820 lname = KeyNameToLong(alias->real);
821 key = FindNamedKey(keymap, lname, false, CreateKeyNames(keymap), 0);
823 log_lvl(info->keymap->ctx, 5,
824 "Attempt to alias %s to non-existent key %s; Ignored\n",
825 KeyNameText(alias->alias), KeyNameText(alias->real));
826 alias->alias[0] = '\0';
830 lname = KeyNameToLong(alias->alias);
831 key = FindNamedKey(keymap, lname, false, false, 0);
833 log_lvl(info->keymap->ctx, 5,
834 "Attempt to create alias with the name of a real key; "
835 "Alias \"%s = %s\" ignored\n",
836 KeyNameText(alias->alias), KeyNameText(alias->real));
837 alias->alias[0] = '\0';
846 for (i = 0, a = old; i < nOld; i++, a++) {
849 if (strncmp(a->alias, alias->alias, XkbKeyNameLength) != 0)
852 InitAliasInfo(&old_alias, MERGE_AUGMENT, 0, a->alias, a->real);
853 HandleAliasCollision(info, &old_alias, alias);
854 memcpy(old_alias.real, a->real, XkbKeyNameLength);
855 alias->alias[0] = '\0';
864 darray_resize0(keymap->key_aliases, nOld + nNew);
866 a = &darray_item(keymap->key_aliases, nOld);
867 list_foreach(alias, &info->aliases, entry) {
868 if (alias->alias[0] != '\0') {
869 strncpy(a->alias, alias->alias, XkbKeyNameLength);
870 strncpy(a->real, alias->real, XkbKeyNameLength);
876 list_foreach_safe(alias, next, &info->aliases, entry)
878 list_init(&info->aliases);
883 * Compile the xkb_keycodes section, parse it's output, return the results.
885 * @param file The parsed XKB file (may have include statements requiring
887 * @param result The effective keycodes, as gathered from the file.
888 * @param merge Merge strategy.
890 * @return true on success, false otherwise.
893 CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
894 enum merge_mode merge)
897 KeyNamesInfo info; /* contains all the info after parsing */
898 IndicatorNameInfo *ii;
900 InitKeyNamesInfo(&info, keymap, file->id);
902 HandleKeycodesFile(&info, file, merge);
904 /* all the keys are now stored in info */
906 if (info.errorCount != 0)
909 if (info.explicitMin > 0) /* if "minimum" statement was present */
910 keymap->min_key_code = info.explicitMin;
912 keymap->min_key_code = info.computedMin;
914 if (info.explicitMax > 0) /* if "maximum" statement was present */
915 keymap->max_key_code = info.explicitMax;
917 keymap->max_key_code = info.computedMax;
919 darray_resize0(keymap->keys, keymap->max_key_code + 1);
920 for (kc = info.computedMin; kc <= info.computedMax; kc++)
921 LongToKeyName(darray_item(info.names, kc),
922 XkbKey(keymap, kc)->name);
925 keymap->keycodes_section_name = strdup(info.name);
927 list_foreach(ii, &info.leds, entry) {
928 keymap->indicator_names[ii->ndx - 1] =
929 xkb_atom_text(keymap->ctx, ii->name);
934 ClearKeyNamesInfo(&info);
938 ClearKeyNamesInfo(&info);