Don't limit key names to 4 characters Currently you can't give a key in xkb_keycodes a name of more than XKB_KEY_NAME_LENGTH (= 4) chars. This is a pretty annoying and arbitrary limitation; it leads to names such as <RTSH>, <COMP>, <PRSC>, <KPAD> etc. which may be hard to decipher, and makes it impossible to give more standard names (e.g. from linux/input.h) to keycodes. The purpose of this, as far as I can tell, was to save memory and to allow encoding a key name directly to a 32 bit value (unsigned long it was). We remove this limitation by just storing the names as atoms; this lifts the limit, allows for easy comparison like the unsigned long thing, and doesn't use more memory than previous solution. It also relieves us from doing all of the annoying conversions to/from long. This has a large diffstat only because KeyNameText, which is used a lot, now needs to take the context in order to resolve the atom. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129
diff --git a/src/keymap-dump.c b/src/keymap-dump.c
index d2f9774..e31e875 100644
--- a/src/keymap-dump.c
+++ b/src/keymap-dump.c
@@ -235,11 +235,11 @@ write_keycodes(struct xkb_keymap *keymap, struct buf *buf)
write_buf(buf, "\txkb_keycodes {\n");
xkb_foreach_key(key, keymap) {
- if (key->name[0] == '\0')
+ if (key->name == XKB_ATOM_NONE)
continue;
write_buf(buf, "\t\t%6s = %d;\n",
- KeyNameText(key->name), key->keycode);
+ KeyNameText(keymap->ctx, key->name), key->keycode);
}
for (i = 0; i < XKB_NUM_INDICATORS; i++) {
@@ -251,9 +251,9 @@ write_keycodes(struct xkb_keymap *keymap, struct buf *buf)
darray_foreach(alias, keymap->key_aliases)
- write_buf(buf, "\t\talias %6s = %6s;\n",
- KeyNameText(alias->alias),
- KeyNameText(alias->real));
+ write_buf(buf, "\t\talias %6s = %s;\n",
+ KeyNameText(keymap->ctx, alias->alias),
+ KeyNameText(keymap->ctx, alias->real));
write_buf(buf, "\t};\n\n");
return true;
@@ -628,7 +628,7 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf)
if (key->num_groups == 0)
continue;
- write_buf(buf, "\t\tkey %6s {", KeyNameText(key->name));
+ write_buf(buf, "\t\tkey %6s {", KeyNameText(keymap->ctx, key->name));
for (group = 0; group < key->num_groups; group++) {
if (key->groups[group].explicit_type)
@@ -738,7 +738,8 @@ write_symbols(struct xkb_keymap *keymap, struct buf *buf)
continue;
write_buf(buf, "\t\tmodifier_map %s { %s };\n",
- ModIndexToName(mod), KeyNameText(key->name));
+ ModIndexToName(mod),
+ KeyNameText(keymap->ctx, key->name));
}
}
diff --git a/src/keymap.h b/src/keymap.h
index 014ad72..2471d19 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -88,8 +88,6 @@
#include "utils.h"
#include "context.h"
-#define XKB_KEY_NAME_LENGTH 4
-
/* This limit is artificially enforced, we do not depend on it any where.
* The reason it's still here is that the rules file format does not
* support multiple groups very well, and the rules shipped with
@@ -287,8 +285,8 @@ struct xkb_indicator_map {
};
struct xkb_key_alias {
- char real[XKB_KEY_NAME_LENGTH];
- char alias[XKB_KEY_NAME_LENGTH];
+ xkb_atom_t real;
+ xkb_atom_t alias;
};
struct xkb_controls {
@@ -339,7 +337,7 @@ struct xkb_group {
struct xkb_key {
xkb_keycode_t keycode;
- char name[XKB_KEY_NAME_LENGTH];
+ xkb_atom_t name;
enum xkb_explicit_components explicit;
diff --git a/src/text.c b/src/text.c
index f0322fa..ad0a4d6 100644
--- a/src/text.c
+++ b/src/text.c
@@ -428,19 +428,12 @@ KeysymText(xkb_keysym_t sym)
}
const char *
-KeyNameText(const char name[XKB_KEY_NAME_LENGTH])
+KeyNameText(struct xkb_context *ctx, xkb_atom_t name)
{
- char *buf;
- int len;
-
- buf = GetBuffer(7);
- buf[0] = '<';
- strncpy(&buf[1], name, 4);
- buf[5] = '\0';
- len = strlen(buf);
- buf[len++] = '>';
- buf[len] = '\0';
-
+ const char *sname = xkb_atom_text(ctx, name);
+ size_t len = strlen(sname) + 3;
+ char *buf = GetBuffer(len);
+ snprintf(buf, len, "<%s>", sname);
return buf;
}
diff --git a/src/text.h b/src/text.h
index 56d2ec9..e38ed20 100644
--- a/src/text.h
+++ b/src/text.h
@@ -69,7 +69,7 @@ const char *
KeysymText(xkb_keysym_t sym);
const char *
-KeyNameText(const char name[XKB_KEY_NAME_LENGTH]);
+KeyNameText(struct xkb_context *ctx, xkb_atom_t name);
const char *
SIMatchText(unsigned type);
diff --git a/src/xkbcomp/ast-build.c b/src/xkbcomp/ast-build.c
index 09774d7..dcfbb38 100644
--- a/src/xkbcomp/ast-build.c
+++ b/src/xkbcomp/ast-build.c
@@ -137,7 +137,7 @@ ExprCreateBinary(enum expr_op_type op, ExprDef *left, ExprDef *right)
}
KeycodeDef *
-KeycodeCreate(char keyName[XKB_KEY_NAME_LENGTH], unsigned long value)
+KeycodeCreate(xkb_atom_t name, unsigned long value)
{
KeycodeDef *def;
@@ -145,13 +145,13 @@ KeycodeCreate(char keyName[XKB_KEY_NAME_LENGTH], unsigned long value)
def->common.type = STMT_KEYCODE;
def->common.next = NULL;
- strncpy(def->name, keyName, XKB_KEY_NAME_LENGTH);
+ def->name = name;
def->value = value;
return def;
}
KeyAliasDef *
-KeyAliasCreate(char alias[XKB_KEY_NAME_LENGTH], char real[XKB_KEY_NAME_LENGTH])
+KeyAliasCreate(xkb_atom_t alias, xkb_atom_t real)
{
KeyAliasDef *def;
@@ -159,8 +159,8 @@ KeyAliasCreate(char alias[XKB_KEY_NAME_LENGTH], char real[XKB_KEY_NAME_LENGTH])
def->common.type = STMT_ALIAS;
def->common.next = NULL;
- strncpy(def->alias, alias, XKB_KEY_NAME_LENGTH);
- strncpy(def->real, real, XKB_KEY_NAME_LENGTH);
+ def->alias = alias;
+ def->real = real;
return def;
}
@@ -233,7 +233,7 @@ KeyTypeCreate(xkb_atom_t name, VarDef * body)
}
SymbolsDef *
-SymbolsCreate(char keyName[XKB_KEY_NAME_LENGTH], ExprDef *symbols)
+SymbolsCreate(xkb_atom_t keyName, ExprDef *symbols)
{
SymbolsDef *def;
@@ -242,7 +242,7 @@ SymbolsCreate(char keyName[XKB_KEY_NAME_LENGTH], ExprDef *symbols)
def->common.type = STMT_SYMBOLS;
def->common.next = NULL;
def->merge = MERGE_DEFAULT;
- strncpy(def->keyName, keyName, XKB_KEY_NAME_LENGTH);
+ def->keyName = keyName;
def->symbols = symbols;
return def;
}
diff --git a/src/xkbcomp/ast-build.h b/src/xkbcomp/ast-build.h
index 4f19d2c..d433240 100644
--- a/src/xkbcomp/ast-build.h
+++ b/src/xkbcomp/ast-build.h
@@ -41,10 +41,10 @@ ExprDef *
ExprCreateBinary(enum expr_op_type op, ExprDef *left, ExprDef *right);
KeycodeDef *
-KeycodeCreate(char keyName[XKB_KEY_NAME_LENGTH], unsigned long value);
+KeycodeCreate(xkb_atom_t name, unsigned long value);
KeyAliasDef *
-KeyAliasCreate(char keyName[XKB_KEY_NAME_LENGTH], char real[XKB_KEY_NAME_LENGTH]);
+KeyAliasCreate(xkb_atom_t alias, xkb_atom_t real);
VModDef *
VModCreate(xkb_atom_t name, ExprDef *value);
@@ -62,7 +62,7 @@ KeyTypeDef *
KeyTypeCreate(xkb_atom_t name, VarDef *body);
SymbolsDef *
-SymbolsCreate(char keyName[XKB_KEY_NAME_LENGTH], ExprDef *symbols);
+SymbolsCreate(xkb_atom_t keyName, ExprDef *symbols);
GroupCompatDef *
GroupCompatCreate(int group, ExprDef *def);
diff --git a/src/xkbcomp/ast.h b/src/xkbcomp/ast.h
index 5b410ca..4d8bc83 100644
--- a/src/xkbcomp/ast.h
+++ b/src/xkbcomp/ast.h
@@ -189,7 +189,7 @@ typedef struct _Expr {
xkb_atom_t str;
unsigned uval;
int ival;
- char keyName[XKB_KEY_NAME_LENGTH];
+ xkb_atom_t keyName;
} value;
} ExprDef;
@@ -210,15 +210,15 @@ typedef struct _VModDef {
typedef struct _KeycodeDef {
ParseCommon common;
enum merge_mode merge;
- char name[XKB_KEY_NAME_LENGTH];
+ xkb_atom_t name;
unsigned long value;
} KeycodeDef;
typedef struct _KeyAliasDef {
ParseCommon common;
enum merge_mode merge;
- char alias[XKB_KEY_NAME_LENGTH];
- char real[XKB_KEY_NAME_LENGTH];
+ xkb_atom_t alias;
+ xkb_atom_t real;
} KeyAliasDef;
typedef struct _KeyTypeDef {
@@ -231,7 +231,7 @@ typedef struct _KeyTypeDef {
typedef struct _SymbolsDef {
ParseCommon common;
enum merge_mode merge;
- char keyName[XKB_KEY_NAME_LENGTH];
+ xkb_atom_t keyName;
ExprDef *symbols;
} SymbolsDef;
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index 2c5af55..f134d85 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -37,8 +37,7 @@
* This is the simplest section type, and is the first one to be
* compiled. The purpose of this is mostly to map between the
* hardware/evdev scancodes and xkb keycodes. Each key is given a name
- * of up to 4 letters, by which it can be referred to later, e.g. in the
- * symbols section.
+ * by which it can be referred to later, e.g. in the symbols section.
*
* Keycode statements
* ------------------
@@ -67,10 +66,6 @@
* or same keycode given different names, it is resolved according to the
* merge mode which applies to the definitions.
*
- * The reason for the 4 characters limit is that the name is sometimes
- * converted to an unsigned long (in a direct mapping), instead of a char
- * array (see KeyNameToLong, LongToKeyName).
- *
* Alias statements
* ----------------
* Statements of the form:
@@ -112,13 +107,13 @@ typedef struct _AliasInfo {
enum merge_mode merge;
unsigned file_id;
- unsigned long alias;
- unsigned long real;
+ xkb_atom_t alias;
+ xkb_atom_t real;
} AliasInfo;
typedef struct {
unsigned int file_id;
- unsigned long name;
+ xkb_atom_t name;
} KeyNameInfo;
typedef struct _IndicatorNameInfo {
@@ -145,13 +140,13 @@ typedef struct _KeyNamesInfo {
static void
InitAliasInfo(AliasInfo *info, enum merge_mode merge, unsigned file_id,
- char alias[XKB_KEY_NAME_LENGTH], char real[XKB_KEY_NAME_LENGTH])
+ xkb_atom_t alias, xkb_atom_t real)
{
memset(info, 0, sizeof(*info));
info->merge = merge;
info->file_id = file_id;
- info->alias = KeyNameToLong(alias);
- info->real = KeyNameToLong(real);
+ info->alias = alias;
+ info->real = real;
}
static IndicatorNameInfo *
@@ -262,7 +257,7 @@ InitKeyNamesInfo(KeyNamesInfo *info, struct xkb_context *ctx,
}
static xkb_keycode_t
-FindKeyByLong(KeyNamesInfo * info, unsigned long name)
+FindKeyByName(KeyNamesInfo * info, xkb_atom_t name)
{
xkb_keycode_t i;
@@ -274,7 +269,7 @@ FindKeyByLong(KeyNamesInfo * info, unsigned long name)
}
static bool
-AddKeyName(KeyNamesInfo *info, xkb_keycode_t kc, unsigned long name,
+AddKeyName(KeyNamesInfo *info, xkb_keycode_t kc, xkb_atom_t name,
enum merge_mode merge, unsigned file_id, bool report)
{
KeyNameInfo *namei;
@@ -293,8 +288,8 @@ AddKeyName(KeyNamesInfo *info, xkb_keycode_t kc, unsigned long name,
verbosity > 7);
if (namei->name != 0) {
- const char *lname = LongKeyNameText(namei->name);
- const char *kname = LongKeyNameText(name);
+ const char *lname = KeyNameText(info->ctx, namei->name);
+ const char *kname = KeyNameText(info->ctx, name);
if (namei->name == name) {
if (report)
@@ -321,9 +316,9 @@ AddKeyName(KeyNamesInfo *info, xkb_keycode_t kc, unsigned long name,
}
}
- old = FindKeyByLong(info, name);
+ old = FindKeyByName(info, name);
if (old != XKB_KEYCODE_INVALID && old != kc) {
- const char *kname = LongKeyNameText(name);
+ const char *kname = KeyNameText(info->ctx, name);
if (merge == MERGE_OVERRIDE) {
darray_item(info->key_names, old).name = 0;
@@ -372,8 +367,8 @@ MergeAliases(KeyNamesInfo *into, KeyNamesInfo *from, enum merge_mode merge)
darray_foreach(alias, from->aliases) {
def.merge = (merge == MERGE_DEFAULT) ? alias->merge : merge;
- LongToKeyName(alias->alias, def.alias);
- LongToKeyName(alias->real, def.real);
+ def.alias = alias->alias;
+ def.real = alias->real;
if (!HandleAliasDef(into, &def, def.merge, alias->file_id))
return false;
@@ -403,8 +398,8 @@ MergeIncludedKeycodes(KeyNamesInfo *into, KeyNamesInfo *from,
darray_resize0(into->key_names, darray_size(from->key_names));
for (i = from->min_key_code; i <= from->max_key_code; i++) {
- unsigned long name = darray_item(from->key_names, i).name;
- if (name == 0)
+ xkb_atom_t name = darray_item(from->key_names, i).name;
+ if (name == XKB_ATOM_NONE)
continue;
if (!AddKeyName(into, i, name, merge, from->file_id, false))
@@ -476,7 +471,7 @@ HandleKeycodeDef(KeyNamesInfo *info, KeycodeDef *stmt, enum merge_mode merge)
merge = stmt->merge;
}
- return AddKeyName(info, stmt->value, KeyNameToLong(stmt->name), merge,
+ return AddKeyName(info, stmt->value, stmt->name, merge,
info->file_id, true);
}
@@ -491,10 +486,11 @@ HandleAliasCollision(KeyNamesInfo *info, AliasInfo *old, AliasInfo *new)
if (report)
log_warn(info->ctx, "Alias of %s for %s declared more than once; "
"First definition ignored\n",
- LongKeyNameText(new->alias), LongKeyNameText(new->real));
+ KeyNameText(info->ctx, new->alias),
+ KeyNameText(info->ctx, new->real));
}
else {
- unsigned long use, ignore;
+ xkb_atom_t use, ignore;
use = (new->merge == MERGE_AUGMENT ? old->real : new->real);
ignore = (new->merge == MERGE_AUGMENT ? new->real : old->real);
@@ -502,8 +498,9 @@ HandleAliasCollision(KeyNamesInfo *info, AliasInfo *old, AliasInfo *new)
if (report)
log_warn(info->ctx, "Multiple definitions for alias %s; "
"Using %s, ignoring %s\n",
- LongKeyNameText(old->alias), LongKeyNameText(use),
- LongKeyNameText(ignore));
+ KeyNameText(info->ctx, old->alias),
+ KeyNameText(info->ctx, use),
+ KeyNameText(info->ctx, ignore));
old->real = use;
}
@@ -519,7 +516,7 @@ HandleAliasDef(KeyNamesInfo *info, KeyAliasDef *def, enum merge_mode merge,
AliasInfo *alias, new;
darray_foreach(alias, info->aliases) {
- if (alias->alias == KeyNameToLong(def->alias)) {
+ if (alias->alias == def->alias) {
InitAliasInfo(&new, merge, file_id, def->alias, def->real);
HandleAliasCollision(info, alias, &new);
return true;
@@ -645,8 +642,8 @@ ApplyAliases(KeyNamesInfo *info, struct xkb_keymap *keymap)
if (!key) {
log_vrb(info->ctx, 5,
"Attempt to alias %s to non-existent key %s; Ignored\n",
- LongKeyNameText(alias->alias),
- LongKeyNameText(alias->real));
+ KeyNameText(info->ctx, alias->alias),
+ KeyNameText(info->ctx, alias->real));
continue;
}
@@ -656,8 +653,8 @@ ApplyAliases(KeyNamesInfo *info, struct xkb_keymap *keymap)
log_vrb(info->ctx, 5,
"Attempt to create alias with the name of a real key; "
"Alias \"%s = %s\" ignored\n",
- LongKeyNameText(alias->alias),
- LongKeyNameText(alias->real));
+ KeyNameText(info->ctx, alias->alias),
+ KeyNameText(info->ctx, alias->real));
continue;
}
@@ -665,21 +662,21 @@ ApplyAliases(KeyNamesInfo *info, struct xkb_keymap *keymap)
darray_foreach(a, keymap->key_aliases) {
AliasInfo old_alias;
- if (KeyNameToLong(a->alias) != alias->alias)
+ if (a->alias != alias->alias)
continue;
InitAliasInfo(&old_alias, MERGE_AUGMENT, 0, a->alias, a->real);
HandleAliasCollision(info, &old_alias, alias);
- LongToKeyName(old_alias.alias, a->alias);
- LongToKeyName(old_alias.real, a->real);
+ a->alias = old_alias.alias;
+ a->real = old_alias.real;
alias->alias = 0;
}
if (alias->alias == 0)
continue;
/* Add the alias. */
- LongToKeyName(alias->alias, new.alias);
- LongToKeyName(alias->real, new.real);
+ new.alias = alias->alias;
+ new.real = alias->real;
darray_append(keymap->key_aliases, new);
}
@@ -699,8 +696,7 @@ CopyKeyNamesToKeymap(struct xkb_keymap *keymap, KeyNamesInfo *info)
for (kc = info->min_key_code; kc <= info->max_key_code; kc++) {
struct xkb_key *key = &darray_item(keymap->keys, kc);
key->keycode = kc;
- LongToKeyName(darray_item(info->key_names, kc).name,
- key->name);
+ key->name = darray_item(info->key_names, kc).name;
}
keymap->keycodes_section_name = strdup_safe(info->name);
@@ -742,16 +738,16 @@ err_info:
}
struct xkb_key *
-FindNamedKey(struct xkb_keymap *keymap, unsigned long name, bool use_aliases)
+FindNamedKey(struct xkb_keymap *keymap, xkb_atom_t name, bool use_aliases)
{
struct xkb_key *key;
xkb_foreach_key(key, keymap)
- if (KeyNameToLong(key->name) == name)
+ if (key->name == name)
return key;
if (use_aliases) {
- unsigned long new_name;
+ xkb_atom_t new_name;
if (FindKeyNameForAlias(keymap, name, &new_name))
return FindNamedKey(keymap, new_name, false);
}
@@ -760,16 +756,14 @@ FindNamedKey(struct xkb_keymap *keymap, unsigned long name, bool use_aliases)
}
bool
-FindKeyNameForAlias(struct xkb_keymap *keymap, unsigned long lname,
- unsigned long *real_name)
+FindKeyNameForAlias(struct xkb_keymap *keymap, xkb_atom_t name,
+ xkb_atom_t *real_name)
{
- char name[XKB_KEY_NAME_LENGTH];
struct xkb_key_alias *a;
- LongToKeyName(lname, name);
darray_foreach(a, keymap->key_aliases) {
- if (strncmp(name, a->alias, XKB_KEY_NAME_LENGTH) == 0) {
- *real_name = KeyNameToLong(a->real);
+ if (name == a->alias) {
+ *real_name = a->real;
return true;
}
}
diff --git a/src/xkbcomp/keycodes.h b/src/xkbcomp/keycodes.h
index 41bd18c..395478b 100644
--- a/src/xkbcomp/keycodes.h
+++ b/src/xkbcomp/keycodes.h
@@ -27,39 +27,11 @@
#ifndef XKBCOMP_KEYCODES_H
#define XKBCOMP_KEYCODES_H
-static inline unsigned long
-KeyNameToLong(const char name[XKB_KEY_NAME_LENGTH])
-{
- return
- (((unsigned long)name[0]) << 24) |
- (((unsigned long)name[1]) << 16) |
- (((unsigned long)name[2]) << 8) |
- (((unsigned long)name[3]) << 0);
-}
-
-static inline void
-LongToKeyName(unsigned long val, char name[XKB_KEY_NAME_LENGTH])
-{
- name[0] = ((val >> 24) & 0xff);
- name[1] = ((val >> 16) & 0xff);
- name[2] = ((val >> 8) & 0xff);
- name[3] = ((val >> 0) & 0xff);
-}
-
-static inline const char *
-LongKeyNameText(unsigned long val)
-{
- char buf[XKB_KEY_NAME_LENGTH];
- LongToKeyName(val, buf);
- return KeyNameText(buf);
-}
-
struct xkb_key *
-FindNamedKey(struct xkb_keymap *keymap, unsigned long name,
- bool use_aliases);
+FindNamedKey(struct xkb_keymap *keymap, xkb_atom_t name, bool use_aliases);
bool
-FindKeyNameForAlias(struct xkb_keymap *keymap, unsigned long lname,
- unsigned long *real_name);
+FindKeyNameForAlias(struct xkb_keymap *keymap, xkb_atom_t name,
+ xkb_atom_t *real_name);
#endif
diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y
index bb1bb82..3f0cc53 100644
--- a/src/xkbcomp/parser.y
+++ b/src/xkbcomp/parser.y
@@ -123,7 +123,6 @@ _xkbcommon_error(struct YYLTYPE *loc, struct parser_param *param, const char *ms
int64_t num;
enum xkb_file_type file_type;
char *str;
- char keyName[XKB_KEY_NAME_LENGTH];
xkb_atom_t sval;
enum merge_mode merge;
enum xkb_map_flags mapFlags;
@@ -146,7 +145,7 @@ _xkbcommon_error(struct YYLTYPE *loc, struct parser_param *param, const char *ms
%type <num> INTEGER FLOAT
%type <str> IDENT STRING
-%type <keyName> KEYNAME KeyName
+%type <sval> KEYNAME
%type <ival> Number Integer Float SignedNumber
%type <merge> MergeMode OptMergeMode
%type <file_type> XkbCompositeType FileType
@@ -344,11 +343,11 @@ VarDecl : Lhs EQUALS Expr SEMI
{ $$ = BoolVarCreate($2, 0); }
;
-KeyNameDecl : KeyName EQUALS KeyCode SEMI
+KeyNameDecl : KEYNAME EQUALS KeyCode SEMI
{ $$ = KeycodeCreate($1, $3); }
;
-KeyAliasDecl : ALIAS KeyName EQUALS KeyName SEMI
+KeyAliasDecl : ALIAS KEYNAME EQUALS KEYNAME SEMI
{ $$ = KeyAliasCreate($2, $4); }
;
@@ -392,7 +391,7 @@ KeyTypeDecl : TYPE String OBRACE
{ $$ = KeyTypeCreate($2, $4); }
;
-SymbolsDecl : KEY KeyName OBRACE
+SymbolsDecl : KEY KEYNAME OBRACE
SymbolsBody
CBRACE SEMI
{ $$ = SymbolsCreate($2, (ExprDef *)$4); }
@@ -475,7 +474,7 @@ Keys : Keys COMMA Key { $$ = NULL; }
| Key { $$ = NULL; }
;
-Key : KeyName
+Key : KEYNAME
{ $$ = NULL; }
| OBRACE ExprList CBRACE
{ FreeStmt(&$2->common); $$ = NULL; }
@@ -489,7 +488,7 @@ OverlayKeyList : OverlayKeyList COMMA OverlayKey { $$ = NULL; }
| OverlayKey { $$ = NULL; }
;
-OverlayKey : KeyName EQUALS KeyName { $$ = NULL; }
+OverlayKey : KEYNAME EQUALS KEYNAME { $$ = NULL; }
;
OutlineList : OutlineList COMMA OutlineInList
@@ -677,11 +676,11 @@ Terminal : String
{
$$ = NULL;
}
- | KeyName
+ | KEYNAME
{
ExprDef *expr;
expr = ExprCreate(EXPR_VALUE, EXPR_TYPE_KEYNAME);
- strncpy(expr->value.keyName, $1, XKB_KEY_NAME_LENGTH);
+ expr->value.keyName = $1;
$$ = expr;
}
;
@@ -737,9 +736,6 @@ Integer : INTEGER { $$ = $1; }
KeyCode : INTEGER { $$ = $1; }
;
-KeyName : KEYNAME { strncpy($$, $1, XKB_KEY_NAME_LENGTH); }
- ;
-
Ident : IDENT { $$ = xkb_atom_steal(param->ctx, $1); }
| DEFAULT { $$ = xkb_atom_intern(param->ctx, "default"); }
;
diff --git a/src/xkbcomp/scanner.l b/src/xkbcomp/scanner.l
index 283d07e..3bac32a 100644
--- a/src/xkbcomp/scanner.l
+++ b/src/xkbcomp/scanner.l
@@ -62,7 +62,7 @@ scanner_error_extra(struct YYLTYPE *loc, struct scanner_extra *extra,
%option never-interactive
%option case-insensitive
-%x S_STR S_KEY
+%x S_STR
%%
@@ -70,7 +70,6 @@ scanner_error_extra(struct YYLTYPE *loc, struct scanner_extra *extra,
"#"[^\n]*
\" yyextra->s = yyextra->scanBuf; BEGIN(S_STR);
-\< yyextra->s = yyextra->scanBuf; BEGIN(S_KEY);
<S_STR>\" {
BEGIN(INITIAL);
@@ -78,21 +77,8 @@ scanner_error_extra(struct YYLTYPE *loc, struct scanner_extra *extra,
yylval->str = strdup(yyextra->scanBuf);
return STRING;
}
-<S_KEY>\> {
- BEGIN(INITIAL);
-
- *yyextra->s = '\0';
- if (yyextra->s - yyextra->scanBuf > XKB_KEY_NAME_LENGTH) {
- scanner_error_extra(yylloc, yyextra,
- "Key name too long");
- return ERROR_TOK;
- }
- strncpy(yylval->keyName, yyextra->scanBuf, XKB_KEY_NAME_LENGTH);
- return KEYNAME;
- }
-
-<S_STR,S_KEY>\\[0-7]{1,3} {
+<S_STR>\\[0-7]{1,3} {
/* octal escape sequence */
unsigned int result;
@@ -107,21 +93,29 @@ scanner_error_extra(struct YYLTYPE *loc, struct scanner_extra *extra,
APPEND_S(result);
}
-<S_STR,S_KEY>\\[0-9]+ {
+<S_STR>\\[0-9]+ {
scanner_error_extra(yylloc, yyextra,
"Illegal octal escape");
return ERROR_TOK;
}
-<S_STR,S_KEY>\\n APPEND_S('\n');
-<S_STR,S_KEY>\\t APPEND_S('\t');
-<S_STR,S_KEY>\\r APPEND_S('\r');
-<S_STR,S_KEY>\\b APPEND_S('\b');
-<S_STR,S_KEY>\\f APPEND_S('\f');
-<S_STR,S_KEY>\\v APPEND_S('\v');
-<S_STR,S_KEY>\\e APPEND_S('\033');
-
-<S_STR,S_KEY>. APPEND_S(yytext[0]);
+<S_STR>\\n APPEND_S('\n');
+<S_STR>\\t APPEND_S('\t');
+<S_STR>\\r APPEND_S('\r');
+<S_STR>\\b APPEND_S('\b');
+<S_STR>\\f APPEND_S('\f');
+<S_STR>\\v APPEND_S('\v');
+<S_STR>\\e APPEND_S('\033');
+
+<S_STR>. APPEND_S(yytext[0]);
+
+\<[a-zA-Z0-9_+-]+\> {
+ /* We don't want the brackets. */
+ yytext[yyleng - 1] = '\0';
+ yytext++;
+ yylval->sval = xkb_atom_intern(yyextra->ctx, yytext);
+ return KEYNAME;
+ }
xkb_keymap return XKB_KEYMAP;
xkb_keycodes return XKB_KEYCODES;
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 4e8b7bd..0a3955e 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -90,7 +90,7 @@ typedef struct _KeyInfo {
unsigned file_id;
enum merge_mode merge;
- unsigned long name; /* the 4 chars of the key name, as long */
+ xkb_atom_t name;
darray(GroupInfo) groups;
@@ -141,14 +141,12 @@ CopyGroupInfo(GroupInfo *to, const GroupInfo *from)
}
static void
-InitKeyInfo(KeyInfo *keyi, unsigned file_id)
+InitKeyInfo(struct xkb_context *ctx, KeyInfo *keyi, unsigned file_id)
{
- static const char dflt_key_name[XKB_KEY_NAME_LENGTH] = "*";
-
memset(keyi, 0, sizeof(*keyi));
keyi->file_id = file_id;
keyi->merge = MERGE_OVERRIDE;
- keyi->name = KeyNameToLong(dflt_key_name);
+ keyi->name = xkb_atom_intern(ctx, "*");
keyi->out_of_range_group_action = RANGE_WRAP;
}
@@ -168,7 +166,7 @@ typedef struct _ModMapEntry {
bool haveSymbol;
int modifier;
union {
- unsigned long keyName;
+ xkb_atom_t keyName;
xkb_keysym_t keySym;
} u;
} ModMapEntry;
@@ -197,7 +195,7 @@ InitSymbolsInfo(SymbolsInfo *info, struct xkb_keymap *keymap,
info->keymap = keymap;
info->file_id = file_id;
info->merge = MERGE_OVERRIDE;
- InitKeyInfo(&info->dflt, file_id);
+ InitKeyInfo(keymap->ctx, &info->dflt, file_id);
InitVModInfo(&info->vmods, keymap);
info->actions = actions;
info->explicit_group = XKB_LAYOUT_INVALID;
@@ -216,11 +214,18 @@ ClearSymbolsInfo(SymbolsInfo * info)
ClearKeyInfo(&info->dflt);
}
+static const char *
+KeyInfoText(SymbolsInfo *info, KeyInfo *keyi)
+{
+ return KeyNameText(info->keymap->ctx, keyi->name);
+}
+
static bool
MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber,
- bool report, xkb_layout_index_t group, unsigned long key_name)
+ bool report, xkb_layout_index_t group, xkb_atom_t key_name)
{
xkb_level_index_t i, levels_in_both;
+ struct xkb_context *ctx = info->keymap->ctx;
/* First find the type of the merged group. */
if (into->type != from->type) {
@@ -237,9 +242,8 @@ MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber,
log_warn(info->keymap->ctx,
"Multiple definitions for group %d type of key %s; "
"Using %s, ignoring %s\n",
- group + 1, LongKeyNameText(key_name),
- xkb_atom_text(info->keymap->ctx, use),
- xkb_atom_text(info->keymap->ctx, ignore));
+ group + 1, KeyNameText(ctx, key_name),
+ xkb_atom_text(ctx, use), xkb_atom_text(ctx, ignore));
into->type = use;
}
@@ -277,10 +281,10 @@ MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber,
ignore = (clobber ? &intoLevel->action : &fromLevel->action);
if (report)
- log_warn(info->keymap->ctx,
+ log_warn(ctx,
"Multiple actions for level %d/group %u on key %s; "
"Using %s, ignoring %s\n",
- i + 1, group + 1, LongKeyNameText(key_name),
+ i + 1, group + 1, KeyNameText(ctx, key_name),
ActionTypeText(use->type),
ActionTypeText(ignore->type));
@@ -299,10 +303,10 @@ MergeGroups(SymbolsInfo *info, GroupInfo *into, GroupInfo *from, bool clobber,
}
else {
if (report)
- log_warn(info->keymap->ctx,
+ log_warn(ctx,
"Multiple symbols for level %d/group %u on key %s; "
"Using %s, ignoring %s\n",
- i + 1, group + 1, LongKeyNameText(key_name),
+ i + 1, group + 1, KeyNameText(ctx, key_name),
(clobber ? "from" : "to"),
(clobber ? "to" : "from"));
@@ -358,7 +362,7 @@ MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from)
if (from->merge == MERGE_REPLACE) {
ClearKeyInfo(into);
*into = *from;
- InitKeyInfo(from, info->file_id);
+ InitKeyInfo(info->keymap->ctx, from, info->file_id);
return true;
}
@@ -405,18 +409,18 @@ MergeKeys(SymbolsInfo *info, KeyInfo *into, KeyInfo *from)
log_warn(info->keymap->ctx,
"Symbol map for key %s redefined; "
"Using %s definition for conflicting fields\n",
- LongKeyNameText(into->name),
+ KeyNameText(info->keymap->ctx, into->name),
(clobber ? "first" : "last"));
ClearKeyInfo(from);
- InitKeyInfo(from, info->file_id);
+ InitKeyInfo(info->keymap->ctx, from, info->file_id);
return true;
}
static bool
AddKeySymbols(SymbolsInfo *info, KeyInfo *keyi)
{
- unsigned long real_name;
+ xkb_atom_t real_name;
KeyInfo *iter;
/*
@@ -433,7 +437,7 @@ AddKeySymbols(SymbolsInfo *info, KeyInfo *keyi)
return MergeKeys(info, iter, keyi);
darray_append(info->keys, *keyi);
- InitKeyInfo(keyi, info->file_id);
+ InitKeyInfo(info->keymap->ctx, keyi, info->file_id);
return true;
}
@@ -481,8 +485,8 @@ AddModMapEntry(SymbolsInfo * info, ModMapEntry * new)
log_err(info->keymap->ctx,
"Key %s added to map for multiple modifiers; "
"Using %s, ignoring %s.\n",
- LongKeyNameText(new->u.keyName), ModIndexText(use),
- ModIndexText(ignore));
+ KeyNameText(info->keymap->ctx, new->u.keyName),
+ ModIndexText(use), ModIndexText(ignore));
mm->modifier = use;
}
return true;
@@ -624,7 +628,7 @@ GetGroupIndex(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
log_err(info->keymap->ctx,
"Too many groups of %s for key %s (max %u); "
"Ignoring %s defined for extra groups\n",
- name, LongKeyNameText(keyi->name), XKB_NUM_GROUPS + 1, name);
+ name, KeyInfoText(info, keyi), XKB_NUM_GROUPS + 1, name);
return false;
}
@@ -637,7 +641,7 @@ GetGroupIndex(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
log_err(info->keymap->ctx,
"Illegal group index for %s of key %s\n"
"Definition with non-integer array index ignored\n",
- name, LongKeyNameText(keyi->name));
+ name, KeyInfoText(info, keyi));
return false;
}
@@ -697,7 +701,7 @@ AddSymbolsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
"Expected a list of symbols, found %s; "
"Ignoring symbols for group %u of %s\n",
expr_op_type_to_string(value->op), ndx + 1,
- LongKeyNameText(keyi->name));
+ KeyInfoText(info, keyi));
return false;
}
@@ -705,7 +709,7 @@ AddSymbolsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
log_err(info->keymap->ctx,
"Symbols for key %s, group %u already defined; "
"Ignoring duplicate definition\n",
- LongKeyNameText(keyi->name), ndx + 1);
+ KeyInfoText(info, keyi), ndx + 1);
return false;
}
@@ -740,7 +744,7 @@ AddSymbolsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
log_warn(info->keymap->ctx,
"Could not resolve keysym %s for key %s, group %u (%s), level %u\n",
- sym_name, LongKeyNameText(keyi->name), ndx + 1,
+ sym_name, KeyInfoText(info, keyi), ndx + 1,
group_name, i);
ClearLevelInfo(leveli);
@@ -788,14 +792,14 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
log_wsgo(info->keymap->ctx,
"Bad expression type (%d) for action list value; "
"Ignoring actions for group %u of %s\n",
- value->op, ndx, LongKeyNameText(keyi->name));
+ value->op, ndx, KeyInfoText(info, keyi));
return false;
}
if (groupi->defined & GROUP_FIELD_ACTS) {
log_wsgo(info->keymap->ctx,
"Actions for key %s, group %u already defined\n",
- LongKeyNameText(keyi->name), ndx);
+ KeyInfoText(info, keyi), ndx);
return false;
}
@@ -816,7 +820,7 @@ AddActionsToKey(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
log_err(info->keymap->ctx,
"Illegal action definition for %s; "
"Action for group %u/level %u ignored\n",
- LongKeyNameText(keyi->name), ndx + 1, i + 1);
+ KeyInfoText(info, keyi), ndx + 1, i + 1);
act = (ExprDef *) act->common.next;
}
@@ -859,7 +863,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
log_err(ctx,
"Illegal group index for type of key %s; "
"Definition with non-integer array index ignored\n",
- LongKeyNameText(keyi->name));
+ KeyInfoText(info, keyi));
return false;
}
else {
@@ -889,7 +893,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
"Expected a virtual modifier mask, found %s; "
"Ignoring virtual modifiers definition for key %s\n",
expr_op_type_to_string(value->op),
- LongKeyNameText(keyi->name));
+ KeyInfoText(info, keyi));
}
}
else if (istreq(field, "locking") ||
@@ -898,7 +902,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
log_err(info->keymap->ctx,
"Key behaviors not supported; "
"Ignoring locking specification for key %s\n",
- LongKeyNameText(keyi->name));
+ KeyInfoText(info, keyi));
}
else if (istreq(field, "radiogroup") ||
istreq(field, "permanentradiogroup") ||
@@ -906,14 +910,14 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
log_err(info->keymap->ctx,
"Radio groups not supported; "
"Ignoring radio group specification for key %s\n",
- LongKeyNameText(keyi->name));
+ KeyInfoText(info, keyi));
}
else if (istreq_prefix("overlay", field) ||
istreq_prefix("permanentoverlay", field)) {
log_err(info->keymap->ctx,
"Overlays not supported; "
"Ignoring overlay specification for key %s\n",
- LongKeyNameText(keyi->name));
+ KeyInfoText(info, keyi));
}
else if (istreq(field, "repeating") ||
istreq(field, "repeats") ||
@@ -925,7 +929,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
log_err(info->keymap->ctx,
"Illegal repeat setting for %s; "
"Non-boolean repeat setting ignored\n",
- LongKeyNameText(keyi->name));
+ KeyInfoText(info, keyi));
return false;
}
keyi->repeat = val;
@@ -939,7 +943,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
log_err(info->keymap->ctx,
"Illegal groupsWrap setting for %s; "
"Non-boolean value ignored\n",
- LongKeyNameText(keyi->name));
+ KeyInfoText(info, keyi));
return false;
}
@@ -958,7 +962,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
log_err(info->keymap->ctx,
"Illegal groupsClamp setting for %s; "
"Non-boolean value ignored\n",
- LongKeyNameText(keyi->name));
+ KeyInfoText(info, keyi));
return false;
}
@@ -977,7 +981,7 @@ SetSymbolsField(SymbolsInfo *info, KeyInfo *keyi, const char *field,
log_err(info->keymap->ctx,
"Illegal group index for redirect of key %s; "
"Definition with non-integer group ignored\n",
- LongKeyNameText(keyi->name));
+ KeyInfoText(info, keyi));
return false;
}
@@ -1153,7 +1157,7 @@ SetExplicitGroup(SymbolsInfo *info, KeyInfo *keyi)
"For the map %s an explicit group specified, "
"but key %s has more than one group defined; "
"All groups except first one will be ignored\n",
- info->name, LongKeyNameText(keyi->name));
+ info->name, KeyInfoText(info, keyi));
darray_resize0(keyi->groups, info->explicit_group + 1);
if (info->explicit_group > 0) {
@@ -1178,7 +1182,7 @@ HandleSymbolsDef(SymbolsInfo *info, SymbolsDef *stmt)
CopyGroupInfo(&darray_item(keyi.groups, i),
&darray_item(info->dflt.groups, i));
keyi.merge = stmt->merge;
- keyi.name = KeyNameToLong(stmt->keyName);
+ keyi.name = stmt->keyName;
if (!HandleSymbolsBody(info, (VarDef *) stmt->symbols, &keyi)) {
info->errorCount++;
@@ -1223,7 +1227,7 @@ HandleModMapDef(SymbolsInfo *info, ModMapDef *def)
if (key->op == EXPR_VALUE && key->value_type == EXPR_TYPE_KEYNAME) {
tmp.haveSymbol = false;
- tmp.u.keyName = KeyNameToLong(key->value.keyName);
+ tmp.u.keyName = key->value.keyName;
}
else if (ExprResolveKeySym(ctx, key, &sym)) {
tmp.haveSymbol = true;
@@ -1425,7 +1429,7 @@ FindTypeForGroup(struct xkb_keymap *keymap, KeyInfo *keyi,
log_warn(keymap->ctx,
"Couldn't find an automatic type for key '%s' group %d with %lu levels; "
"Using the default type\n",
- LongKeyNameText(keyi->name), group + 1,
+ KeyNameText(keymap->ctx, keyi->name), group + 1,
(unsigned long) darray_size(groupi->levels));
goto use_default;
}
@@ -1439,7 +1443,7 @@ FindTypeForGroup(struct xkb_keymap *keymap, KeyInfo *keyi,
"The type \"%s\" for key '%s' group %d was not previously defined; "
"Using the default type\n",
xkb_atom_text(keymap->ctx, type_name),
- LongKeyNameText(keyi->name), group + 1);
+ KeyNameText(keymap->ctx, keyi->name), group + 1);
goto use_default;
}
@@ -1470,7 +1474,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi)
if (!key) {
log_vrb(info->keymap->ctx, 5,
"Key %s not found in keycodes; Symbols ignored\n",
- LongKeyNameText(keyi->name));
+ KeyInfoText(info, keyi));
return false;
}
@@ -1515,7 +1519,7 @@ CopySymbolsDef(SymbolsInfo *info, KeyInfo *keyi)
"Type \"%s\" has %d levels, but %s has %d levels; "
"Ignoring extra symbols\n",
xkb_atom_text(keymap->ctx, type->name), type->num_levels,
- LongKeyNameText(keyi->name),
+ KeyInfoText(info, keyi),
(int) darray_size(groupi->levels));
darray_foreach_from(leveli, groupi->levels, type->num_levels)
@@ -1568,7 +1572,7 @@ CopyModMapDef(SymbolsInfo *info, ModMapEntry *entry)
log_vrb(info->keymap->ctx, 5,
"Key %s not found in keycodes; "
"Modifier map entry for %s not updated\n",
- LongKeyNameText(entry->u.keyName),
+ KeyNameText(keymap->ctx, entry->u.keyName),
ModIndexText(entry->modifier));
return false;
}
@@ -1607,13 +1611,13 @@ CopySymbolsToKeymap(struct xkb_keymap *keymap, SymbolsInfo *info)
if (xkb_context_get_log_verbosity(keymap->ctx) > 3) {
xkb_foreach_key(key, keymap) {
- if (key->name[0] == '\0')
+ if (key->name == XKB_ATOM_NONE)
continue;
if (key->num_groups < 1)
log_info(keymap->ctx,
"No symbols defined for %s\n",
- KeyNameText(key->name));
+ KeyNameText(keymap->ctx, key->name));
}
}