From 18e6a6a43e4e4711eedc149875c064f3582948a7 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Thu, 5 Apr 2012 10:47:43 +0300 Subject: [PATCH] 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 [daniels: Updated for xkb_keymap changes.] --- include/xkbcommon/xkbcommon.h | 97 ++++++++++++++++++----------------- src/XKBcommonint.h | 1 + src/context.c | 18 +++---- src/keysym.c | 11 ++-- src/map.c | 28 +++++----- src/state.c | 27 +++++----- src/xkb.c | 4 +- src/xkbcomp/xkbcomp.c | 12 ++--- src/xkbmisc.h | 2 + 9 files changed, 104 insertions(+), 96 deletions(-) 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 #include -#include -#include -#include 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 #include +#include #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 #endif -#include -#include "xkbmisc.h" -#include "xkbcommon/xkbcommon.h" #include +#include #include +#include #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 #endif +#include + #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 +#include + #include "xkbcommon/xkbcommon.h" #include "XKBcommonint.h"