API change: Rename xkb_map_* and group -> layout Move xkb_map_* functions to xkb_keymap_*, xkb_key_* functions under either xkb_keymap or xkb_state, and rename groups to layout in all user-visible API. Backwards-compatible hooks are provided, such that old source will build, but silently mangled to the new names, and old binaries will also continue to work. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
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
diff --git a/src/compat.c b/src/compat.c
index 1847edb..0b0adb7 100644
--- a/src/compat.c
+++ b/src/compat.c
@@ -29,5 +29,162 @@
#include "utils.h"
/* We don't carry any prototypes for these functions, as we #define them
+<<<<<<< HEAD
* to their newer versions so people link against those. */
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+
+XKB_EXPORT struct xkb_keymap *
+xkb_map_new_from_names(struct xkb_context *context,
+ const struct xkb_rule_names *names,
+ enum xkb_keymap_compile_flags flags)
+{
+ return xkb_keymap_new_from_names(context, names, flags);
+}
+
+XKB_EXPORT struct xkb_keymap *
+xkb_map_new_from_file(struct xkb_context *context, FILE *file,
+ enum xkb_keymap_format format,
+ enum xkb_keymap_compile_flags flags)
+{
+ return xkb_keymap_new_from_file(context, file, format, flags);
+}
+
+XKB_EXPORT struct xkb_keymap *
+xkb_map_new_from_string(struct xkb_context *context, const char *string,
+ enum xkb_keymap_format format,
+ enum xkb_keymap_compile_flags flags)
+{
+ return xkb_keymap_new_from_string(context, string, format, flags);
+}
+
+XKB_EXPORT char *
+xkb_map_get_as_string(struct xkb_keymap *keymap)
+{
+ return xkb_keymap_get_as_string(keymap);
+}
+
+XKB_EXPORT struct xkb_keymap *
+xkb_map_ref(struct xkb_keymap *keymap)
+{
+ return xkb_keymap_ref(keymap);
+}
+
+XKB_EXPORT void
+xkb_map_unref(struct xkb_keymap *keymap)
+{
+ xkb_keymap_unref(keymap);
+}
+
+XKB_EXPORT xkb_mod_index_t
+xkb_map_num_mods(struct xkb_keymap *keymap)
+{
+ return xkb_keymap_num_mods(keymap);
+}
+
+XKB_EXPORT const char *
+xkb_map_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx)
+{
+ return xkb_keymap_mod_get_name(keymap, idx);
+}
+
+XKB_EXPORT xkb_mod_index_t
+xkb_map_mod_get_index(struct xkb_keymap *keymap, const char *name)
+{
+ return xkb_keymap_mod_get_index(keymap, name);
+}
+
+XKB_EXPORT bool
+xkb_key_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t kc,
+ xkb_mod_index_t idx)
+{
+ return xkb_state_mod_index_is_consumed(state, kc, idx);
+}
+
+XKB_EXPORT xkb_mod_mask_t
+xkb_key_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t kc,
+ xkb_mod_mask_t mask)
+{
+ return xkb_state_mod_mask_remove_consumed(state, kc, mask);
+}
+
+XKB_EXPORT xkb_layout_index_t
+xkb_map_num_groups(struct xkb_keymap *keymap)
+{
+ return xkb_keymap_num_layouts(keymap);
+}
+
+XKB_EXPORT xkb_layout_index_t
+xkb_key_num_groups(struct xkb_keymap *keymap, xkb_keycode_t kc)
+{
+ return xkb_keymap_num_layouts_for_key(keymap, kc);
+}
+
+XKB_EXPORT const char *
+xkb_map_group_get_name(struct xkb_keymap *keymap, xkb_layout_index_t idx)
+{
+ return xkb_keymap_layout_get_name(keymap, idx);
+}
+
+XKB_EXPORT xkb_layout_index_t
+xkb_map_group_get_index(struct xkb_keymap *keymap, const char *name)
+{
+ return xkb_keymap_layout_get_index(keymap, name);
+}
+
+XKB_EXPORT xkb_led_index_t
+xkb_map_num_leds(struct xkb_keymap *keymap)
+{
+ return xkb_keymap_num_leds(keymap);
+}
+
+XKB_EXPORT const char *
+xkb_map_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx)
+{
+ return xkb_keymap_led_get_name(keymap, idx);
+}
+
+XKB_EXPORT xkb_led_index_t
+xkb_map_led_get_index(struct xkb_keymap *keymap, const char *name)
+{
+ return xkb_keymap_led_get_index(keymap, name);
+}
+
+XKB_EXPORT bool
+xkb_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t kc)
+{
+ return xkb_keymap_key_repeats(keymap, kc);
+}
+
+XKB_EXPORT int
+xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t kc,
+ const xkb_keysym_t **syms_out)
+{
+ return xkb_state_key_get_syms(state, kc, syms_out);
+}
+
+XKB_EXPORT bool
+xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
+ enum xkb_state_component type)
+{
+ return xkb_state_layout_name_is_active(state, name, type);
+}
+
+XKB_EXPORT bool
+xkb_state_group_index_is_active(struct xkb_state *state, xkb_layout_index_t idx,
+ enum xkb_state_component type)
+{
+ return xkb_state_layout_index_is_active(state, idx, type);
+}
+
+XKB_EXPORT xkb_layout_index_t
+xkb_state_serialize_group(struct xkb_state *state,
+ enum xkb_state_component type)
+{
+ return xkb_state_serialize_layout(state, type);
+}
+
+XKB_EXPORT struct xkb_keymap *
+xkb_state_get_map(struct xkb_state *state)
+{
+ return xkb_state_get_keymap(state);
+}
diff --git a/src/map.c b/src/map.c
index b75622f..31f4717 100644
--- a/src/map.c
+++ b/src/map.c
@@ -69,14 +69,14 @@ xkb_map_new(struct xkb_context *ctx)
}
XKB_EXPORT struct xkb_keymap *
-xkb_map_ref(struct xkb_keymap *keymap)
+xkb_keymap_ref(struct xkb_keymap *keymap)
{
keymap->refcnt++;
return keymap;
}
XKB_EXPORT void
-xkb_map_unref(struct xkb_keymap *keymap)
+xkb_keymap_unref(struct xkb_keymap *keymap)
{
unsigned int i;
struct xkb_key *key;
@@ -110,7 +110,7 @@ xkb_map_unref(struct xkb_keymap *keymap)
* Returns the total number of modifiers active in the keymap.
*/
XKB_EXPORT xkb_mod_index_t
-xkb_map_num_mods(struct xkb_keymap *keymap)
+xkb_keymap_num_mods(struct xkb_keymap *keymap)
{
xkb_mod_index_t i;
@@ -127,7 +127,7 @@ xkb_map_num_mods(struct xkb_keymap *keymap)
* Return the name for a given modifier.
*/
XKB_EXPORT const char *
-xkb_map_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx)
+xkb_keymap_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx)
{
const char *name;
@@ -148,7 +148,7 @@ xkb_map_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx)
* Returns the index for a named modifier.
*/
XKB_EXPORT xkb_mod_index_t
-xkb_map_mod_get_index(struct xkb_keymap *keymap, const char *name)
+xkb_keymap_mod_get_index(struct xkb_keymap *keymap, const char *name)
{
xkb_mod_index_t i;
xkb_atom_t atom;
@@ -174,8 +174,8 @@ xkb_map_mod_get_index(struct xkb_keymap *keymap, const char *name)
/**
* Return the total number of active groups in the keymap.
*/
-XKB_EXPORT xkb_group_index_t
-xkb_map_num_groups(struct xkb_keymap *keymap)
+XKB_EXPORT xkb_layout_index_t
+xkb_keymap_num_layouts(struct xkb_keymap *keymap)
{
return keymap->num_groups;
}
@@ -184,23 +184,23 @@ xkb_map_num_groups(struct xkb_keymap *keymap)
* Returns the name for a given group.
*/
XKB_EXPORT const char *
-xkb_map_group_get_name(struct xkb_keymap *keymap, xkb_group_index_t idx)
+xkb_keymap_layout_get_name(struct xkb_keymap *keymap, xkb_layout_index_t idx)
{
- if (idx >= xkb_map_num_groups(keymap))
+ if (idx >= xkb_keymap_num_layouts(keymap))
return NULL;
return xkb_atom_text(keymap->ctx, keymap->group_names[idx]);
}
/**
- * Returns the index for a named group.
+ * Returns the index for a named layout.
*/
-XKB_EXPORT xkb_group_index_t
-xkb_map_group_get_index(struct xkb_keymap *keymap, const char *name)
+XKB_EXPORT xkb_layout_index_t
+xkb_keymap_layout_get_index(struct xkb_keymap *keymap, const char *name)
{
- xkb_group_index_t num_groups = xkb_map_num_groups(keymap);
+ xkb_layout_index_t num_groups = xkb_keymap_num_layouts(keymap);
xkb_atom_t atom = xkb_atom_lookup(keymap->ctx, name);
- xkb_group_index_t i;
+ xkb_layout_index_t i;
if (atom == XKB_ATOM_NONE)
return XKB_GROUP_INVALID;
@@ -213,10 +213,10 @@ xkb_map_group_get_index(struct xkb_keymap *keymap, const char *name)
}
/**
- * Returns the number of groups active for a particular key.
+ * Returns the number of layouts active for a particular key.
*/
-XKB_EXPORT xkb_group_index_t
-xkb_key_num_groups(struct xkb_keymap *keymap, xkb_keycode_t kc)
+XKB_EXPORT xkb_layout_index_t
+xkb_keymap_num_layouts_for_key(struct xkb_keymap *keymap, xkb_keycode_t kc)
{
const struct xkb_key *key = XkbKey(keymap, kc);
if (!key)
@@ -229,7 +229,7 @@ xkb_key_num_groups(struct xkb_keymap *keymap, xkb_keycode_t kc)
* Return the total number of active LEDs in the keymap.
*/
XKB_EXPORT xkb_led_index_t
-xkb_map_num_leds(struct xkb_keymap *keymap)
+xkb_keymap_num_leds(struct xkb_keymap *keymap)
{
xkb_led_index_t ret = 0;
xkb_led_index_t i;
@@ -247,7 +247,7 @@ xkb_map_num_leds(struct xkb_keymap *keymap)
* Returns the name for a given group.
*/
XKB_EXPORT const char *
-xkb_map_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx)
+xkb_keymap_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx)
{
if (idx >= xkb_map_num_leds(keymap))
return NULL;
@@ -259,7 +259,7 @@ xkb_map_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx)
* Returns the index for a named group.
*/
XKB_EXPORT xkb_group_index_t
-xkb_map_led_get_index(struct xkb_keymap *keymap, const char *name)
+xkb_keymap_led_get_index(struct xkb_keymap *keymap, const char *name)
{
xkb_led_index_t num_leds = xkb_map_num_leds(keymap);
xkb_atom_t atom = xkb_atom_lookup(keymap->ctx, name);
@@ -381,8 +381,8 @@ err:
* number of symbols pointed to in syms_out.
*/
XKB_EXPORT int
-xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t kc,
- const xkb_keysym_t **syms_out)
+xkb_state_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);
xkb_group_index_t group;
@@ -410,7 +410,7 @@ err:
* Simple boolean specifying whether or not the key should repeat.
*/
XKB_EXPORT int
-xkb_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t kc)
+xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t kc)
{
const struct xkb_key *key = XkbKey(keymap, kc);
if (!key)
@@ -449,8 +449,8 @@ key_get_consumed(struct xkb_state *state, const struct xkb_key *key)
* from gtk+.
*/
XKB_EXPORT int
-xkb_key_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t kc,
- xkb_mod_index_t idx)
+xkb_state_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t kc,
+ xkb_mod_index_t idx)
{
const struct xkb_key *key = XkbKey(xkb_state_get_map(state), kc);
if (!key)
@@ -468,8 +468,8 @@ xkb_key_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t kc,
* consumed by the type handling.
*/
XKB_EXPORT xkb_mod_mask_t
-xkb_key_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t kc,
- xkb_mod_mask_t mask)
+xkb_state_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t kc,
+ xkb_mod_mask_t mask)
{
const struct xkb_key *key = XkbKey(xkb_state_get_map(state), kc);
if (!key)
diff --git a/src/map.h b/src/map.h
index b770504..6f65f9c 100644
--- a/src/map.h
+++ b/src/map.h
@@ -311,7 +311,7 @@ struct xkb_key {
char name[XKB_KEY_NAME_LENGTH];
enum xkb_explicit_components explicit;
- xkb_group_mask_t explicit_groups;
+ xkb_layout_mask_t explicit_groups;
unsigned char modmap;
xkb_mod_mask_t vmodmap;
@@ -322,12 +322,12 @@ struct xkb_key {
unsigned kt_index[XKB_NUM_GROUPS];
- xkb_group_index_t num_groups;
+ xkb_layout_index_t num_groups;
/* How many levels the largest group has. */
xkb_level_index_t width;
enum xkb_range_exceed_type out_of_range_group_action;
- xkb_group_index_t out_of_range_group_number;
+ xkb_layout_index_t out_of_range_group_number;
/* per level/group index into 'syms' */
int *sym_index;
@@ -341,7 +341,7 @@ struct xkb_keymap {
struct xkb_context *ctx;
int refcnt;
- enum xkb_map_compile_flags flags;
+ enum xkb_keymap_compile_flags flags;
unsigned int enabled_ctrls;
@@ -363,7 +363,7 @@ struct xkb_keymap {
xkb_atom_t vmod_names[XKB_NUM_VIRTUAL_MODS];
/* Number of groups in the key with the most groups. */
- xkb_group_index_t num_groups;
+ xkb_layout_index_t num_groups;
xkb_atom_t group_names[XKB_NUM_GROUPS];
struct xkb_indicator_map indicators[XKB_NUM_INDICATORS];
@@ -394,53 +394,53 @@ XkbKeyGetKeycode(struct xkb_keymap *keymap, const struct xkb_key *key)
static inline struct xkb_key_type *
XkbKeyType(struct xkb_keymap *keymap, const struct xkb_key *key,
- xkb_group_index_t group)
+ xkb_layout_index_t layout)
{
- return &keymap->types[key->kt_index[group]];
+ return &keymap->types[key->kt_index[layout]];
}
static inline xkb_level_index_t
XkbKeyGroupWidth(struct xkb_keymap *keymap, const struct xkb_key *key,
- xkb_group_index_t group)
+ xkb_layout_index_t layout)
{
- return XkbKeyType(keymap, key, group)->num_levels;
+ return XkbKeyType(keymap, key, layout)->num_levels;
}
static inline unsigned int
-XkbKeyNumSyms(const struct xkb_key *key, xkb_group_index_t group,
+XkbKeyNumSyms(const struct xkb_key *key, xkb_layout_index_t layout,
xkb_level_index_t level)
{
- return key->num_syms[group * key->width + level];
+ return key->num_syms[layout * key->width + level];
}
static inline const xkb_keysym_t *
-XkbKeySymEntry(const struct xkb_key *key, xkb_group_index_t group,
+XkbKeySymEntry(const struct xkb_key *key, xkb_layout_index_t layout,
xkb_level_index_t level)
{
- return &key->syms[key->sym_index[group * key->width + level]];
+ return &key->syms[key->sym_index[layout * key->width + level]];
}
static inline const union xkb_action *
-XkbKeyActionEntry(const struct xkb_key *key, xkb_group_index_t group,
+XkbKeyActionEntry(const struct xkb_key *key, xkb_layout_index_t layout,
xkb_level_index_t level)
{
- return &key->actions[key->width * group + level];
+ return &key->actions[key->width * layout + level];
}
struct xkb_keymap *
xkb_map_new(struct xkb_context *ctx);
-xkb_group_index_t
+xkb_layout_index_t
xkb_key_get_group(struct xkb_state *state, const struct xkb_key *key);
xkb_level_index_t
xkb_key_get_level(struct xkb_state *state, const struct xkb_key *key,
- xkb_group_index_t group);
+ xkb_layout_index_t layout);
int
xkb_key_get_syms_by_level(struct xkb_keymap *keymap,
const struct xkb_key *key,
- xkb_group_index_t group, xkb_level_index_t level,
+ xkb_layout_index_t layout, xkb_level_index_t level,
const xkb_keysym_t **syms_out);
#endif
diff --git a/xkbcommon/xkbcommon-compat.h b/xkbcommon/xkbcommon-compat.h
index f258651..2cd764f 100644
--- a/xkbcommon/xkbcommon-compat.h
+++ b/xkbcommon/xkbcommon-compat.h
@@ -26,4 +26,58 @@
#ifndef _XKBCOMMON_COMPAT_H
#define _XKBCOMMON_COMPAT_H
+/**
+ * Renamed keymap API.
+ */
+#define xkb_group_index_t xkb_layout_index_t
+#define xkb_group_mask_t xkb_layout_mask_t
+#define xkb_map_compile_flags xkb_keymap_compile_flags
+#define XKB_GROUP_INVALID XKB_LAYOUT_INVALID
+
+#define xkb_map_new_from_names(context, names, flags) \
+ xkb_keymap_new_from_names(context, names, flags)
+#define xkb_map_new_from_file(context, file, format, flags) \
+ xkb_keymap_new_from_file(context, file, format, flags)
+#define xkb_map_new_from_string(context, string, format, flags) \
+ xkb_keymap_new_from_string(context, string, format, flags)
+#define xkb_map_get_as_string(keymap) xkb_keymap_get_as_string(keymap)
+#define xkb_map_ref(keymap) xkb_keymap_ref(keymap)
+#define xkb_map_unref(keymap) xkb_keymap_unref(keymap)
+
+#define xkb_map_num_mods(keymap) xkb_keymap_num_mods(keymap)
+#define xkb_map_mod_get_name(keymap, idx) xkb_keymap_mod_get_name(keymap, idx)
+#define xkb_map_mod_get_index(keymap, str) xkb_keymap_mod_get_index(keymap, str)
+#define xkb_key_mod_index_is_consumed(state, key, mod) \
+ xkb_state_mod_index_is_consumed(state, key, mod)
+#define xkb_key_mod_mask_remove_consumed(state, key, modmask) \
+ xkb_state_mod_mask_remove_consumed(state, key, modmask)
+
+#define xkb_map_num_groups(keymap) xkb_keymap_num_layouts(keymap)
+#define xkb_key_num_groups(keymap, key) \
+ xkb_keymap_num_layouts_for_key(keymap, key)
+#define xkb_map_group_get_name(keymap, idx) \
+ xkb_keymap_layout_get_name(keymap, idx)
+#define xkb_map_group_get_index(keymap, str) \
+ xkb_keymap_layout_get_index(keymap, str)
+
+#define xkb_map_num_leds(keymap) xkb_keymap_num_leds(keymap)
+#define xkb_map_led_get_name(keymap, idx) xkb_keymap_led_get_name(keymap, idx)
+#define xkb_map_led_get_index(keymap, str) \
+ xkb_keymap_led_get_index(keymap, str)
+
+#define xkb_key_repeats(keymap, key) xkb_keymap_key_repeats(keymap, key)
+
+#define xkb_key_get_syms(state, key, syms_out) \
+ xkb_state_key_get_syms(state, key, syms_out)
+
+#define xkb_state_group_name_is_active(state, name, type) \
+ xkb_state_layout_name_is_active(state, name, type)
+#define xkb_state_group_index_is_active(state, idx, type) \
+ xkb_state_layout_index_is_active(state, idx, type)
+
+#define xkb_state_serialize_group(state, component) \
+ xkb_state_serialize_layout(state, component)
+
+#define xkb_state_get_map(state) xkb_state_get_keymap(state)
+
#endif
diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h
index fb5d450..f464c21 100644
--- a/xkbcommon/xkbcommon.h
+++ b/xkbcommon/xkbcommon.h
@@ -91,12 +91,13 @@ typedef uint32_t xkb_keycode_t;
typedef uint32_t xkb_keysym_t;
typedef uint32_t xkb_mod_index_t;
typedef uint32_t xkb_mod_mask_t;
-typedef uint32_t xkb_group_index_t;
-typedef uint32_t xkb_group_mask_t;
+typedef uint32_t xkb_layout_index_t;
+typedef uint32_t xkb_layout_mask_t;
typedef uint32_t xkb_led_index_t;
+typedef uint32_t xkb_led_mask_t;
#define XKB_MOD_INVALID (0xffffffff)
-#define XKB_GROUP_INVALID (0xffffffff)
+#define XKB_LAYOUT_INVALID (0xffffffff)
#define XKB_KEYCODE_INVALID (0xffffffff)
#define XKB_LED_INVALID (0xffffffff)
@@ -341,7 +342,7 @@ xkb_set_user_data(struct xkb_context *context, void *user_data);
* @{
*/
-enum xkb_map_compile_flags {
+enum xkb_keymap_compile_flags {
/** Apparently you can't have empty enums. What a drag. */
XKB_MAP_COMPILE_PLACEHOLDER = 0,
};
@@ -354,9 +355,9 @@ enum xkb_map_compile_flags {
* keymaps.
*/
struct xkb_keymap *
-xkb_map_new_from_names(struct xkb_context *context,
- const struct xkb_rule_names *names,
- enum xkb_map_compile_flags flags);
+xkb_keymap_new_from_names(struct xkb_context *context,
+ const struct xkb_rule_names *names,
+ enum xkb_keymap_compile_flags flags);
enum xkb_keymap_format {
/** The current/classic XKB text format, as generated by xkbcomp -xkb. */
@@ -368,37 +369,37 @@ enum xkb_keymap_format {
* file.
*/
struct xkb_keymap *
-xkb_map_new_from_file(struct xkb_context *context, FILE *file,
- enum xkb_keymap_format format,
- enum xkb_map_compile_flags flags);
+xkb_keymap_new_from_file(struct xkb_context *context, FILE *file,
+ enum xkb_keymap_format format,
+ enum xkb_keymap_compile_flags flags);
/**
* Creates an XKB keymap from a full text XKB keymap serialized into one
* enormous string.
*/
struct xkb_keymap *
-xkb_map_new_from_string(struct xkb_context *context, const char *string,
- enum xkb_keymap_format format,
- enum xkb_map_compile_flags flags);
+xkb_keymap_new_from_string(struct xkb_context *context, const char *string,
+ enum xkb_keymap_format format,
+ enum xkb_keymap_compile_flags flags);
/**
* Returns the compiled XKB map as a string which can later be fed back into
* xkb_map_new_from_string to return the exact same keymap.
*/
char *
-xkb_map_get_as_string(struct xkb_keymap *keymap);
+xkb_keymap_get_as_string(struct xkb_keymap *keymap);
/**
* Takes a new reference on a keymap.
*/
struct xkb_keymap *
-xkb_map_ref(struct xkb_keymap *keymap);
+xkb_keymap_ref(struct xkb_keymap *keymap);
/**
* Releases a reference on a keymap.
*/
void
-xkb_map_unref(struct xkb_keymap *keymap);
+xkb_keymap_unref(struct xkb_keymap *keymap);
/** @} */
@@ -414,67 +415,67 @@ xkb_map_unref(struct xkb_keymap *keymap);
* Returns the number of modifiers active in the keymap.
*/
xkb_mod_index_t
-xkb_map_num_mods(struct xkb_keymap *keymap);
+xkb_keymap_num_mods(struct xkb_keymap *keymap);
/**
* Returns the name of the modifier specified by 'idx', or NULL if invalid.
*/
const char *
-xkb_map_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx);
+xkb_keymap_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx);
/**
* Returns the index of the modifier specified by 'name', or XKB_MOD_INVALID.
*/
xkb_mod_index_t
-xkb_map_mod_get_index(struct xkb_keymap *keymap, const char *name);
+xkb_keymap_mod_get_index(struct xkb_keymap *keymap, const char *name);
/**
* Returns the number of groups active in the keymap.
*/
-xkb_group_index_t
-xkb_map_num_groups(struct xkb_keymap *keymap);
+xkb_layout_index_t
+xkb_keymap_num_layouts(struct xkb_keymap *keymap);
/**
* Returns the name of the group specified by 'idx', or NULL if invalid.
*/
const char *
-xkb_map_group_get_name(struct xkb_keymap *keymap, xkb_group_index_t idx);
+xkb_keymap_layout_get_name(struct xkb_keymap *keymap, xkb_layout_index_t idx);
/**
- * Returns the index of the group specified by 'name', or XKB_GROUP_INVALID.
+ * Returns the index of the layout specified by 'name', or XKB_LAYOUT_INVALID.
*/
-xkb_group_index_t
-xkb_map_group_get_index(struct xkb_keymap *keymap, const char *name);
+xkb_layout_index_t
+xkb_keymap_layout_get_index(struct xkb_keymap *keymap, const char *name);
/**
- * Returns the number of groups active for the specified key.
+ * Returns the number of layouts active for the specified key.
*/
-xkb_group_index_t
-xkb_key_num_groups(struct xkb_keymap *keymap, xkb_keycode_t key);
+xkb_layout_index_t
+xkb_keymap_num_layouts_for_key(struct xkb_keymap *keymap, xkb_keycode_t key);
/**
* Returns 1 if the key should repeat, or 0 otherwise.
*/
int
-xkb_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key);
+xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key);
/**
* Returns the number of LEDs in the given map.
*/
xkb_led_index_t
-xkb_map_num_leds(struct xkb_keymap *keymap);
+xkb_keymap_num_leds(struct xkb_keymap *keymap);
/**
* Returns the name of the LED specified by 'idx', or NULL if invalid.
*/
const char *
-xkb_map_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx);
+xkb_keymap_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx);
/**
* Returns the index of the LED specified by 'name', or XKB_LED_INVALID.
*/
xkb_led_index_t
-xkb_map_led_get_index(struct xkb_keymap *keymap, const char *name);
+xkb_keymap_led_get_index(struct xkb_keymap *keymap, const char *name);
/** @} */
@@ -512,7 +513,7 @@ xkb_state_unref(struct xkb_state *state);
* if you plan to use it beyond the lifetime of the state.
*/
struct xkb_keymap *
-xkb_state_get_map(struct xkb_state *state);
+xkb_state_get_keymap(struct xkb_state *state);
enum xkb_key_direction {
XKB_KEY_UP,
@@ -532,12 +533,10 @@ xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
* return value being the number of symbols in *syms_out. If the return
* value is 0, *syms_out will be set to NULL, as there are no symbols produced
* by this event.
- *
- * This should be called before xkb_state_update_key.
*/
int
-xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
- const xkb_keysym_t **syms_out);
+xkb_state_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
+ const xkb_keysym_t **syms_out);
/**
* Modifier and group types for state objects. This enum is bitmaskable,
@@ -593,9 +592,9 @@ enum xkb_state_match {
void
xkb_state_update_mask(struct xkb_state *state, xkb_mod_mask_t base_mods,
xkb_mod_mask_t latched_mods, xkb_mod_mask_t locked_mods,
- xkb_group_index_t base_group,
- xkb_group_index_t latched_group,
- xkb_group_index_t locked_group);
+ xkb_layout_index_t base_group,
+ xkb_layout_index_t latched_group,
+ xkb_layout_index_t locked_group);
/**
* The counterpart to xkb_state_update_mask, to be used on the server side
@@ -615,9 +614,9 @@ xkb_state_serialize_mods(struct xkb_state *state,
* The group equivalent of xkb_state_serialize_mods: please see its
* documentation.
*/
-xkb_group_index_t
-xkb_state_serialize_group(struct xkb_state *state,
- enum xkb_state_component component);
+xkb_layout_index_t
+xkb_state_serialize_layout(struct xkb_state *state,
+ enum xkb_state_component component);
/**
* Returns 1 if the modifier specified by 'name' is active in the manner
@@ -668,8 +667,8 @@ xkb_state_mod_indices_are_active(struct xkb_state *state,
* Returns 0 otherwise.
*/
int
-xkb_key_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key,
- xkb_mod_index_t idx);
+xkb_state_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key,
+ xkb_mod_index_t idx);
/**
* Takes the given modifier mask, and removes all modifiers which are
@@ -677,8 +676,8 @@ xkb_key_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key,
* for that particular key.
*/
xkb_mod_mask_t
-xkb_key_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key,
- xkb_mod_mask_t mask);
+xkb_state_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key,
+ xkb_mod_mask_t mask);
/**
* Returns 1 if the group specified by 'name' is active in the manner
@@ -686,8 +685,8 @@ xkb_key_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key,
* exist in the current map.
*/
int
-xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
- enum xkb_state_component type);
+xkb_state_layout_name_is_active(struct xkb_state *state, const char *name,
+ enum xkb_state_component type);
/**
* Returns 1 if the group specified by 'idx' is active in the manner
@@ -695,9 +694,9 @@ xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
* exist in the current map.
*/
int
-xkb_state_group_index_is_active(struct xkb_state *state,
- xkb_group_index_t idx,
- enum xkb_state_component type);
+xkb_state_layout_index_is_active(struct xkb_state *state,
+ xkb_layout_index_t idx,
+ enum xkb_state_component type);
/**
* Returns 1 if the LED specified by 'name' is active, 0 if it is unset, or