Replace xkb_keycode_t 'key' variable name by 'kc' We want to reserve the name 'key' for something else. 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
diff --git a/src/alloc.c b/src/alloc.c
index 6cd5fc2..caf28e0 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -67,27 +67,27 @@ XkbcCopyKeyType(const struct xkb_key_type *from, struct xkb_key_type *into)
}
bool
-XkbcResizeKeySyms(struct xkb_keymap *keymap, xkb_keycode_t key,
+XkbcResizeKeySyms(struct xkb_keymap *keymap, xkb_keycode_t kc,
unsigned int needed)
{
- darray_resize0(darray_item(keymap->key_sym_map, key).syms, needed);
+ darray_resize0(darray_item(keymap->key_sym_map, kc).syms, needed);
return true;
}
union xkb_action *
-XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t key,
+XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t kc,
uint32_t needed)
{
size_t old_ndx, old_num_acts, new_ndx;
if (needed == 0) {
- darray_item(keymap->key_acts, key) = 0;
+ darray_item(keymap->key_acts, kc) = 0;
return NULL;
}
- if (XkbKeyHasActions(keymap, key) &&
- XkbKeyGroupsWidth(keymap, key) >= needed)
- return XkbKeyActionsPtr(keymap, key);
+ if (XkbKeyHasActions(keymap, kc) &&
+ XkbKeyGroupsWidth(keymap, kc) >= needed)
+ return XkbKeyActionsPtr(keymap, kc);
/*
* The key may already be in the array, but without enough space.
@@ -96,12 +96,12 @@ XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t key,
* space for the key at the end, and leave the old space alone.
*/
- old_ndx = darray_item(keymap->key_acts, key);
- old_num_acts = XkbKeyNumActions(keymap, key);
+ old_ndx = darray_item(keymap->key_acts, kc);
+ old_num_acts = XkbKeyNumActions(keymap, kc);
new_ndx = darray_size(keymap->acts);
darray_resize0(keymap->acts, new_ndx + needed);
- darray_item(keymap->key_acts, key) = new_ndx;
+ darray_item(keymap->key_acts, kc) = new_ndx;
/*
* The key was already in the array, copy the old actions to the
@@ -112,7 +112,7 @@ XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t key,
darray_mem(keymap->acts, old_ndx),
old_num_acts * sizeof(union xkb_action));
- return XkbKeyActionsPtr(keymap, key);
+ return XkbKeyActionsPtr(keymap, kc);
}
static void
diff --git a/src/alloc.h b/src/alloc.h
index 34a5a91..bfdde56 100644
--- a/src/alloc.h
+++ b/src/alloc.h
@@ -39,11 +39,11 @@ extern int
XkbcCopyKeyType(const struct xkb_key_type *from, struct xkb_key_type *into);
extern bool
-XkbcResizeKeySyms(struct xkb_keymap *keymap, xkb_keycode_t key,
+XkbcResizeKeySyms(struct xkb_keymap *keymap, xkb_keycode_t kc,
uint32_t needed);
extern union xkb_action *
-XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t key,
+XkbcResizeKeyActions(struct xkb_keymap *keymap, xkb_keycode_t kc,
uint32_t needed);
#endif /* ALLOC_H */
diff --git a/src/keymap-dump.c b/src/keymap-dump.c
index b836418..b44a909 100644
--- a/src/keymap-dump.c
+++ b/src/keymap-dump.c
@@ -309,7 +309,7 @@ static bool
write_keycodes(struct xkb_keymap *keymap, char **buf, size_t *size,
size_t *offset)
{
- xkb_keycode_t key;
+ xkb_keycode_t kc;
struct xkb_key_alias *alias;
int i;
@@ -324,13 +324,13 @@ write_keycodes(struct xkb_keymap *keymap, char **buf, size_t *size,
write_buf(keymap, buf, size, offset, "\t\tmaximum = %d;\n",
keymap->max_key_code);
- for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
- if (darray_item(keymap->key_names, key).name[0] == '\0')
+ for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
+ if (darray_item(keymap->key_names, kc).name[0] == '\0')
continue;
write_buf(keymap, buf, size, offset, "\t\t%6s = %d;\n",
- XkbcKeyNameText(darray_item(keymap->key_names, key).name),
- key);
+ XkbcKeyNameText(darray_item(keymap->key_names, kc).name),
+ kc);
}
for (i = 0; i < XkbNumIndicators; i++) {
@@ -740,17 +740,17 @@ write_compat(struct xkb_keymap *keymap, char **buf, size_t *size,
static bool
write_keysyms(struct xkb_keymap *keymap, char **buf, size_t *size,
- size_t *offset, xkb_keycode_t key, unsigned int group)
+ size_t *offset, xkb_keycode_t kc, unsigned int group)
{
const xkb_keysym_t *syms;
int num_syms, level;
#define OUT_BUF_LEN 128
char out_buf[OUT_BUF_LEN];
- for (level = 0; level < XkbKeyGroupWidth(keymap, key, group); level++) {
+ for (level = 0; level < XkbKeyGroupWidth(keymap, kc, group); level++) {
if (level != 0)
write_buf(keymap, buf, size, offset, ", ");
- num_syms = xkb_key_get_syms_by_level(keymap, key, group, level,
+ num_syms = xkb_key_get_syms_by_level(keymap, kc, group, level,
&syms);
if (num_syms == 0) {
write_buf(keymap, buf, size, offset, "%15s", "NoSymbol");
@@ -780,7 +780,7 @@ static bool
write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
size_t *offset)
{
- xkb_keycode_t key;
+ xkb_keycode_t kc;
int group, tmp;
bool showActions;
@@ -801,35 +801,35 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
if (tmp > 0)
write_buf(keymap, buf, size, offset, "\n");
- for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
+ for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
bool simple = true;
- if (xkb_key_num_groups(keymap, key) == 0)
+ if (xkb_key_num_groups(keymap, kc) == 0)
continue;
write_buf(keymap, buf, size, offset, "\t\tkey %6s {",
- XkbcKeyNameText(darray_item(keymap->key_names, key).name));
+ XkbcKeyNameText(darray_item(keymap->key_names, kc).name));
if (keymap->explicit) {
- if ((keymap->explicit[key] & XkbExplicitKeyTypesMask)) {
+ if ((keymap->explicit[kc] & XkbExplicitKeyTypesMask)) {
bool multi_type = false;
- int type = XkbKeyTypeIndex(keymap, key, 0);
+ int type = XkbKeyTypeIndex(keymap, kc, 0);
simple = false;
- for (group = 0; group < xkb_key_num_groups(keymap, key);
+ for (group = 0; group < xkb_key_num_groups(keymap, kc);
group++) {
- if (XkbKeyTypeIndex(keymap, key, group) != type) {
+ if (XkbKeyTypeIndex(keymap, kc, group) != type) {
multi_type = true;
break;
}
}
if (multi_type) {
for (group = 0;
- group < xkb_key_num_groups(keymap, key);
+ group < xkb_key_num_groups(keymap, kc);
group++) {
- if (!(keymap->explicit[key] & (1 << group)))
+ if (!(keymap->explicit[kc] & (1 << group)))
continue;
- type = XkbKeyTypeIndex(keymap, key, group);
+ type = XkbKeyTypeIndex(keymap, kc, group);
write_buf(keymap, buf, size, offset,
"\n\t\t\ttype[group%d]= \"%s\",",
group + 1,
@@ -842,8 +842,8 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
darray_item(keymap->types, type).name);
}
}
- if (keymap->explicit[key] & XkbExplicitAutoRepeatMask) {
- if (keymap->per_key_repeat[key / 8] & (1 << (key % 8)))
+ if (keymap->explicit[kc] & XkbExplicitAutoRepeatMask) {
+ if (keymap->per_key_repeat[kc / 8] & (1 << (kc % 8)))
write_buf(keymap, buf, size, offset,
"\n\t\t\trepeat= Yes,");
else
@@ -851,15 +851,15 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
"\n\t\t\trepeat= No,");
simple = false;
}
- if (keymap->vmodmap[key] &&
- (keymap->explicit[key] & XkbExplicitVModMapMask)) {
+ if (keymap->vmodmap[kc] &&
+ (keymap->explicit[kc] & XkbExplicitVModMapMask)) {
write_buf(keymap, buf, size, offset,
"\n\t\t\tvirtualMods= %s,",
- get_mod_mask_text(keymap, 0, keymap->vmodmap[key]));
+ get_mod_mask_text(keymap, 0, keymap->vmodmap[kc]));
}
}
- switch (XkbOutOfRangeGroupAction(XkbKeyGroupInfo(keymap, key))) {
+ switch (XkbOutOfRangeGroupAction(XkbKeyGroupInfo(keymap, kc))) {
case XkbClampIntoRange:
write_buf(keymap, buf, size, offset, "\n\t\t\tgroupsClamp,");
break;
@@ -868,22 +868,22 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
write_buf(keymap, buf, size, offset,
"\n\t\t\tgroupsRedirect= Group%d,",
XkbOutOfRangeGroupNumber(XkbKeyGroupInfo(keymap,
- key)) + 1);
+ kc)) + 1);
break;
}
if (keymap->explicit == NULL ||
- (keymap->explicit[key] & XkbExplicitInterpretMask))
- showActions = XkbKeyHasActions(keymap, key);
+ (keymap->explicit[kc] & XkbExplicitInterpretMask))
+ showActions = XkbKeyHasActions(keymap, kc);
else
showActions = false;
- if (xkb_key_num_groups(keymap, key) > 1 || showActions)
+ if (xkb_key_num_groups(keymap, kc) > 1 || showActions)
simple = false;
if (simple) {
write_buf(keymap, buf, size, offset, "\t[ ");
- if (!write_keysyms(keymap, buf, size, offset, key, 0))
+ if (!write_keysyms(keymap, buf, size, offset, kc, 0))
return false;
write_buf(keymap, buf, size, offset, " ] };\n");
}
@@ -891,21 +891,20 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
union xkb_action *acts;
int level;
- acts = XkbKeyActionsPtr(keymap, key);
- for (group = 0; group < xkb_key_num_groups(keymap, key);
- group++) {
+ acts = XkbKeyActionsPtr(keymap, kc);
+ for (group = 0; group < xkb_key_num_groups(keymap, kc); group++) {
if (group != 0)
write_buf(keymap, buf, size, offset, ",");
write_buf(keymap, buf, size, offset,
"\n\t\t\tsymbols[Group%d]= [ ", group + 1);
- if (!write_keysyms(keymap, buf, size, offset, key, group))
+ if (!write_keysyms(keymap, buf, size, offset, kc, group))
return false;
write_buf(keymap, buf, size, offset, " ]");
if (showActions) {
write_buf(keymap, buf, size, offset,
",\n\t\t\tactions[Group%d]= [ ", group + 1);
for (level = 0;
- level < XkbKeyGroupWidth(keymap, key, group);
+ level < XkbKeyGroupWidth(keymap, kc, group);
level++) {
if (level != 0)
write_buf(keymap, buf, size, offset, ", ");
@@ -913,29 +912,28 @@ write_symbols(struct xkb_keymap *keymap, char **buf, size_t *size,
NULL, NULL);
}
write_buf(keymap, buf, size, offset, " ]");
- acts += XkbKeyGroupsWidth(keymap, key);
+ acts += XkbKeyGroupsWidth(keymap, kc);
}
}
write_buf(keymap, buf, size, offset, "\n\t\t};\n");
}
}
if (keymap->modmap) {
- for (key = keymap->min_key_code; key <= keymap->max_key_code;
- key++) {
+ for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
int mod;
- if (keymap->modmap[key] == 0)
+ if (keymap->modmap[kc] == 0)
continue;
for (mod = 0; mod < XkbNumModifiers; mod++) {
- if (!(keymap->modmap[key] & (1 << mod)))
+ if (!(keymap->modmap[kc] & (1 << mod)))
continue;
write_buf(keymap, buf, size, offset,
"\t\tmodifier_map %s { %s };\n",
get_mod_index_text(mod),
XkbcKeyNameText(darray_item(keymap->key_names,
- key).name));
+ kc).name));
}
}
}
diff --git a/src/map.c b/src/map.c
index 16ee80d..431019c 100644
--- a/src/map.c
+++ b/src/map.c
@@ -185,9 +185,9 @@ xkb_map_group_get_index(struct xkb_keymap *keymap, const char *name)
* Returns the number of groups active for a particular key.
*/
_X_EXPORT xkb_group_index_t
-xkb_key_num_groups(struct xkb_keymap *keymap, xkb_keycode_t key)
+xkb_key_num_groups(struct xkb_keymap *keymap, xkb_keycode_t kc)
{
- return XkbKeyNumGroups(keymap, key);
+ return XkbKeyNumGroups(keymap, kc);
}
/**
@@ -241,11 +241,11 @@ xkb_map_led_get_index(struct xkb_keymap *keymap, const char *name)
* Returns the level to use for the given key and state, or -1 if invalid.
*/
_X_EXPORT unsigned int
-xkb_key_get_level(struct xkb_state *state, xkb_keycode_t key,
+xkb_key_get_level(struct xkb_state *state, xkb_keycode_t kc,
unsigned int group)
{
struct xkb_keymap *keymap = xkb_state_get_map(state);
- struct xkb_key_type *type = XkbKeyType(keymap, key, group);
+ struct xkb_key_type *type = XkbKeyType(keymap, kc, group);
struct xkb_kt_map_entry *entry;
unsigned int active_mods;
@@ -265,14 +265,14 @@ xkb_key_get_level(struct xkb_state *state, xkb_keycode_t key,
* wrapping/clamping/etc into account.
*/
_X_EXPORT unsigned int
-xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key)
+xkb_key_get_group(struct xkb_state *state, xkb_keycode_t kc)
{
struct xkb_keymap *keymap = xkb_state_get_map(state);
- unsigned int info = XkbKeyGroupInfo(keymap, key);
- unsigned int num_groups = XkbKeyNumGroups(keymap, key);
+ unsigned int info = XkbKeyGroupInfo(keymap, kc);
+ unsigned int num_groups = XkbKeyNumGroups(keymap, kc);
unsigned int ret = xkb_state_serialize_group(state, XKB_STATE_EFFECTIVE);
- if (ret < XkbKeyNumGroups(keymap, key))
+ if (ret < XkbKeyNumGroups(keymap, kc))
return ret;
switch (XkbOutOfRangeGroupAction(info)) {
@@ -299,22 +299,22 @@ xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key)
* As below, but takes an explicit group/level rather than state.
*/
int
-xkb_key_get_syms_by_level(struct xkb_keymap *keymap, xkb_keycode_t key,
+xkb_key_get_syms_by_level(struct xkb_keymap *keymap, xkb_keycode_t kc,
unsigned int group, unsigned int level,
const xkb_keysym_t **syms_out)
{
int num_syms;
- if (group >= XkbKeyNumGroups(keymap, key))
+ if (group >= XkbKeyNumGroups(keymap, kc))
goto err;
- if (level >= XkbKeyGroupWidth(keymap, key, group))
+ if (level >= XkbKeyGroupWidth(keymap, kc, group))
goto err;
- num_syms = XkbKeyNumSyms(keymap, key, group, level);
+ num_syms = XkbKeyNumSyms(keymap, kc, group, level);
if (num_syms == 0)
goto err;
- *syms_out = XkbKeySymEntry(keymap, key, group, level);
+ *syms_out = XkbKeySymEntry(keymap, kc, group, level);
return num_syms;
err:
@@ -327,24 +327,24 @@ err:
* number of symbols pointed to in syms_out.
*/
_X_EXPORT int
-xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
+xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t kc,
const xkb_keysym_t **syms_out)
{
struct xkb_keymap *keymap = xkb_state_get_map(state);
int group;
int level;
- if (!state || key < keymap->min_key_code || key > keymap->max_key_code)
+ if (!state || kc < keymap->min_key_code || kc > keymap->max_key_code)
return -1;
- group = xkb_key_get_group(state, key);
+ group = xkb_key_get_group(state, kc);
if (group == -1)
goto err;
- level = xkb_key_get_level(state, key, group);
+ level = xkb_key_get_level(state, kc, group);
if (level == -1)
goto err;
- return xkb_key_get_syms_by_level(keymap, key, group, level, syms_out);
+ return xkb_key_get_syms_by_level(keymap, kc, group, level, syms_out);
err:
*syms_out = NULL;
@@ -355,7 +355,7 @@ err:
* Simple boolean specifying whether or not the key should repeat.
*/
_X_EXPORT int
-xkb_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key)
+xkb_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t kc)
{
- return !!(keymap->per_key_repeat[key / 8] & (1 << (key % 8)));
+ return !!(keymap->per_key_repeat[kc / 8] & (1 << (kc % 8)));
}
diff --git a/src/state.c b/src/state.c
index f321b1f..a94f3fd 100644
--- a/src/state.c
+++ b/src/state.c
@@ -66,9 +66,9 @@
struct xkb_filter {
struct xkb_state *state;
union xkb_action action;
- xkb_keycode_t keycode;
+ xkb_keycode_t kc;
uint32_t priv;
- int (*func)(struct xkb_filter *filter, xkb_keycode_t key,
+ int (*func)(struct xkb_filter *filter, xkb_keycode_t kc,
enum xkb_key_direction direction);
int refcnt;
struct xkb_filter *next;
@@ -107,22 +107,22 @@ struct xkb_state {
};
static union xkb_action *
-xkb_key_get_action(struct xkb_state *state, xkb_keycode_t key)
+xkb_key_get_action(struct xkb_state *state, xkb_keycode_t kc)
{
unsigned int group, level;
- if (!XkbKeyHasActions(state->keymap, key) ||
- !XkbKeycodeInRange(state->keymap, key)) {
+ if (!XkbKeyHasActions(state->keymap, kc) ||
+ !XkbKeycodeInRange(state->keymap, kc)) {
static union xkb_action fake;
memset(&fake, 0, sizeof(fake));
fake.type = XkbSA_NoAction;
return &fake;
}
- group = xkb_key_get_group(state, key);
- level = xkb_key_get_level(state, key, group);
+ group = xkb_key_get_group(state, kc);
+ level = xkb_key_get_level(state, kc, group);
- return XkbKeyActionEntry(state->keymap, key, group, level);
+ return XkbKeyActionEntry(state->keymap, kc, group, level);
}
static struct xkb_filter *
@@ -151,10 +151,10 @@ xkb_filter_new(struct xkb_state *state)
/***====================================================================***/
static int
-xkb_filter_group_set_func(struct xkb_filter *filter, xkb_keycode_t keycode,
+xkb_filter_group_set_func(struct xkb_filter *filter, xkb_keycode_t kc,
enum xkb_key_direction direction)
{
- if (keycode != filter->keycode) {
+ if (kc != filter->kc) {
filter->action.group.flags &= ~XkbSA_ClearLocks;
return 1;
}
@@ -180,14 +180,14 @@ xkb_filter_group_set_func(struct xkb_filter *filter, xkb_keycode_t keycode,
}
static int
-xkb_filter_group_set_new(struct xkb_state *state, xkb_keycode_t keycode,
+xkb_filter_group_set_new(struct xkb_state *state, xkb_keycode_t kc,
union xkb_action *action)
{
struct xkb_filter *filter = xkb_filter_new(state);
if (!filter) /* WSGO */
return -1;
- filter->keycode = keycode;
+ filter->kc = kc;
filter->func = xkb_filter_group_set_func;
filter->action = *action;
@@ -203,10 +203,10 @@ xkb_filter_group_set_new(struct xkb_state *state, xkb_keycode_t keycode,
}
static int
-xkb_filter_group_lock_func(struct xkb_filter *filter, xkb_keycode_t keycode,
+xkb_filter_group_lock_func(struct xkb_filter *filter, xkb_keycode_t kc,
enum xkb_key_direction direction)
{
- if (keycode != filter->keycode)
+ if (kc != filter->kc)
return 1;
if (direction == XKB_KEY_DOWN) {
@@ -221,7 +221,7 @@ xkb_filter_group_lock_func(struct xkb_filter *filter, xkb_keycode_t keycode,
}
static int
-xkb_filter_group_lock_new(struct xkb_state *state, xkb_keycode_t keycode,
+xkb_filter_group_lock_new(struct xkb_state *state, xkb_keycode_t kc,
union xkb_action *action)
{
struct xkb_filter *filter = xkb_filter_new(state);
@@ -229,7 +229,7 @@ xkb_filter_group_lock_new(struct xkb_state *state, xkb_keycode_t keycode,
if (!filter)
return 0;
- filter->keycode = keycode;
+ filter->kc = kc;
filter->func = xkb_filter_group_lock_func;
filter->action = *action;
@@ -242,10 +242,10 @@ xkb_filter_group_lock_new(struct xkb_state *state, xkb_keycode_t keycode,
}
static int
-xkb_filter_mod_set_func(struct xkb_filter *filter, xkb_keycode_t keycode,
+xkb_filter_mod_set_func(struct xkb_filter *filter, xkb_keycode_t kc,
enum xkb_key_direction direction)
{
- if (keycode != filter->keycode) {
+ if (kc != filter->kc) {
filter->action.mods.flags &= ~XkbSA_ClearLocks;
return 1;
}
@@ -268,14 +268,14 @@ xkb_filter_mod_set_func(struct xkb_filter *filter, xkb_keycode_t keycode,
}
static int
-xkb_filter_mod_set_new(struct xkb_state *state, xkb_keycode_t keycode,
+xkb_filter_mod_set_new(struct xkb_state *state, xkb_keycode_t kc,
union xkb_action *action)
{
struct xkb_filter *filter = xkb_filter_new(state);
if (!filter) /* WSGO */
return -1;
- filter->keycode = keycode;
+ filter->kc = kc;
filter->func = xkb_filter_mod_set_func;
filter->action = *action;
@@ -285,10 +285,10 @@ xkb_filter_mod_set_new(struct xkb_state *state, xkb_keycode_t keycode,
}
static int
-xkb_filter_mod_lock_func(struct xkb_filter *filter, xkb_keycode_t keycode,
+xkb_filter_mod_lock_func(struct xkb_filter *filter, xkb_keycode_t kc,
enum xkb_key_direction direction)
{
- if (keycode != filter->keycode)
+ if (kc != filter->kc)
return 1;
if (direction == XKB_KEY_DOWN) {
@@ -304,7 +304,7 @@ xkb_filter_mod_lock_func(struct xkb_filter *filter, xkb_keycode_t keycode,
}
static int
-xkb_filter_mod_lock_new(struct xkb_state *state, xkb_keycode_t keycode,
+xkb_filter_mod_lock_new(struct xkb_state *state, xkb_keycode_t kc,
union xkb_action *action)
{
struct xkb_filter *filter = xkb_filter_new(state);
@@ -312,7 +312,7 @@ xkb_filter_mod_lock_new(struct xkb_state *state, xkb_keycode_t keycode,
if (!filter) /* WSGO */
return 0;
- filter->keycode = keycode;
+ filter->kc = kc;
filter->func = xkb_filter_mod_lock_func;
filter->action = *action;
filter->priv = state->locked_mods & action->mods.mask;
@@ -328,7 +328,7 @@ enum xkb_key_latch_state {
};
static int
-xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t keycode,
+xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t kc,
enum xkb_key_direction direction)
{
enum xkb_key_latch_state latch = filter->priv;
@@ -338,7 +338,7 @@ xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t keycode,
* keypress, then either break the latch if any random key is pressed,
* or promote it to a lock or plain base set if it's the same
* modifier. */
- union xkb_action *action = xkb_key_get_action(filter->state, keycode);
+ union xkb_action *action = xkb_key_get_action(filter->state, kc);
if (action->type == XkbSA_LatchMods &&
action->mods.flags == filter->action.mods.flags &&
action->mods.mask == filter->action.mods.mask) {
@@ -353,7 +353,7 @@ xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t keycode,
filter->func = xkb_filter_mod_set_func;
filter->state->set_mods = filter->action.mods.mask;
}
- filter->keycode = keycode;
+ filter->kc = kc;
filter->state->latched_mods &= ~filter->action.mods.mask;
/* XXX beep beep! */
return 0;
@@ -366,7 +366,7 @@ xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t keycode,
return 1;
}
}
- else if (direction == XKB_KEY_UP && keycode == filter->keycode) {
+ else if (direction == XKB_KEY_UP && kc == filter->kc) {
/* Our key got released. If we've set it to clear locks, and we
* currently have the same modifiers locked, then release them and
* don't actually latch. Else we've actually hit the latching
@@ -406,7 +406,7 @@ xkb_filter_mod_latch_func(struct xkb_filter *filter, xkb_keycode_t keycode,
}
static int
-xkb_filter_mod_latch_new(struct xkb_state *state, xkb_keycode_t keycode,
+xkb_filter_mod_latch_new(struct xkb_state *state, xkb_keycode_t kc,
union xkb_action *action)
{
struct xkb_filter *filter = xkb_filter_new(state);
@@ -414,7 +414,7 @@ xkb_filter_mod_latch_new(struct xkb_state *state, xkb_keycode_t keycode,
if (!filter) /* WSGO */
return -1;
- filter->keycode = keycode;
+ filter->kc = kc;
filter->priv = latch;
filter->func = xkb_filter_mod_latch_func;
filter->action = *action;
@@ -430,7 +430,7 @@ xkb_filter_mod_latch_new(struct xkb_state *state, xkb_keycode_t keycode,
* apply a new filter from the key action.
*/
static void
-xkb_filter_apply_all(struct xkb_state *state, xkb_keycode_t key,
+xkb_filter_apply_all(struct xkb_state *state, xkb_keycode_t kc,
enum xkb_key_direction direction)
{
struct xkb_filter *filter;
@@ -442,25 +442,25 @@ xkb_filter_apply_all(struct xkb_state *state, xkb_keycode_t key,
darray_foreach(filter, state->filters) {
if (!filter->func)
continue;
- send &= filter->func(filter, key, direction);
+ send &= filter->func(filter, kc, direction);
}
if (!send || direction == XKB_KEY_UP)
return;
- act = xkb_key_get_action(state, key);
+ act = xkb_key_get_action(state, kc);
switch (act->type) {
case XkbSA_SetMods:
- send = xkb_filter_mod_set_new(state, key, act);
+ send = xkb_filter_mod_set_new(state, kc, act);
break;
case XkbSA_LatchMods:
- send = xkb_filter_mod_latch_new(state, key, act);
+ send = xkb_filter_mod_latch_new(state, kc, act);
break;
case XkbSA_LockMods:
- send = xkb_filter_mod_lock_new(state, key, act);
+ send = xkb_filter_mod_lock_new(state, kc, act);
break;
case XkbSA_SetGroup:
- send = xkb_filter_group_set_new(state, key, act);
+ send = xkb_filter_group_set_new(state, kc, act);
break;
#if 0
case XkbSA_LatchGroup:
@@ -468,7 +468,7 @@ xkb_filter_apply_all(struct xkb_state *state, xkb_keycode_t key,
break;
#endif
case XkbSA_LockGroup:
- send = xkb_filter_group_lock_new(state, key, act);
+ send = xkb_filter_group_lock_new(state, kc, act);
break;
}
@@ -590,7 +590,7 @@ xkb_state_update_derived(struct xkb_state *state)
* new modifiers.
*/
_X_EXPORT void
-xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
+xkb_state_update_key(struct xkb_state *state, xkb_keycode_t kc,
enum xkb_key_direction direction)
{
xkb_mod_index_t i;
@@ -599,7 +599,7 @@ xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
state->set_mods = 0;
state->clear_mods = 0;
- xkb_filter_apply_all(state, key, direction);
+ xkb_filter_apply_all(state, kc, direction);
for (i = 0, bit = 1; state->set_mods; i++, bit <<= 1) {
if (state->set_mods & bit) {
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index 5a0c610..0890290 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -188,7 +188,7 @@ struct xkb_switch_screen_action {
struct xkb_redirect_key_action {
uint8_t type;
- xkb_keycode_t new_key;
+ xkb_keycode_t new_kc;
uint8_t mods_mask;
uint8_t mods;
uint16_t vmods_mask;
@@ -526,14 +526,14 @@ const char *
xkb_atom_text(struct xkb_context *ctx, xkb_atom_t atom);
extern unsigned int
-xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key);
+xkb_key_get_group(struct xkb_state *state, xkb_keycode_t kc);
extern unsigned int
-xkb_key_get_level(struct xkb_state *state, xkb_keycode_t key,
+xkb_key_get_level(struct xkb_state *state, xkb_keycode_t kc,
unsigned int group);
extern int
-xkb_key_get_syms_by_level(struct xkb_keymap *keymap, xkb_keycode_t key,
+xkb_key_get_syms_by_level(struct xkb_keymap *keymap, xkb_keycode_t kc,
unsigned int group, unsigned int level,
const xkb_keysym_t **syms_out);
diff --git a/src/xkbcomp/action.c b/src/xkbcomp/action.c
index 79643bf..7a48cd4 100644
--- a/src/xkbcomp/action.c
+++ b/src/xkbcomp/action.c
@@ -818,7 +818,7 @@ HandleRedirectKey(struct xkb_keymap *keymap, struct xkb_any_action *action,
return ReportNotFound(action->type, field, "Key",
XkbcKeyNameText(rtrn.keyName.name));
}
- act->new_key = kc;
+ act->new_kc = kc;
return true;
case F_ModsToClear:
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index d7332c1..1ab6754 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -826,7 +826,7 @@ UpdateActionMods(struct xkb_keymap *keymap, union xkb_action *act,
* generic XKB_KEY_NoSymbol match.
*/
static struct xkb_sym_interpret *
-FindInterpForKey(struct xkb_keymap *keymap, xkb_keycode_t key,
+FindInterpForKey(struct xkb_keymap *keymap, xkb_keycode_t kc,
uint32_t group, uint32_t level)
{
struct xkb_sym_interpret *ret = NULL;
@@ -834,7 +834,7 @@ FindInterpForKey(struct xkb_keymap *keymap, xkb_keycode_t key,
const xkb_keysym_t *syms;
int num_syms;
- num_syms = xkb_key_get_syms_by_level(keymap, key, group, level, &syms);
+ num_syms = xkb_key_get_syms_by_level(keymap, kc, group, level, &syms);
if (num_syms == 0)
return NULL;
@@ -847,7 +847,7 @@ FindInterpForKey(struct xkb_keymap *keymap, xkb_keycode_t key,
continue;
if (level == 0 || !(interp->match & XkbSI_LevelOneOnly))
- mods = keymap->modmap[key];
+ mods = keymap->modmap[kc];
else
mods = 0;
@@ -884,7 +884,7 @@ FindInterpForKey(struct xkb_keymap *keymap, xkb_keycode_t key,
/**
*/
static bool
-ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
+ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t kc)
{
#define INTERP_SIZE (8 * 4)
struct xkb_sym_interpret *interps[INTERP_SIZE];
@@ -892,36 +892,36 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
uint32_t vmodmask = 0;
int num_acts = 0;
int group, level;
- int width = XkbKeyGroupsWidth(keymap, key);
+ int width = XkbKeyGroupsWidth(keymap, kc);
int i;
/* If we've been told not to bind interps to this key, then don't. */
- if (keymap->explicit[key] & XkbExplicitInterpretMask)
+ if (keymap->explicit[kc] & XkbExplicitInterpretMask)
return true;
for (i = 0; i < INTERP_SIZE; i++)
interps[i] = NULL;
- for (group = 0; group < XkbKeyNumGroups(keymap, key); group++) {
- for (level = 0; level < XkbKeyGroupWidth(keymap, key, group);
+ for (group = 0; group < XkbKeyNumGroups(keymap, kc); group++) {
+ for (level = 0; level < XkbKeyGroupWidth(keymap, kc, group);
level++) {
i = (group * width) + level;
if (i >= INTERP_SIZE) /* XXX FIXME */
return false;
- interps[i] = FindInterpForKey(keymap, key, group, level);
+ interps[i] = FindInterpForKey(keymap, kc, group, level);
if (interps[i])
num_acts++;
}
}
if (num_acts)
- num_acts = XkbKeyNumGroups(keymap, key) * width;
- acts = XkbcResizeKeyActions(keymap, key, num_acts);
+ num_acts = XkbKeyNumGroups(keymap, kc) * width;
+ acts = XkbcResizeKeyActions(keymap, kc, num_acts);
if (num_acts && !acts)
return false;
- for (group = 0; group < XkbKeyNumGroups(keymap, key); group++) {
- for (level = 0; level < XkbKeyGroupWidth(keymap, key, group);
+ for (group = 0; group < XkbKeyNumGroups(keymap, kc); group++) {
+ for (level = 0; level < XkbKeyGroupWidth(keymap, kc, group);
level++) {
struct xkb_sym_interpret *interp;
@@ -930,12 +930,12 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
/* Infer default key behaviours from the base level. */
if (group == 0 && level == 0) {
- if (!(keymap->explicit[key] & XkbExplicitAutoRepeatMask) &&
+ if (!(keymap->explicit[kc] & XkbExplicitAutoRepeatMask) &&
(!interp || interp->flags & XkbSI_AutoRepeat))
- keymap->per_key_repeat[key / 8] |= (1 << (key % 8));
- if (!(keymap->explicit[key] & XkbExplicitBehaviorMask) &&
+ keymap->per_key_repeat[kc / 8] |= (1 << (kc % 8));
+ if (!(keymap->explicit[kc] & XkbExplicitBehaviorMask) &&
interp && (interp->flags & XkbSI_LockingKey))
- keymap->behaviors[key].type = XkbKB_Lock;
+ keymap->behaviors[kc].type = XkbKB_Lock;
}
if (!interp)
@@ -950,8 +950,8 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
}
}
- if (!(keymap->explicit[key] & XkbExplicitVModMapMask))
- keymap->vmodmap[key] = vmodmask;
+ if (!(keymap->explicit[kc] & XkbExplicitVModMapMask))
+ keymap->vmodmap[kc] = vmodmask;
return true;
#undef INTERP_SIZE
@@ -966,27 +966,27 @@ ApplyInterpsToKey(struct xkb_keymap *keymap, xkb_keycode_t key)
bool
UpdateModifiersFromCompat(struct xkb_keymap *keymap)
{
- xkb_keycode_t key;
+ xkb_keycode_t kc;
int i;
struct xkb_key_type *type;
struct xkb_kt_map_entry *entry;
/* Find all the interprets for the key and bind them to actions,
* which will also update the vmodmap. */
- for (key = keymap->min_key_code; key <= keymap->max_key_code; key++)
- if (!ApplyInterpsToKey(keymap, key))
+ for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++)
+ if (!ApplyInterpsToKey(keymap, kc))
return false;
/* Update keymap->vmods, the virtual -> real mod mapping. */
for (i = 0; i < XkbNumVirtualMods; i++)
keymap->vmods[i] = 0;
- for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
- if (!keymap->vmodmap[key])
+ for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
+ if (!keymap->vmodmap[kc])
continue;
for (i = 0; i < XkbNumVirtualMods; i++) {
- if (!(keymap->vmodmap[key] & (1 << i)))
+ if (!(keymap->vmodmap[kc] & (1 << i)))
continue;
- keymap->vmods[i] |= keymap->modmap[key];
+ keymap->vmods[i] |= keymap->modmap[kc];
}
}
@@ -1008,12 +1008,12 @@ UpdateModifiersFromCompat(struct xkb_keymap *keymap)
}
/* Update action modifiers. */
- for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
- union xkb_action *acts = XkbKeyActionsPtr(keymap, key);
- for (i = 0; i < XkbKeyNumActions(keymap, key); i++) {
+ for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
+ union xkb_action *acts = XkbKeyActionsPtr(keymap, kc);
+ for (i = 0; i < XkbKeyNumActions(keymap, kc); i++) {
if (acts[i].any.type == XkbSA_NoAction)
continue;
- UpdateActionMods(keymap, &acts[i], keymap->modmap[key]);
+ UpdateActionMods(keymap, &acts[i], keymap->modmap[kc]);
}
}
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index 145ea22..3fba2a5 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -732,7 +732,7 @@ bool
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
enum merge_mode merge)
{
- xkb_keycode_t i;
+ xkb_keycode_t kc;
KeyNamesInfo info; /* contains all the info after parsing */
InitKeyNamesInfo(&info, file->id);
@@ -755,9 +755,9 @@ CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
keymap->max_key_code = info.computedMax;
darray_resize0(keymap->key_names, keymap->max_key_code + 1);
- for (i = info.computedMin; i <= info.computedMax; i++)
- LongToKeyName(darray_item(info.names, i),
- darray_item(keymap->key_names, i).name);
+ for (kc = info.computedMin; kc <= info.computedMax; kc++)
+ LongToKeyName(darray_item(info.names, kc),
+ darray_item(keymap->key_names, kc).name);
if (info.name)
keymap->keycodes_section_name = strdup(info.name);
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index f3bd6f0..d58c116 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -1445,15 +1445,15 @@ static bool
FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym,
xkb_keycode_t *kc_rtrn)
{
- xkb_keycode_t key;
+ xkb_keycode_t kc;
unsigned int group, level, min_group = UINT_MAX, min_level = UINT_MAX;
- for (key = keymap->min_key_code; key <= keymap->max_key_code; key++) {
- for (group = 0; group < XkbKeyNumGroups(keymap, key); group++) {
- for (level = 0; level < XkbKeyGroupWidth(keymap, key, group);
+ for (kc = keymap->min_key_code; kc <= keymap->max_key_code; kc++) {
+ for (group = 0; group < XkbKeyNumGroups(keymap, kc); group++) {
+ for (level = 0; level < XkbKeyGroupWidth(keymap, kc, group);
level++) {
- if (XkbKeyNumSyms(keymap, key, group, level) != 1 ||
- (XkbKeySymEntry(keymap, key, group, level))[0] != sym)
+ if (XkbKeyNumSyms(keymap, kc, group, level) != 1 ||
+ (XkbKeySymEntry(keymap, kc, group, level))[0] != sym)
continue;
/*
@@ -1463,7 +1463,7 @@ FindKeyForSymbol(struct xkb_keymap *keymap, xkb_keysym_t sym,
*/
if (group < min_group ||
(group == min_group && level < min_level)) {
- *kc_rtrn = key;
+ *kc_rtrn = kc;
if (group == 0 && level == 0) {
return true;
}
diff --git a/test/keyseq.c b/test/keyseq.c
index eab6e86..3ca64a2 100644
--- a/test/keyseq.c
+++ b/test/keyseq.c
@@ -63,7 +63,7 @@ test_key_seq(struct xkb_keymap *keymap, ...)
struct xkb_state *state;
va_list ap;
- xkb_keycode_t keycode;
+ xkb_keycode_t kc;
int op;
xkb_keysym_t keysym;
@@ -77,16 +77,16 @@ test_key_seq(struct xkb_keymap *keymap, ...)
va_start(ap, keymap);
for (;;) {
- keycode = va_arg(ap, int) + EVDEV_OFFSET;
+ kc = va_arg(ap, int) + EVDEV_OFFSET;
op = va_arg(ap, int);
- nsyms = xkb_key_get_syms(state, keycode, &syms);
- fprintf(stderr, "got %d syms for key 0x%x: [", nsyms, keycode);
+ nsyms = xkb_key_get_syms(state, kc, &syms);
+ fprintf(stderr, "got %d syms for key 0x%x: [", nsyms, kc);
if (op == DOWN || op == BOTH)
- xkb_state_update_key(state, keycode, XKB_KEY_DOWN);
+ xkb_state_update_key(state, kc, XKB_KEY_DOWN);
if (op == UP || op == BOTH)
- xkb_state_update_key(state, keycode, XKB_KEY_UP);
+ xkb_state_update_key(state, kc, XKB_KEY_UP);
for (i = 0; i < nsyms; i++) {
keysym = va_arg(ap, int);