Remove Xfuncproto.h and XKB.h from xkbcommon/xkbcommon.h The kbproto header is already not needed here anymore. Move the _X_EXPORT's to the corresponding function definitions, and use straight extern "C" clauses instead of _XFUNCPROTOBEGIN/END. It also makes more sense to have the EXPORT's in the source files, as it provides some documentation to the reader, whereas in the header it's obvious. Signed-off-by: Ran Benita <ran234@gmail.com> [daniels: Updated for xkb_keymap changes.]
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
diff --git a/include/xkbcommon/xkbcommon.h b/include/xkbcommon/xkbcommon.h
index ebdefb0..185d11b 100644
--- a/include/xkbcommon/xkbcommon.h
+++ b/include/xkbcommon/xkbcommon.h
@@ -80,10 +80,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef _XKBCOMMON_H_
#define _XKBCOMMON_H_
+#include <stddef.h>
#include <stdint.h>
-#include <stdio.h>
-#include <X11/Xfuncproto.h>
-#include <X11/extensions/XKB.h>
typedef uint32_t xkb_keycode_t;
typedef uint32_t xkb_keysym_t;
@@ -108,7 +106,6 @@ typedef uint32_t xkb_led_index_t;
xkb_keycode_is_legal_ext(xkb->min_key_code) && \
xkb_keycode_is_legal_ext(xkb->max_key_code))
-
/**
* Names to compile a keymap with, also known as RMLVO. These names together
* should be the primary identifier for a keymap.
@@ -152,7 +149,9 @@ struct xkb_keymap;
*/
struct xkb_state;
-_XFUNCPROTOBEGIN
+#ifdef __cplusplus
+extern "C" {
+#endif
/*
* Canonicalises component names by prepending the relevant component from
@@ -168,7 +167,7 @@ _XFUNCPROTOBEGIN
* If a component in names needs to be modified, the existing value will be
* free()d, and a new one allocated with malloc().
*/
-_X_EXPORT extern void
+void
xkb_canonicalise_components(struct xkb_component_names *names,
const struct xkb_component_names *old);
@@ -176,14 +175,14 @@ xkb_canonicalise_components(struct xkb_component_names *names,
* Converts a keysym to a string; will return unknown Unicode codepoints
* as "Ua1b2", and other unknown keysyms as "0xabcd1234".
*/
-_X_EXPORT extern void
+void
xkb_keysym_to_string(xkb_keysym_t ks, char *buffer, size_t size);
/*
* See xkb_keysym_to_string comments: this function will accept any string
* from that function.
*/
-_X_EXPORT extern xkb_keysym_t
+xkb_keysym_t
xkb_string_to_keysym(const char *s);
/**
@@ -199,7 +198,7 @@ xkb_string_to_keysym(const char *s);
* holds a reference on the context, and must free it when finished with
* xkb_context_unref().
*/
-_X_EXPORT struct xkb_context *
+struct xkb_context *
xkb_context_new(void);
/**
@@ -207,7 +206,7 @@ xkb_context_new(void);
* Returns 1 on success, or 0 if the include path could not be added or is
* inaccessible.
*/
-_X_EXPORT int
+int
xkb_context_include_path_append(struct xkb_context *context, const char *path);
/**
@@ -215,7 +214,7 @@ xkb_context_include_path_append(struct xkb_context *context, const char *path);
* Returns 1 on success, or 0 if the primary include path could not be
* added.
*/
-_X_EXPORT int
+int
xkb_context_include_path_append_default(struct xkb_context *context);
/**
@@ -223,37 +222,37 @@ xkb_context_include_path_append_default(struct xkb_context *context);
* default paths. Returns 1 on success, or 0 if the primary include path
* could not be added.
*/
-_X_EXPORT int
+int
xkb_context_include_path_reset_defaults(struct xkb_context *context);
/**
* Removes all entries from the context's include path.
*/
-_X_EXPORT void
+void
xkb_context_include_path_clear(struct xkb_context *context);
/**
* Returns the number of include paths currently active in the context.
*/
-_X_EXPORT unsigned int
+unsigned int
xkb_context_num_include_paths(struct xkb_context *context);
/**
* Returns the include path at the specified index within the context.
*/
-_X_EXPORT const char *
+const char *
xkb_context_include_path_get(struct xkb_context *context, unsigned int index);
/**
* Takes a new reference on an XKB context.
*/
-_X_EXPORT struct xkb_context *
+struct xkb_context *
xkb_context_ref(struct xkb_context *context);
/**
* Releases a reference on an XKB context, and possibly frees it.
*/
-_X_EXPORT void
+void
xkb_context_unref(struct xkb_context *context);
/** @} */
@@ -272,7 +271,7 @@ xkb_context_unref(struct xkb_context *context);
* You should almost certainly be using this and nothing else to create
* keymaps.
*/
-_X_EXPORT extern struct xkb_keymap *
+struct xkb_keymap *
xkb_map_new_from_names(struct xkb_context *context,
const struct xkb_rule_names *names);
@@ -286,7 +285,7 @@ xkb_map_new_from_names(struct xkb_context *context,
*
* Geometry will be ignored since xkbcommon does not support it in any way.
*/
-_X_EXPORT extern struct xkb_keymap *
+struct xkb_keymap *
xkb_map_new_from_kccgst(struct xkb_context *context,
const struct xkb_component_names *kccgst);
@@ -299,7 +298,7 @@ enum xkb_keymap_format {
* Creates an XKB keymap from a full text XKB keymap passed into the
* file descriptor.
*/
-_X_EXPORT extern struct xkb_keymap *
+struct xkb_keymap *
xkb_map_new_from_fd(struct xkb_context *context,
int fd, enum xkb_keymap_format format);
@@ -307,7 +306,7 @@ xkb_map_new_from_fd(struct xkb_context *context,
* Creates an XKB keymap from a full text XKB keymap serialised into one
* enormous string.
*/
-_X_EXPORT extern struct xkb_keymap *
+struct xkb_keymap *
xkb_map_new_from_string(struct xkb_context *context,
const char *string,
enum xkb_keymap_format format);
@@ -315,13 +314,13 @@ xkb_map_new_from_string(struct xkb_context *context,
/**
* Takes a new reference on a keymap.
*/
-_X_EXPORT extern struct xkb_keymap *
+struct xkb_keymap *
xkb_map_ref(struct xkb_keymap *xkb);
/**
* Releases a reference on a keymap.
*/
-_X_EXPORT extern void
+void
xkb_map_unref(struct xkb_keymap *xkb);
/** @} */
@@ -337,61 +336,61 @@ xkb_map_unref(struct xkb_keymap *xkb);
/**
* Returns the number of modifiers active in the keymap.
*/
-_X_EXPORT xkb_mod_index_t
+xkb_mod_index_t
xkb_map_num_mods(struct xkb_keymap *xkb);
/**
* Returns the name of the modifier specified by 'idx', or NULL if invalid.
*/
-_X_EXPORT const char *
+const char *
xkb_map_mod_get_name(struct xkb_keymap *xkb, xkb_mod_index_t idx);
/**
* Returns the index of the modifier specified by 'name', or XKB_MOD_INVALID.
*/
-_X_EXPORT xkb_mod_index_t
+xkb_mod_index_t
xkb_map_mod_get_index(struct xkb_keymap *xkb, const char *name);
/**
* Returns the number of groups active in the keymap.
*/
-_X_EXPORT xkb_group_index_t
+xkb_group_index_t
xkb_map_num_groups(struct xkb_keymap *xkb);
/**
* Returns the name of the group specified by 'idx', or NULL if invalid.
*/
-_X_EXPORT const char *
+const char *
xkb_map_group_get_name(struct xkb_keymap *xkb, xkb_group_index_t idx);
/**
* Returns the index of the group specified by 'name', or XKB_GROUP_INVALID.
*/
-_X_EXPORT xkb_group_index_t
+xkb_group_index_t
xkb_map_group_get_index(struct xkb_keymap *xkb, const char *name);
/**
* Returns the number of groups active for the specified key.
*/
-_X_EXPORT xkb_group_index_t
+xkb_group_index_t
xkb_key_num_groups(struct xkb_keymap *xkb, xkb_keycode_t key);
/**
* Returns the number of LEDs in the given map.
*/
-_X_EXPORT xkb_led_index_t
+xkb_led_index_t
xkb_map_num_leds(struct xkb_keymap *xkb);
/**
* Returns the name of the LED specified by 'idx', or NULL if invalid.
*/
-_X_EXPORT const char *
+const char *
xkb_map_led_get_name(struct xkb_keymap *xkb, xkb_led_index_t idx);
/**
* Returns the index of the LED specified by 'name', or XKB_LED_INVALID.
*/
-_X_EXPORT xkb_led_index_t
+xkb_led_index_t
xkb_map_led_get_index(struct xkb_keymap *xkb, const char *name);
/** @} */
@@ -408,20 +407,20 @@ xkb_map_led_get_index(struct xkb_keymap *xkb, const char *name);
* Returns a new XKB state object for use with the given keymap, or NULL on
* failure.
*/
-_X_EXPORT struct xkb_state *
+struct xkb_state *
xkb_state_new(struct xkb_keymap *xkb);
/**
* Takes a new reference on a state object.
*/
-_X_EXPORT struct xkb_state *
+struct xkb_state *
xkb_state_ref(struct xkb_state *state);
/**
* Unrefs and potentially deallocates a state object; the caller must not
* use the state object after calling this.
*/
-_X_EXPORT void
+void
xkb_state_unref(struct xkb_state *state);
enum xkb_key_direction {
@@ -432,7 +431,7 @@ enum xkb_key_direction {
/**
* Updates a state object to reflect the given key being pressed or released.
*/
-_X_EXPORT void
+void
xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
enum xkb_key_direction direction);
@@ -445,7 +444,7 @@ xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
*
* This should be called before xkb_state_update_key.
*/
-_X_EXPORT unsigned int
+unsigned int
xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
const xkb_keysym_t **syms_out);
@@ -484,7 +483,7 @@ enum xkb_state_component {
*
* Please do not use this unless you fit the description above.
*/
-_X_EXPORT void
+void
xkb_state_update_mask(struct xkb_state *state,
xkb_mod_mask_t base_mods,
xkb_mod_mask_t latched_mods,
@@ -503,7 +502,7 @@ xkb_state_update_mask(struct xkb_state *state,
*
* Can return NULL on failure.
*/
-_X_EXPORT xkb_mod_mask_t
+xkb_mod_mask_t
xkb_state_serialise_mods(struct xkb_state *state,
enum xkb_state_component component);
@@ -511,7 +510,7 @@ xkb_state_serialise_mods(struct xkb_state *state,
* The group equivalent of xkb_state_serialise_mods: please see its
* documentation.
*/
-_X_EXPORT xkb_group_index_t
+xkb_group_index_t
xkb_state_serialise_group(struct xkb_state *state,
enum xkb_state_component component);
@@ -520,7 +519,7 @@ xkb_state_serialise_group(struct xkb_state *state,
* specified by 'type', 0 if it is unset, or -1 if the modifier does not
* exist in the current map.
*/
-_X_EXPORT int
+int
xkb_state_mod_name_is_active(struct xkb_state *state, const char *name,
enum xkb_state_component type);
@@ -529,7 +528,7 @@ xkb_state_mod_name_is_active(struct xkb_state *state, const char *name,
* specified by 'type', 0 if it is unset, or -1 if the modifier does not
* exist in the current map.
*/
-_X_EXPORT int
+int
xkb_state_mod_index_is_active(struct xkb_state *state, xkb_mod_index_t idx,
enum xkb_state_component type);
@@ -538,7 +537,7 @@ xkb_state_mod_index_is_active(struct xkb_state *state, xkb_mod_index_t idx,
* specified by 'type', 0 if it is unset, or -1 if the group does not
* exist in the current map.
*/
-_X_EXPORT int
+int
xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
enum xkb_state_component type);
@@ -547,7 +546,7 @@ xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
* specified by 'type', 0 if it is unset, or -1 if the group does not
* exist in the current map.
*/
-_X_EXPORT int
+int
xkb_state_group_index_is_active(struct xkb_state *state, xkb_group_index_t idx,
enum xkb_state_component type);
@@ -555,18 +554,20 @@ xkb_state_group_index_is_active(struct xkb_state *state, xkb_group_index_t idx,
* Returns 1 if the LED specified by 'name' is active, 0 if it is unset, or
* -1 if the LED does not exist in the current map.
*/
-_X_EXPORT int
+int
xkb_state_led_name_is_active(struct xkb_state *state, const char *name);
/**
* Returns 1 if the LED specified by 'idx' is active, 0 if it is unset, or
* -1 if the LED does not exist in the current map.
*/
-_X_EXPORT int
+int
xkb_state_led_index_is_active(struct xkb_state *state, xkb_led_index_t idx);
/** @} */
-_XFUNCPROTOEND
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
#endif /* _XKBCOMMON_H_ */
diff --git a/src/XKBcommonint.h b/src/XKBcommonint.h
index 5d63ce9..92220b6 100644
--- a/src/XKBcommonint.h
+++ b/src/XKBcommonint.h
@@ -81,6 +81,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <stdlib.h>
#include <string.h>
+#include <X11/extensions/XKB.h>
#include "xkbcommon/xkbcommon.h"
diff --git a/src/context.c b/src/context.c
index a2c8f56..8878b16 100644
--- a/src/context.c
+++ b/src/context.c
@@ -46,7 +46,7 @@ struct xkb_context {
/**
* Append one directory to the context's include path.
*/
-int
+_X_EXPORT int
xkb_context_include_path_append(struct xkb_context *context, const char *path)
{
struct stat stat_buf;
@@ -85,7 +85,7 @@ xkb_context_include_path_append(struct xkb_context *context, const char *path)
/**
* Append the default include directories to the context.
*/
-int
+_X_EXPORT int
xkb_context_include_path_append_default(struct xkb_context *context)
{
const char *home = getenv("HOME");
@@ -109,7 +109,7 @@ xkb_context_include_path_append_default(struct xkb_context *context)
/**
* Remove all entries in the context's include path.
*/
-void
+_X_EXPORT void
xkb_context_include_path_clear(struct xkb_context *context)
{
int i;
@@ -126,7 +126,7 @@ xkb_context_include_path_clear(struct xkb_context *context)
/**
* xkb_context_include_path_clear() + xkb_context_include_path_append_default()
*/
-int
+_X_EXPORT int
xkb_context_include_path_reset_defaults(struct xkb_context *context)
{
xkb_context_include_path_clear(context);
@@ -136,7 +136,7 @@ xkb_context_include_path_reset_defaults(struct xkb_context *context)
/**
* Returns the number of entries in the context's include path.
*/
-unsigned int
+_X_EXPORT unsigned int
xkb_context_num_include_paths(struct xkb_context *context)
{
return context->num_include_paths;
@@ -146,7 +146,7 @@ xkb_context_num_include_paths(struct xkb_context *context)
* Returns the given entry in the context's include path, or NULL if an
* invalid index is passed.
*/
-const char *
+_X_EXPORT const char *
xkb_context_include_path_get(struct xkb_context *context, unsigned int idx)
{
if (idx >= xkb_context_num_include_paths(context))
@@ -158,7 +158,7 @@ xkb_context_include_path_get(struct xkb_context *context, unsigned int idx)
/**
* Take a new reference on the context.
*/
-struct xkb_context *
+_X_EXPORT struct xkb_context *
xkb_context_ref(struct xkb_context *context)
{
context->refcnt++;
@@ -169,7 +169,7 @@ xkb_context_ref(struct xkb_context *context)
* Drop an existing reference on the context, and free it if the refcnt is
* now 0.
*/
-void
+_X_EXPORT void
xkb_context_unref(struct xkb_context *context)
{
if (--context->refcnt > 0)
@@ -182,7 +182,7 @@ xkb_context_unref(struct xkb_context *context)
/**
* Create a new context.
*/
-struct xkb_context *
+_X_EXPORT struct xkb_context *
xkb_context_new(void)
{
struct xkb_context *context = calloc(1, sizeof(*context));
diff --git a/src/keysym.c b/src/keysym.c
index add0b83..8f6515d 100644
--- a/src/keysym.c
+++ b/src/keysym.c
@@ -28,15 +28,16 @@ authorization from the authors.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <X11/keysymdef.h>
-#include "xkbmisc.h"
-#include "xkbcommon/xkbcommon.h"
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
+#include <X11/keysymdef.h>
#include "ks_tables.h"
+#include "xkbmisc.h"
+#include "xkbcommon/xkbcommon.h"
-void
+_X_EXPORT void
xkb_keysym_to_string(xkb_keysym_t ks, char *buffer, size_t size)
{
int i, n, h, idx;
@@ -90,7 +91,7 @@ xkb_keysym_to_string(xkb_keysym_t ks, char *buffer, size_t size)
snprintf(buffer, size, "0x%08x", ks);
}
-xkb_keysym_t
+_X_EXPORT xkb_keysym_t
xkb_string_to_keysym(const char *s)
{
int i, n, h, c, idx;
diff --git a/src/map.c b/src/map.c
index cde9a6f..f41beb4 100644
--- a/src/map.c
+++ b/src/map.c
@@ -61,7 +61,7 @@
/**
* Returns the total number of modifiers active in the keymap.
*/
-xkb_mod_index_t
+_X_EXPORT xkb_mod_index_t
xkb_map_num_mods(struct xkb_keymap *xkb)
{
xkb_mod_index_t i;
@@ -78,7 +78,7 @@ xkb_map_num_mods(struct xkb_keymap *xkb)
/**
* Return the name for a given modifier.
*/
-const char *
+_X_EXPORT const char *
xkb_map_mod_get_name(struct xkb_keymap *xkb, xkb_mod_index_t idx)
{
if (idx >= xkb_map_num_mods(xkb))
@@ -113,7 +113,7 @@ xkb_map_mod_get_name(struct xkb_keymap *xkb, xkb_mod_index_t idx)
/**
* Returns the index for a named modifier.
*/
-xkb_mod_index_t
+_X_EXPORT xkb_mod_index_t
xkb_map_mod_get_index(struct xkb_keymap *xkb, const char *name)
{
xkb_mod_index_t i;
@@ -146,7 +146,7 @@ xkb_map_mod_get_index(struct xkb_keymap *xkb, const char *name)
/**
* Return the total number of active groups in the keymap.
*/
-xkb_group_index_t
+_X_EXPORT xkb_group_index_t
xkb_map_num_groups(struct xkb_keymap *xkb)
{
xkb_group_index_t ret = 0;
@@ -162,7 +162,7 @@ xkb_map_num_groups(struct xkb_keymap *xkb)
/**
* Returns the name for a given group.
*/
-const char *
+_X_EXPORT const char *
xkb_map_group_get_name(struct xkb_keymap *xkb, xkb_group_index_t idx)
{
if (idx >= xkb_map_num_groups(xkb))
@@ -174,7 +174,7 @@ xkb_map_group_get_name(struct xkb_keymap *xkb, xkb_group_index_t idx)
/**
* Returns the index for a named group.
*/
-xkb_group_index_t
+_X_EXPORT xkb_group_index_t
xkb_map_group_get_index(struct xkb_keymap *xkb, const char *name)
{
xkb_group_index_t num_groups = xkb_map_num_groups(xkb);
@@ -191,7 +191,7 @@ xkb_map_group_get_index(struct xkb_keymap *xkb, const char *name)
/**
* Returns the number of groups active for a particular key.
*/
-xkb_group_index_t
+_X_EXPORT xkb_group_index_t
xkb_key_num_groups(struct xkb_keymap *xkb, xkb_keycode_t key)
{
return XkbKeyNumGroups(xkb, key);
@@ -200,7 +200,7 @@ xkb_key_num_groups(struct xkb_keymap *xkb, xkb_keycode_t key)
/**
* Return the total number of active LEDs in the keymap.
*/
-xkb_led_index_t
+_X_EXPORT xkb_led_index_t
xkb_map_num_leds(struct xkb_keymap *xkb)
{
xkb_led_index_t ret = 0;
@@ -218,7 +218,7 @@ xkb_map_num_leds(struct xkb_keymap *xkb)
/**
* Returns the name for a given group.
*/
-const char *
+_X_EXPORT const char *
xkb_map_led_get_name(struct xkb_keymap *xkb, xkb_led_index_t idx)
{
if (idx >= xkb_map_num_leds(xkb))
@@ -230,7 +230,7 @@ xkb_map_led_get_name(struct xkb_keymap *xkb, xkb_led_index_t idx)
/**
* Returns the index for a named group.
*/
-xkb_group_index_t
+_X_EXPORT xkb_group_index_t
xkb_map_led_get_index(struct xkb_keymap *xkb, const char *name)
{
xkb_led_index_t num_leds = xkb_map_num_leds(xkb);
@@ -247,7 +247,7 @@ xkb_map_led_get_index(struct xkb_keymap *xkb, const char *name)
/**
* Returns the level to use for the given key and state, or -1 if invalid.
*/
-unsigned int
+_X_EXPORT unsigned int
xkb_key_get_level(struct xkb_state *state, xkb_keycode_t key,
unsigned int group)
{
@@ -269,7 +269,7 @@ xkb_key_get_level(struct xkb_state *state, xkb_keycode_t key,
* Returns the group to use for the given key and state, taking
* wrapping/clamping/etc into account.
*/
-unsigned int
+_X_EXPORT unsigned int
xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key)
{
unsigned int info = XkbKeyGroupInfo(state->xkb, key);
@@ -300,7 +300,7 @@ xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key)
/**
* As below, but takes an explicit group/level rather than state.
*/
-unsigned int
+_X_EXPORT unsigned int
xkb_key_get_syms_by_level(struct xkb_keymap *xkb, xkb_keycode_t key, unsigned int group,
unsigned int level, const xkb_keysym_t **syms_out)
{
@@ -327,7 +327,7 @@ err:
* Provides the symbols to use for the given key and state. Returns the
* number of symbols pointed to in syms_out.
*/
-unsigned int
+_X_EXPORT unsigned int
xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
const xkb_keysym_t **syms_out)
{
diff --git a/src/state.c b/src/state.c
index a9f748e..2feaeb5 100644
--- a/src/state.c
+++ b/src/state.c
@@ -66,6 +66,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "xkbcommon/xkbcommon.h"
#include "XKBcommonint.h"
+#include "xkbmisc.h"
struct xkb_filter {
struct xkb_state *state;
@@ -459,7 +460,7 @@ xkb_filter_apply_all(struct xkb_state *state, xkb_keycode_t key,
return;
}
-struct xkb_state *
+_X_EXPORT struct xkb_state *
xkb_state_new(struct xkb_keymap *xkb)
{
struct xkb_state *ret;
@@ -477,14 +478,14 @@ xkb_state_new(struct xkb_keymap *xkb)
return ret;
}
-struct xkb_state *
+_X_EXPORT struct xkb_state *
xkb_state_ref(struct xkb_state *state)
{
state->refcnt++;
return state;
}
-void
+_X_EXPORT void
xkb_state_unref(struct xkb_state *state)
{
state->refcnt--;
@@ -566,7 +567,7 @@ xkb_state_update_derived(struct xkb_state *state)
* Given a particular key event, updates the state structure to reflect the
* new modifiers.
*/
-void
+_X_EXPORT void
xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
enum xkb_key_direction direction)
{
@@ -581,7 +582,7 @@ xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
* lossy, and should only be used to update a slave state mirroring the
* master, e.g. in a client/server window system.
*/
-void
+_X_EXPORT void
xkb_state_update_mask(struct xkb_state *state,
xkb_mod_mask_t base_mods,
xkb_mod_mask_t latched_mods,
@@ -616,7 +617,7 @@ xkb_state_update_mask(struct xkb_state *state,
* Serialises the requested modifier state into an xkb_mod_mask_t, with all
* the same disclaimers as in xkb_state_update_mask.
*/
-xkb_mod_mask_t
+_X_EXPORT xkb_mod_mask_t
xkb_state_serialise_mods(struct xkb_state *state,
enum xkb_state_component type)
{
@@ -639,7 +640,7 @@ xkb_state_serialise_mods(struct xkb_state *state,
* Serialises the requested group state, with all the same disclaimers as
* in xkb_state_update_mask.
*/
-xkb_group_index_t
+_X_EXPORT xkb_group_index_t
xkb_state_serialise_group(struct xkb_state *state,
enum xkb_state_component type)
{
@@ -662,7 +663,7 @@ xkb_state_serialise_group(struct xkb_state *state,
* Returns 1 if the given modifier is active with the specified type(s), 0 if
* not, or -1 if the modifier is invalid.
*/
-int
+_X_EXPORT int
xkb_state_mod_index_is_active(struct xkb_state *state,
xkb_mod_index_t idx,
enum xkb_state_component type)
@@ -686,7 +687,7 @@ xkb_state_mod_index_is_active(struct xkb_state *state,
* Returns 1 if the given modifier is active with the specified type(s), 0 if
* not, or -1 if the modifier is invalid.
*/
-int
+_X_EXPORT int
xkb_state_mod_name_is_active(struct xkb_state *state, const char *name,
enum xkb_state_component type)
{
@@ -702,7 +703,7 @@ xkb_state_mod_name_is_active(struct xkb_state *state, const char *name,
* Returns 1 if the given group is active with the specified type(s), 0 if
* not, or -1 if the group is invalid.
*/
-int
+_X_EXPORT int
xkb_state_group_index_is_active(struct xkb_state *state,
xkb_group_index_t idx,
enum xkb_state_component type)
@@ -726,7 +727,7 @@ xkb_state_group_index_is_active(struct xkb_state *state,
* Returns 1 if the given modifier is active with the specified type(s), 0 if
* not, or -1 if the modifier is invalid.
*/
-int
+_X_EXPORT int
xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
enum xkb_state_component type)
{
@@ -741,7 +742,7 @@ xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
/**
* Returns 1 if the given LED is active, 0 if not, or -1 if the LED is invalid.
*/
-int
+_X_EXPORT int
xkb_state_led_index_is_active(struct xkb_state *state, xkb_led_index_t idx)
{
if (idx >= xkb_map_num_leds(state->xkb))
@@ -753,7 +754,7 @@ xkb_state_led_index_is_active(struct xkb_state *state, xkb_led_index_t idx)
/**
* Returns 1 if the given LED is active, 0 if not, or -1 if the LED is invalid.
*/
-int
+_X_EXPORT int
xkb_state_led_name_is_active(struct xkb_state *state, const char *name)
{
xkb_led_index_t idx = xkb_map_led_get_index(state->xkb, name);
diff --git a/src/xkb.c b/src/xkb.c
index 1b9f94d..5336885 100644
--- a/src/xkb.c
+++ b/src/xkb.c
@@ -27,6 +27,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#include <stdio.h>
+
#include "xkbmisc.h"
#include "xkbcommon/xkbcommon.h"
#include "XKBcommonint.h"
@@ -81,7 +83,7 @@ XkbcCanonicaliseComponent(char *name, const char *old)
return name;
}
-void
+_X_EXPORT void
xkb_canonicalise_components(struct xkb_component_names * names,
const struct xkb_component_names * old)
{
diff --git a/src/xkbcomp/xkbcomp.c b/src/xkbcomp/xkbcomp.c
index 7ff22e1..ef7d6a9 100644
--- a/src/xkbcomp/xkbcomp.c
+++ b/src/xkbcomp/xkbcomp.c
@@ -114,7 +114,7 @@ unwind_file:
return names;
}
-struct xkb_keymap *
+_X_EXPORT struct xkb_keymap *
xkb_map_new_from_names(struct xkb_context *context,
const struct xkb_rule_names *rmlvo)
{
@@ -216,7 +216,7 @@ err:
return xkb;
}
-struct xkb_keymap *
+_X_EXPORT struct xkb_keymap *
xkb_map_new_from_kccgst(struct xkb_context *context,
const struct xkb_component_names *kccgst)
{
@@ -255,7 +255,7 @@ xkb_map_new_from_kccgst(struct xkb_context *context,
return compile_keymap(context, file);
}
-struct xkb_keymap *
+_X_EXPORT struct xkb_keymap *
xkb_map_new_from_string(struct xkb_context *context,
const char *string,
enum xkb_keymap_format format)
@@ -280,7 +280,7 @@ xkb_map_new_from_string(struct xkb_context *context,
return compile_keymap(context, file);
}
-struct xkb_keymap *
+_X_EXPORT struct xkb_keymap *
xkb_map_new_from_fd(struct xkb_context *context,
int fd,
enum xkb_keymap_format format)
@@ -312,14 +312,14 @@ xkb_map_new_from_fd(struct xkb_context *context,
return compile_keymap(context, file);
}
-struct xkb_keymap *
+_X_EXPORT struct xkb_keymap *
xkb_map_ref(struct xkb_keymap *xkb)
{
xkb->refcnt++;
return xkb;
}
-void
+_X_EXPORT void
xkb_map_unref(struct xkb_keymap *xkb)
{
if (--xkb->refcnt > 0)
diff --git a/src/xkbmisc.h b/src/xkbmisc.h
index 5d2d1c6..85f776b 100644
--- a/src/xkbmisc.h
+++ b/src/xkbmisc.h
@@ -28,6 +28,8 @@ authorization from the authors.
#define _XKBMISC_H_
#include <X11/Xdefs.h>
+#include <X11/Xfuncproto.h>
+
#include "xkbcommon/xkbcommon.h"
#include "XKBcommonint.h"