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;
66 HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
67 enum merge_mode merge,
71 ResizeKeyNameArrays(KeyNamesInfo *info, int newMax)
73 if (newMax < darray_size(info->names))
76 darray_resize0(info->names, newMax + 1);
77 darray_resize0(info->files, newMax + 1);
81 InitAliasInfo(AliasInfo *info, enum merge_mode merge, unsigned file_id,
82 char *alias, char *real)
84 memset(info, 0, sizeof(*info));
86 info->file_id = file_id;
87 strncpy(info->alias, alias, XkbKeyNameLength);
88 strncpy(info->real, real, XkbKeyNameLength);
92 InitIndicatorNameInfo(IndicatorNameInfo * ii, KeyNamesInfo * info)
94 ii->merge = info->merge;
95 ii->file_id = info->file_id;
97 ii->name = XKB_ATOM_NONE;
101 static IndicatorNameInfo *
102 NextIndicatorName(KeyNamesInfo * info)
104 IndicatorNameInfo *ii;
106 ii = malloc(sizeof(*ii));
110 InitIndicatorNameInfo(ii, info);
111 list_append(&ii->entry, &info->leds);
116 static IndicatorNameInfo *
117 FindIndicatorByIndex(KeyNamesInfo * info, int ndx)
119 IndicatorNameInfo *old;
121 list_foreach(old, &info->leds, entry)
128 static IndicatorNameInfo *
129 FindIndicatorByName(KeyNamesInfo * info, xkb_atom_t name)
131 IndicatorNameInfo *old;
133 list_foreach(old, &info->leds, entry)
134 if (old->name == name)
141 AddIndicatorName(KeyNamesInfo *info, struct xkb_keymap *keymap,
142 enum merge_mode merge,
143 IndicatorNameInfo *new)
145 IndicatorNameInfo *old;
148 replace = (merge == MERGE_REPLACE) || (merge == MERGE_OVERRIDE);
150 old = FindIndicatorByName(info, new->name);
152 if ((old->file_id == new->file_id && warningLevel > 0) ||
154 WARN("Multiple indicators named %s\n",
155 xkb_atom_text(keymap->ctx, new->name));
156 if (old->ndx == new->ndx) {
157 if (old->virtual != new->virtual) {
159 old->virtual = new->virtual;
160 ACTION("Using %s instead of %s\n",
161 (old->virtual ? "virtual" : "real"),
162 (old->virtual ? "real" : "virtual"));
165 ACTION("Identical definitions ignored\n");
171 ACTION("Ignoring %d, using %d\n", old->ndx, new->ndx);
173 ACTION("Using %d, ignoring %d\n", old->ndx, new->ndx);
177 list_del(&old->entry);
183 old = FindIndicatorByIndex(info, new->ndx);
185 if ((old->file_id == new->file_id && warningLevel > 0) ||
187 WARN("Multiple names for indicator %d\n", new->ndx);
188 if ((old->name == new->name) && (old->virtual == new->virtual))
189 ACTION("Identical definitions ignored\n");
191 const char *oldType, *newType;
192 xkb_atom_t using, ignoring;
194 oldType = "virtual indicator";
196 oldType = "real indicator";
198 newType = "virtual indicator";
200 newType = "real indicator";
203 ignoring = old->name;
207 ignoring = new->name;
209 ACTION("Using %s %s, ignoring %s %s\n",
210 oldType, xkb_atom_text(keymap->ctx, using),
211 newType, xkb_atom_text(keymap->ctx, ignoring));
215 old->name = new->name;
216 old->virtual = new->virtual;
221 new = NextIndicatorName(info);
223 WSGO("Couldn't allocate name for indicator %d\n", old->ndx);
227 new->name = old->name;
229 new->virtual = old->virtual;
234 ClearKeyNamesInfo(KeyNamesInfo * info)
236 AliasInfo *alias, *next_alias;
237 IndicatorNameInfo *ii, *next_ii;
241 info->computedMax = info->explicitMax = info->explicitMin = 0;
242 info->computedMin = XKB_KEYCODE_MAX;
243 darray_free(info->names);
244 darray_free(info->files);
245 list_foreach_safe(ii, next_ii, &info->leds, entry)
247 list_foreach_safe(alias, next_alias, &info->aliases, entry)
249 list_init(&info->aliases);
253 InitKeyNamesInfo(KeyNamesInfo * info, unsigned file_id)
256 list_init(&info->leds);
257 list_init(&info->aliases);
258 info->file_id = file_id;
259 darray_init(info->names);
260 darray_init(info->files);
261 ClearKeyNamesInfo(info);
262 info->errorCount = 0;
266 FindKeyByLong(KeyNamesInfo * info, unsigned long name)
270 for (i = info->computedMin; i <= info->computedMax; i++)
271 if (darray_item(info->names, i) == name)
278 * Store the name of the key as a long in the info struct under the given
279 * keycode. If the same keys is referred to twice, print a warning.
280 * Note that the key's name is stored as a long, the keycode is the index.
283 AddKeyName(KeyNamesInfo * info,
284 xkb_keycode_t kc, char *name, enum merge_mode merge,
285 unsigned file_id, bool reportCollisions)
290 ResizeKeyNameArrays(info, kc);
292 if (kc < info->computedMin)
293 info->computedMin = kc;
294 if (kc > info->computedMax)
295 info->computedMax = kc;
296 lval = KeyNameToLong(name);
298 if (reportCollisions) {
299 reportCollisions = (warningLevel > 7 ||
301 file_id == darray_item(info->files, kc)));
304 if (darray_item(info->names, kc) != 0) {
307 LongToKeyName(darray_item(info->names, kc), buf);
309 if (darray_item(info->names, kc) == lval && reportCollisions) {
310 WARN("Multiple identical key name definitions\n");
311 ACTION("Later occurences of \"<%s> = %d\" ignored\n",
315 if (merge == MERGE_AUGMENT) {
316 if (reportCollisions) {
317 WARN("Multiple names for keycode %d\n", kc);
318 ACTION("Using <%s>, ignoring <%s>\n", buf, name);
323 if (reportCollisions) {
324 WARN("Multiple names for keycode %d\n", kc);
325 ACTION("Using <%s>, ignoring <%s>\n", name, buf);
327 darray_item(info->names, kc) = 0;
328 darray_item(info->files, kc) = 0;
331 old = FindKeyByLong(info, lval);
332 if ((old != 0) && (old != kc)) {
333 if (merge == MERGE_OVERRIDE) {
334 darray_item(info->names, old) = 0;
335 darray_item(info->files, old) = 0;
336 if (reportCollisions) {
337 WARN("Key name <%s> assigned to multiple keys\n", name);
338 ACTION("Using %d, ignoring %d\n", kc, old);
342 if ((reportCollisions) && (warningLevel > 3)) {
343 WARN("Key name <%s> assigned to multiple keys\n", name);
344 ACTION("Using %d, ignoring %d\n", old, kc);
349 darray_item(info->names, kc) = lval;
350 darray_item(info->files, kc) = file_id;
354 /***====================================================================***/
357 HandleAliasDef(KeyAliasDef *def, enum merge_mode merge, unsigned file_id,
361 MergeAliases(KeyNamesInfo *into, KeyNamesInfo *from, enum merge_mode merge)
363 AliasInfo *alias, *next;
366 if (list_empty(&from->aliases))
369 if (list_empty(&into->aliases)) {
370 list_replace(&from->aliases, &into->aliases);
371 list_init(&from->aliases);
375 memset(&def, 0, sizeof(def));
377 list_foreach_safe(alias, next, &from->aliases, entry) {
378 def.merge = (merge == MERGE_DEFAULT) ? alias->merge : merge;
379 memcpy(def.alias, alias->alias, XkbKeyNameLength);
380 memcpy(def.real, alias->real, XkbKeyNameLength);
382 if (!HandleAliasDef(&def, def.merge, alias->file_id, into))
390 MergeIncludedKeycodes(KeyNamesInfo *into, struct xkb_keymap *keymap,
391 KeyNamesInfo *from, enum merge_mode merge)
395 IndicatorNameInfo *led;
397 if (from->errorCount > 0) {
398 into->errorCount += from->errorCount;
401 if (into->name == NULL) {
402 into->name = from->name;
406 ResizeKeyNameArrays(into, from->computedMax);
408 for (i = from->computedMin; i <= from->computedMax; i++) {
409 if (darray_item(from->names, i) == 0)
411 LongToKeyName(darray_item(from->names, i), buf);
413 if (!AddKeyName(into, i, buf, merge, from->file_id, false))
417 list_foreach(led, &from->leds, entry) {
418 led->merge = (merge == MERGE_DEFAULT ? led->merge : merge);
419 if (!AddIndicatorName(into, keymap, led->merge, led))
423 if (!MergeAliases(into, from, merge))
425 if (from->explicitMin != 0) {
426 if ((into->explicitMin == 0)
427 || (into->explicitMin > from->explicitMin))
428 into->explicitMin = from->explicitMin;
430 if (from->explicitMax > 0) {
431 if ((into->explicitMax == 0)
432 || (into->explicitMax < from->explicitMax))
433 into->explicitMax = from->explicitMax;
438 * Handle the given include statement (e.g. "include "evdev+aliases(qwerty)").
440 * @param stmt The include statement from the keymap file.
441 * @param keymap Unused for all but the keymap->flags.
442 * @param info Struct to store the key info in.
445 HandleIncludeKeycodes(IncludeStmt *stmt, struct xkb_keymap *keymap,
448 enum merge_mode newMerge;
450 KeyNamesInfo included;
453 memset(&included, 0, sizeof(included));
456 if ((stmt->file == NULL) && (stmt->map == NULL)) {
459 memset(info, 0, sizeof(KeyNamesInfo));
461 else if (stmt->file && strcmp(stmt->file, "computed") == 0) {
462 keymap->flags |= AutoKeyNames;
463 info->explicitMin = 0;
464 info->explicitMax = XKB_KEYCODE_MAX;
465 return (info->errorCount == 0);
466 } /* parse file, store returned info in the xkb struct */
467 else if (ProcessIncludeFile(keymap->ctx, stmt, FILE_TYPE_KEYCODES, &rtrn,
469 InitKeyNamesInfo(&included, rtrn->id);
470 HandleKeycodesFile(rtrn, keymap, MERGE_OVERRIDE, &included);
471 if (stmt->stmt != NULL) {
473 included.name = stmt->stmt;
479 info->errorCount += 10; /* XXX: why 10?? */
482 /* Do we have more than one include statement? */
483 if ((stmt->next != NULL) && (included.errorCount < 1)) {
486 KeyNamesInfo next_incl;
488 for (next = stmt->next; next != NULL; next = next->next) {
489 if ((next->file == NULL) && (next->map == NULL)) {
491 MergeIncludedKeycodes(&included, keymap, info, next->merge);
492 ClearKeyNamesInfo(info);
494 else if (ProcessIncludeFile(keymap->ctx, next, FILE_TYPE_KEYCODES,
496 InitKeyNamesInfo(&next_incl, rtrn->id);
497 HandleKeycodesFile(rtrn, keymap, MERGE_OVERRIDE, &next_incl);
498 MergeIncludedKeycodes(&included, keymap, &next_incl, op);
499 ClearKeyNamesInfo(&next_incl);
503 info->errorCount += 10; /* XXX: Why 10?? */
504 ClearKeyNamesInfo(&included);
512 MergeIncludedKeycodes(info, keymap, &included, newMerge);
513 ClearKeyNamesInfo(&included);
515 return (info->errorCount == 0);
519 * Parse the given statement and store the output in the info struct.
523 HandleKeycodeDef(KeycodeDef *stmt, enum merge_mode merge, KeyNamesInfo *info)
525 if ((info->explicitMin != 0 && stmt->value < info->explicitMin) ||
526 (info->explicitMax != 0 && stmt->value > info->explicitMax)) {
527 ERROR("Illegal keycode %lu for name <%s>\n", stmt->value, stmt->name);
528 ACTION("Must be in the range %d-%d inclusive\n",
530 info->explicitMax ? info->explicitMax : XKB_KEYCODE_MAX);
533 if (stmt->merge != MERGE_DEFAULT) {
534 if (stmt->merge == MERGE_REPLACE)
535 merge = MERGE_OVERRIDE;
539 return AddKeyName(info, stmt->value, stmt->name, merge, info->file_id,
544 HandleAliasCollision(AliasInfo *old, AliasInfo *new)
546 if (strncmp(new->real, old->real, XkbKeyNameLength) == 0) {
547 if ((new->file_id == old->file_id && warningLevel > 0) ||
549 WARN("Alias of %s for %s declared more than once\n",
550 XkbcKeyNameText(new->alias), XkbcKeyNameText(new->real));
551 ACTION("First definition ignored\n");
557 if (new->merge == MERGE_AUGMENT) {
566 if ((old->file_id == new->file_id && warningLevel > 0) ||
568 WARN("Multiple definitions for alias %s\n",
569 XkbcKeyNameText(old->alias));
570 ACTION("Using %s, ignoring %s\n",
571 XkbcKeyNameText(use), XkbcKeyNameText(ignore));
574 if (use != old->real)
575 memcpy(old->real, use, XkbKeyNameLength);
578 old->file_id = new->file_id;
579 old->merge = new->merge;
583 HandleAliasDef(KeyAliasDef *def, enum merge_mode merge, unsigned file_id,
588 list_foreach(alias, &info->aliases, entry) {
589 if (strncmp(alias->alias, def->alias, XkbKeyNameLength) == 0) {
591 InitAliasInfo(&new, merge, file_id, def->alias, def->real);
592 HandleAliasCollision(alias, &new);
597 alias = calloc(1, sizeof(*alias));
599 WSGO("Allocation failure in HandleAliasDef\n");
603 alias->file_id = file_id;
604 alias->merge = merge;
605 memcpy(alias->alias, def->alias, XkbKeyNameLength);
606 memcpy(alias->real, def->real, XkbKeyNameLength);
607 list_append(&alias->entry, &info->aliases);
612 #define MIN_KEYCODE_DEF 0
613 #define MAX_KEYCODE_DEF 1
616 * Handle the minimum/maximum statement of the xkb file.
617 * Sets explicitMin/Max of the info struct.
619 * @return 1 on success, 0 otherwise.
622 HandleKeyNameVar(VarDef *stmt, struct xkb_keymap *keymap, KeyNamesInfo *info)
624 ExprResult tmp, field;
628 if (ExprResolveLhs(keymap, stmt->name, &tmp, &field, &arrayNdx) == 0)
629 return 0; /* internal error, already reported */
631 if (tmp.str != NULL) {
632 ERROR("Unknown element %s encountered\n", tmp.str);
633 ACTION("Default for field %s ignored\n", field.str);
636 if (strcasecmp(field.str, "minimum") == 0)
637 which = MIN_KEYCODE_DEF;
638 else if (strcasecmp(field.str, "maximum") == 0)
639 which = MAX_KEYCODE_DEF;
641 ERROR("Unknown field encountered\n");
642 ACTION("Assigment to field %s ignored\n", field.str);
645 if (arrayNdx != NULL) {
646 ERROR("The %s setting is not an array\n", field.str);
647 ACTION("Illegal array reference ignored\n");
651 if (ExprResolveKeyCode(keymap->ctx, stmt->value, &tmp) == 0) {
652 ACTION("Assignment to field %s ignored\n", field.str);
655 if (tmp.uval > XKB_KEYCODE_MAX) {
657 ("Illegal keycode %d (must be in the range %d-%d inclusive)\n",
658 tmp.uval, 0, XKB_KEYCODE_MAX);
659 ACTION("Value of \"%s\" not changed\n", field.str);
662 if (which == MIN_KEYCODE_DEF) {
663 if ((info->explicitMax > 0) && (info->explicitMax < tmp.uval)) {
665 ("Minimum key code (%d) must be <= maximum key code (%d)\n",
666 tmp.uval, info->explicitMax);
667 ACTION("Minimum key code value not changed\n");
670 if ((info->computedMax > 0) && (info->computedMin < tmp.uval)) {
672 ("Minimum key code (%d) must be <= lowest defined key (%d)\n",
673 tmp.uval, info->computedMin);
674 ACTION("Minimum key code value not changed\n");
677 info->explicitMin = tmp.uval;
679 if (which == MAX_KEYCODE_DEF) {
680 if ((info->explicitMin > 0) && (info->explicitMin > tmp.uval)) {
681 ERROR("Maximum code (%d) must be >= minimum key code (%d)\n",
682 tmp.uval, info->explicitMin);
683 ACTION("Maximum code value not changed\n");
686 if ((info->computedMax > 0) && (info->computedMax > tmp.uval)) {
688 ("Maximum code (%d) must be >= highest defined key (%d)\n",
689 tmp.uval, info->computedMax);
690 ACTION("Maximum code value not changed\n");
693 info->explicitMax = tmp.uval;
705 HandleIndicatorNameDef(IndicatorNameDef *def, struct xkb_keymap *keymap,
706 enum merge_mode merge, KeyNamesInfo *info)
708 IndicatorNameInfo ii;
711 if ((def->ndx < 1) || (def->ndx > XkbNumIndicators)) {
713 ERROR("Name specified for illegal indicator index %d\n", def->ndx);
717 InitIndicatorNameInfo(&ii, info);
719 if (!ExprResolveString(keymap->ctx, def->name, &tmp)) {
721 snprintf(buf, sizeof(buf), "%d", def->ndx);
723 return ReportBadType("indicator", "name", buf, "string");
725 ii.name = xkb_atom_intern(keymap->ctx, tmp.str);
727 ii.virtual = def->virtual;
728 if (!AddIndicatorName(info, keymap, merge, &ii))
734 * Handle the xkb_keycodes section of a xkb file.
735 * All information about parsed keys is stored in the info struct.
737 * Such a section may have include statements, in which case this function is
738 * semi-recursive (it calls HandleIncludeKeycodes, which may call
739 * HandleKeycodesFile again).
741 * @param file The input file (parsed xkb_keycodes section)
742 * @param xkb Necessary to pass down, may have flags changed.
743 * @param merge Merge strategy (MERGE_OVERRIDE, etc.)
744 * @param info Struct to contain the fully parsed key information.
747 HandleKeycodesFile(XkbFile *file, struct xkb_keymap *keymap,
748 enum merge_mode merge, KeyNamesInfo *info)
753 info->name = uDupString(file->name);
757 switch (stmt->stmtType) {
758 case StmtInclude: /* e.g. include "evdev+aliases(qwerty)" */
759 if (!HandleIncludeKeycodes((IncludeStmt *) stmt, keymap, info))
762 case StmtKeycodeDef: /* e.g. <ESC> = 9; */
763 if (!HandleKeycodeDef((KeycodeDef *) stmt, merge, info))
766 case StmtKeyAliasDef: /* e.g. alias <MENU> = <COMP>; */
767 if (!HandleAliasDef((KeyAliasDef *) stmt, merge, info->file_id,
771 case StmtVarDef: /* e.g. minimum, maximum */
772 if (!HandleKeyNameVar((VarDef *) stmt, keymap, info))
775 case StmtIndicatorNameDef: /* e.g. indicator 1 = "Caps Lock"; */
776 if (!HandleIndicatorNameDef((IndicatorNameDef *) stmt, keymap,
782 ERROR("Keycode files may define key and indicator names only\n");
783 ACTION("Ignoring definition of %s\n",
785 StmtInterpDef) ? "a symbol interpretation" :
786 "virtual modifiers"));
790 WSGO("Unexpected statement type %d in HandleKeycodesFile\n",
795 if (info->errorCount > 10) {
797 ERROR("Too many errors\n");
799 ACTION("Abandoning keycodes file \"%s\"\n", file->topName);
806 ApplyAliases(struct xkb_keymap *keymap, KeyNamesInfo *info)
810 struct xkb_key_alias *old, *a;
811 AliasInfo *alias, *next;
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 if (warningLevel > 4) {
824 WARN("Attempt to alias %s to non-existent key %s\n",
825 XkbcKeyNameText(alias->alias),
826 XkbcKeyNameText(alias->real));
829 alias->alias[0] = '\0';
833 lname = KeyNameToLong(alias->alias);
834 key = FindNamedKey(keymap, lname, false, false, 0);
836 if (warningLevel > 4) {
837 WARN("Attempt to create alias with the name of a real key\n");
838 ACTION("Alias \"%s = %s\" ignored\n",
839 XkbcKeyNameText(alias->alias),
840 XkbcKeyNameText(alias->real));
842 alias->alias[0] = '\0';
851 for (i = 0, a = old; i < nOld; i++, a++) {
854 if (strncmp(a->alias, alias->alias, XkbKeyNameLength) != 0)
857 InitAliasInfo(&old_alias, MERGE_AUGMENT, 0, a->alias, a->real);
858 HandleAliasCollision(&old_alias, alias);
859 memcpy(old_alias.real, a->real, XkbKeyNameLength);
860 alias->alias[0] = '\0';
869 darray_resize0(keymap->key_aliases, nOld + nNew);
871 a = &darray_item(keymap->key_aliases, nOld);
872 list_foreach(alias, &info->aliases, entry) {
873 if (alias->alias[0] != '\0') {
874 strncpy(a->alias, alias->alias, XkbKeyNameLength);
875 strncpy(a->real, alias->real, XkbKeyNameLength);
881 list_foreach_safe(alias, next, &info->aliases, entry)
883 list_init(&info->aliases);
888 * Compile the xkb_keycodes section, parse it's output, return the results.
890 * @param file The parsed XKB file (may have include statements requiring
892 * @param result The effective keycodes, as gathered from the file.
893 * @param merge Merge strategy.
895 * @return true on success, false otherwise.
898 CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
899 enum merge_mode merge)
902 KeyNamesInfo info; /* contains all the info after parsing */
903 IndicatorNameInfo *ii;
905 InitKeyNamesInfo(&info, file->id);
907 HandleKeycodesFile(file, keymap, merge, &info);
909 /* all the keys are now stored in info */
911 if (info.errorCount != 0)
914 if (info.explicitMin > 0) /* if "minimum" statement was present */
915 keymap->min_key_code = info.explicitMin;
917 keymap->min_key_code = info.computedMin;
919 if (info.explicitMax > 0) /* if "maximum" statement was present */
920 keymap->max_key_code = info.explicitMax;
922 keymap->max_key_code = info.computedMax;
924 darray_resize0(keymap->keys, keymap->max_key_code + 1);
925 for (kc = info.computedMin; kc <= info.computedMax; kc++)
926 LongToKeyName(darray_item(info.names, kc),
927 XkbKey(keymap, kc)->name);
930 keymap->keycodes_section_name = strdup(info.name);
932 list_foreach(ii, &info.leds, entry) {
933 free(keymap->indicator_names[ii->ndx - 1]);
934 keymap->indicator_names[ii->ndx - 1] =
935 xkb_atom_strdup(keymap->ctx, ii->name);
938 ApplyAliases(keymap, &info);
940 ClearKeyNamesInfo(&info);
944 ClearKeyNamesInfo(&info);