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, int 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 && strcmp(stmt->file, "computed") == 0) {
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) {
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 XkbcKeyNameText(new->alias), XkbcKeyNameText(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 XkbcKeyNameText(old->alias), XkbcKeyNameText(use),
559 XkbcKeyNameText(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 ExprResult tmp, field;
615 if (ExprResolveLhs(info->keymap, stmt->name, &tmp, &field,
617 return 0; /* internal error, already reported */
619 if (tmp.str != NULL) {
620 log_err(info->keymap->ctx,
621 "Unknown element %s encountered; "
622 "Default for field %s ignored\n", tmp.str, field.str);
626 if (strcasecmp(field.str, "minimum") == 0)
627 which = MIN_KEYCODE_DEF;
628 else if (strcasecmp(field.str, "maximum") == 0)
629 which = MAX_KEYCODE_DEF;
631 log_err(info->keymap->ctx,
632 "Unknown field encountered; "
633 "Assigment to field %s ignored\n", field.str);
637 if (arrayNdx != NULL) {
638 log_err(info->keymap->ctx,
639 "The %s setting is not an array; "
640 "Illegal array reference ignored\n", field.str);
644 if (ExprResolveKeyCode(info->keymap->ctx, stmt->value, &tmp) == 0) {
645 log_err(info->keymap->ctx,
646 "Illegal keycode encountered; "
647 "Assignment to field %s ignored\n", field.str);
651 if (tmp.uval > XKB_KEYCODE_MAX) {
652 log_err(info->keymap->ctx,
653 "Illegal keycode %d (must be in the range %d-%d inclusive); "
654 "Value of \"%s\" not changed\n",
655 tmp.uval, 0, XKB_KEYCODE_MAX, field.str);
659 if (which == MIN_KEYCODE_DEF) {
660 if ((info->explicitMax > 0) && (info->explicitMax < tmp.uval)) {
661 log_err(info->keymap->ctx,
662 "Minimum key code (%d) must be <= maximum key code (%d); "
663 "Minimum key code value not changed\n",
664 tmp.uval, info->explicitMax);
667 if ((info->computedMax > 0) && (info->computedMin < tmp.uval)) {
668 log_err(info->keymap->ctx,
669 "Minimum key code (%d) must be <= lowest defined key (%d); "
670 "Minimum key code value not changed\n",
671 tmp.uval, info->computedMin);
674 info->explicitMin = tmp.uval;
677 if (which == MAX_KEYCODE_DEF) {
678 if ((info->explicitMin > 0) && (info->explicitMin > tmp.uval)) {
679 log_err(info->keymap->ctx,
680 "Maximum code (%d) must be >= minimum key code (%d); "
681 "Maximum code value not changed\n",
682 tmp.uval, info->explicitMin);
685 if ((info->computedMax > 0) && (info->computedMax > tmp.uval)) {
686 log_err(info->keymap->ctx,
687 "Maximum code (%d) must be >= highest defined key (%d); "
688 "Maximum code value not changed\n",
689 tmp.uval, info->computedMax);
692 info->explicitMax = tmp.uval;
702 HandleIndicatorNameDef(KeyNamesInfo *info, IndicatorNameDef *def,
703 enum merge_mode merge)
705 IndicatorNameInfo ii;
708 if ((def->ndx < 1) || (def->ndx > XkbNumIndicators)) {
710 log_err(info->keymap->ctx,
711 "Name specified for illegal indicator index %d\n; Ignored\n",
715 InitIndicatorNameInfo(&ii, info);
717 if (!ExprResolveString(info->keymap->ctx, def->name, &tmp)) {
719 snprintf(buf, sizeof(buf), "%d", def->ndx);
721 return ReportBadType(info->keymap, "indicator", "name", buf,
724 ii.name = xkb_atom_intern(info->keymap->ctx, tmp.str);
725 ii.virtual = def->virtual;
727 return AddIndicatorName(info, merge, &ii);
731 * Handle the xkb_keycodes section of a xkb file.
732 * All information about parsed keys is stored in the info struct.
734 * Such a section may have include statements, in which case this function is
735 * semi-recursive (it calls HandleIncludeKeycodes, which may call
736 * HandleKeycodesFile again).
738 * @param info Struct to contain the fully parsed key information.
739 * @param file The input file (parsed xkb_keycodes section)
740 * @param merge Merge strategy (MERGE_OVERRIDE, etc.)
743 HandleKeycodesFile(KeyNamesInfo *info, XkbFile *file, enum merge_mode merge)
748 info->name = uDupString(file->name);
752 switch (stmt->stmtType) {
753 case StmtInclude: /* e.g. include "evdev+aliases(qwerty)" */
754 if (!HandleIncludeKeycodes(info, (IncludeStmt *) stmt))
757 case StmtKeycodeDef: /* e.g. <ESC> = 9; */
758 if (!HandleKeycodeDef(info, (KeycodeDef *) stmt, merge))
761 case StmtKeyAliasDef: /* e.g. alias <MENU> = <COMP>; */
762 if (!HandleAliasDef(info, (KeyAliasDef *) stmt, merge,
766 case StmtVarDef: /* e.g. minimum, maximum */
767 if (!HandleKeyNameVar(info, (VarDef *) stmt))
770 case StmtIndicatorNameDef: /* e.g. indicator 1 = "Caps Lock"; */
771 if (!HandleIndicatorNameDef(info, (IndicatorNameDef *) stmt,
777 log_err(info->keymap->ctx,
778 "Keycode files may define key and indicator names only; "
779 "Ignoring definition of %s\n",
780 (stmt->stmtType == StmtInterpDef ?
781 "a symbol interpretation" : "virtual modifiers"));
785 log_wsgo(info->keymap->ctx,
786 "Unexpected statement type %d in HandleKeycodesFile\n",
791 if (info->errorCount > 10) {
792 log_err(info->keymap->ctx, "Abandoning keycodes file \"%s\"\n",
800 ApplyAliases(KeyNamesInfo *info)
804 struct xkb_key_alias *old, *a;
805 AliasInfo *alias, *next;
807 struct xkb_keymap *keymap = info->keymap;
809 nOld = darray_size(keymap->key_aliases);
810 old = &darray_item(keymap->key_aliases, 0);
812 list_foreach(alias, &info->aliases, entry) {
815 lname = KeyNameToLong(alias->real);
816 key = FindNamedKey(keymap, lname, false, CreateKeyNames(keymap), 0);
818 log_lvl(info->keymap->ctx, 5,
819 "Attempt to alias %s to non-existent key %s; "
821 XkbcKeyNameText(alias->alias),
822 XkbcKeyNameText(alias->real));
823 alias->alias[0] = '\0';
827 lname = KeyNameToLong(alias->alias);
828 key = FindNamedKey(keymap, lname, false, false, 0);
830 log_lvl(info->keymap->ctx, 5,
831 "Attempt to create alias with the name of a real key; "
832 "Alias \"%s = %s\" ignored\n",
833 XkbcKeyNameText(alias->alias),
834 XkbcKeyNameText(alias->real));
835 alias->alias[0] = '\0';
844 for (i = 0, a = old; i < nOld; i++, a++) {
847 if (strncmp(a->alias, alias->alias, XkbKeyNameLength) != 0)
850 InitAliasInfo(&old_alias, MERGE_AUGMENT, 0, a->alias, a->real);
851 HandleAliasCollision(info, &old_alias, alias);
852 memcpy(old_alias.real, a->real, XkbKeyNameLength);
853 alias->alias[0] = '\0';
862 darray_resize0(keymap->key_aliases, nOld + nNew);
864 a = &darray_item(keymap->key_aliases, nOld);
865 list_foreach(alias, &info->aliases, entry) {
866 if (alias->alias[0] != '\0') {
867 strncpy(a->alias, alias->alias, XkbKeyNameLength);
868 strncpy(a->real, alias->real, XkbKeyNameLength);
874 list_foreach_safe(alias, next, &info->aliases, entry)
876 list_init(&info->aliases);
881 * Compile the xkb_keycodes section, parse it's output, return the results.
883 * @param file The parsed XKB file (may have include statements requiring
885 * @param result The effective keycodes, as gathered from the file.
886 * @param merge Merge strategy.
888 * @return true on success, false otherwise.
891 CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
892 enum merge_mode merge)
895 KeyNamesInfo info; /* contains all the info after parsing */
896 IndicatorNameInfo *ii;
898 InitKeyNamesInfo(&info, keymap, file->id);
900 HandleKeycodesFile(&info, file, merge);
902 /* all the keys are now stored in info */
904 if (info.errorCount != 0)
907 if (info.explicitMin > 0) /* if "minimum" statement was present */
908 keymap->min_key_code = info.explicitMin;
910 keymap->min_key_code = info.computedMin;
912 if (info.explicitMax > 0) /* if "maximum" statement was present */
913 keymap->max_key_code = info.explicitMax;
915 keymap->max_key_code = info.computedMax;
917 darray_resize0(keymap->keys, keymap->max_key_code + 1);
918 for (kc = info.computedMin; kc <= info.computedMax; kc++)
919 LongToKeyName(darray_item(info.names, kc),
920 XkbKey(keymap, kc)->name);
923 keymap->keycodes_section_name = strdup(info.name);
925 list_foreach(ii, &info.leds, entry) {
926 keymap->indicator_names[ii->ndx - 1] =
927 xkb_atom_text(keymap->ctx, ii->name);
932 ClearKeyNamesInfo(&info);
936 ClearKeyNamesInfo(&info);