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.]
master
Ran Benita 2012-04-05 10:47:43 +03:00 committed by Daniel Stone
parent 073a21076c
commit 18e6a6a43e
9 changed files with 104 additions and 96 deletions

View File

@ -80,10 +80,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef _XKBCOMMON_H_ #ifndef _XKBCOMMON_H_
#define _XKBCOMMON_H_ #define _XKBCOMMON_H_
#include <stddef.h>
#include <stdint.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_keycode_t;
typedef uint32_t xkb_keysym_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->min_key_code) && \
xkb_keycode_is_legal_ext(xkb->max_key_code)) xkb_keycode_is_legal_ext(xkb->max_key_code))
/** /**
* Names to compile a keymap with, also known as RMLVO. These names together * Names to compile a keymap with, also known as RMLVO. These names together
* should be the primary identifier for a keymap. * should be the primary identifier for a keymap.
@ -152,7 +149,9 @@ struct xkb_keymap;
*/ */
struct xkb_state; struct xkb_state;
_XFUNCPROTOBEGIN #ifdef __cplusplus
extern "C" {
#endif
/* /*
* Canonicalises component names by prepending the relevant component from * 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 * If a component in names needs to be modified, the existing value will be
* free()d, and a new one allocated with malloc(). * free()d, and a new one allocated with malloc().
*/ */
_X_EXPORT extern void void
xkb_canonicalise_components(struct xkb_component_names *names, xkb_canonicalise_components(struct xkb_component_names *names,
const struct xkb_component_names *old); 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 * Converts a keysym to a string; will return unknown Unicode codepoints
* as "Ua1b2", and other unknown keysyms as "0xabcd1234". * 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); 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 * See xkb_keysym_to_string comments: this function will accept any string
* from that function. * from that function.
*/ */
_X_EXPORT extern xkb_keysym_t xkb_keysym_t
xkb_string_to_keysym(const char *s); 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 * holds a reference on the context, and must free it when finished with
* xkb_context_unref(). * xkb_context_unref().
*/ */
_X_EXPORT struct xkb_context * struct xkb_context *
xkb_context_new(void); 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 * Returns 1 on success, or 0 if the include path could not be added or is
* inaccessible. * inaccessible.
*/ */
_X_EXPORT int int
xkb_context_include_path_append(struct xkb_context *context, const char *path); 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 * Returns 1 on success, or 0 if the primary include path could not be
* added. * added.
*/ */
_X_EXPORT int int
xkb_context_include_path_append_default(struct xkb_context *context); 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 * default paths. Returns 1 on success, or 0 if the primary include path
* could not be added. * could not be added.
*/ */
_X_EXPORT int int
xkb_context_include_path_reset_defaults(struct xkb_context *context); xkb_context_include_path_reset_defaults(struct xkb_context *context);
/** /**
* Removes all entries from the context's include path. * Removes all entries from the context's include path.
*/ */
_X_EXPORT void void
xkb_context_include_path_clear(struct xkb_context *context); xkb_context_include_path_clear(struct xkb_context *context);
/** /**
* Returns the number of include paths currently active in the 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); xkb_context_num_include_paths(struct xkb_context *context);
/** /**
* Returns the include path at the specified index within the 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); xkb_context_include_path_get(struct xkb_context *context, unsigned int index);
/** /**
* Takes a new reference on an XKB context. * Takes a new reference on an XKB context.
*/ */
_X_EXPORT struct xkb_context * struct xkb_context *
xkb_context_ref(struct xkb_context *context); xkb_context_ref(struct xkb_context *context);
/** /**
* Releases a reference on an XKB context, and possibly frees it. * Releases a reference on an XKB context, and possibly frees it.
*/ */
_X_EXPORT void void
xkb_context_unref(struct xkb_context *context); 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 * You should almost certainly be using this and nothing else to create
* keymaps. * keymaps.
*/ */
_X_EXPORT extern struct xkb_keymap * struct xkb_keymap *
xkb_map_new_from_names(struct xkb_context *context, xkb_map_new_from_names(struct xkb_context *context,
const struct xkb_rule_names *names); 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. * 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, xkb_map_new_from_kccgst(struct xkb_context *context,
const struct xkb_component_names *kccgst); 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 * Creates an XKB keymap from a full text XKB keymap passed into the
* file descriptor. * file descriptor.
*/ */
_X_EXPORT extern struct xkb_keymap * struct xkb_keymap *
xkb_map_new_from_fd(struct xkb_context *context, xkb_map_new_from_fd(struct xkb_context *context,
int fd, enum xkb_keymap_format format); 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 * Creates an XKB keymap from a full text XKB keymap serialised into one
* enormous string. * enormous string.
*/ */
_X_EXPORT extern struct xkb_keymap * struct xkb_keymap *
xkb_map_new_from_string(struct xkb_context *context, xkb_map_new_from_string(struct xkb_context *context,
const char *string, const char *string,
enum xkb_keymap_format format); 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. * Takes a new reference on a keymap.
*/ */
_X_EXPORT extern struct xkb_keymap * struct xkb_keymap *
xkb_map_ref(struct xkb_keymap *xkb); xkb_map_ref(struct xkb_keymap *xkb);
/** /**
* Releases a reference on a keymap. * Releases a reference on a keymap.
*/ */
_X_EXPORT extern void void
xkb_map_unref(struct xkb_keymap *xkb); 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. * 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); xkb_map_num_mods(struct xkb_keymap *xkb);
/** /**
* Returns the name of the modifier specified by 'idx', or NULL if invalid. * 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); 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. * 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); xkb_map_mod_get_index(struct xkb_keymap *xkb, const char *name);
/** /**
* Returns the number of groups active in the keymap. * 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); xkb_map_num_groups(struct xkb_keymap *xkb);
/** /**
* Returns the name of the group specified by 'idx', or NULL if invalid. * 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); 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. * 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); xkb_map_group_get_index(struct xkb_keymap *xkb, const char *name);
/** /**
* Returns the number of groups active for the specified key. * 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); xkb_key_num_groups(struct xkb_keymap *xkb, xkb_keycode_t key);
/** /**
* Returns the number of LEDs in the given map. * 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); xkb_map_num_leds(struct xkb_keymap *xkb);
/** /**
* Returns the name of the LED specified by 'idx', or NULL if invalid. * 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); 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. * 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); 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 * Returns a new XKB state object for use with the given keymap, or NULL on
* failure. * failure.
*/ */
_X_EXPORT struct xkb_state * struct xkb_state *
xkb_state_new(struct xkb_keymap *xkb); xkb_state_new(struct xkb_keymap *xkb);
/** /**
* Takes a new reference on a state object. * Takes a new reference on a state object.
*/ */
_X_EXPORT struct xkb_state * struct xkb_state *
xkb_state_ref(struct xkb_state *state); xkb_state_ref(struct xkb_state *state);
/** /**
* Unrefs and potentially deallocates a state object; the caller must not * Unrefs and potentially deallocates a state object; the caller must not
* use the state object after calling this. * use the state object after calling this.
*/ */
_X_EXPORT void void
xkb_state_unref(struct xkb_state *state); xkb_state_unref(struct xkb_state *state);
enum xkb_key_direction { 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. * 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, xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
enum xkb_key_direction direction); 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. * 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, xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
const xkb_keysym_t **syms_out); 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. * Please do not use this unless you fit the description above.
*/ */
_X_EXPORT void void
xkb_state_update_mask(struct xkb_state *state, xkb_state_update_mask(struct xkb_state *state,
xkb_mod_mask_t base_mods, xkb_mod_mask_t base_mods,
xkb_mod_mask_t latched_mods, xkb_mod_mask_t latched_mods,
@ -503,7 +502,7 @@ xkb_state_update_mask(struct xkb_state *state,
* *
* Can return NULL on failure. * Can return NULL on failure.
*/ */
_X_EXPORT xkb_mod_mask_t xkb_mod_mask_t
xkb_state_serialise_mods(struct xkb_state *state, xkb_state_serialise_mods(struct xkb_state *state,
enum xkb_state_component component); 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 * The group equivalent of xkb_state_serialise_mods: please see its
* documentation. * documentation.
*/ */
_X_EXPORT xkb_group_index_t xkb_group_index_t
xkb_state_serialise_group(struct xkb_state *state, xkb_state_serialise_group(struct xkb_state *state,
enum xkb_state_component component); 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 * specified by 'type', 0 if it is unset, or -1 if the modifier does not
* exist in the current map. * exist in the current map.
*/ */
_X_EXPORT int int
xkb_state_mod_name_is_active(struct xkb_state *state, const char *name, xkb_state_mod_name_is_active(struct xkb_state *state, const char *name,
enum xkb_state_component type); 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 * specified by 'type', 0 if it is unset, or -1 if the modifier does not
* exist in the current map. * exist in the current map.
*/ */
_X_EXPORT int int
xkb_state_mod_index_is_active(struct xkb_state *state, xkb_mod_index_t idx, xkb_state_mod_index_is_active(struct xkb_state *state, xkb_mod_index_t idx,
enum xkb_state_component type); 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 * specified by 'type', 0 if it is unset, or -1 if the group does not
* exist in the current map. * exist in the current map.
*/ */
_X_EXPORT int int
xkb_state_group_name_is_active(struct xkb_state *state, const char *name, xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
enum xkb_state_component type); 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 * specified by 'type', 0 if it is unset, or -1 if the group does not
* exist in the current map. * exist in the current map.
*/ */
_X_EXPORT int int
xkb_state_group_index_is_active(struct xkb_state *state, xkb_group_index_t idx, xkb_state_group_index_is_active(struct xkb_state *state, xkb_group_index_t idx,
enum xkb_state_component type); 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 * 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. * -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); 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 * 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. * -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); xkb_state_led_index_is_active(struct xkb_state *state, xkb_led_index_t idx);
/** @} */ /** @} */
_XFUNCPROTOEND #ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _XKBCOMMON_H_ */ #endif /* _XKBCOMMON_H_ */

View File

@ -81,6 +81,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <X11/extensions/XKB.h>
#include "xkbcommon/xkbcommon.h" #include "xkbcommon/xkbcommon.h"

View File

@ -46,7 +46,7 @@ struct xkb_context {
/** /**
* Append one directory to the context's include path. * 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) xkb_context_include_path_append(struct xkb_context *context, const char *path)
{ {
struct stat stat_buf; 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. * Append the default include directories to the context.
*/ */
int _X_EXPORT int
xkb_context_include_path_append_default(struct xkb_context *context) xkb_context_include_path_append_default(struct xkb_context *context)
{ {
const char *home = getenv("HOME"); 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. * Remove all entries in the context's include path.
*/ */
void _X_EXPORT void
xkb_context_include_path_clear(struct xkb_context *context) xkb_context_include_path_clear(struct xkb_context *context)
{ {
int i; 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() * 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_reset_defaults(struct xkb_context *context)
{ {
xkb_context_include_path_clear(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. * 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) xkb_context_num_include_paths(struct xkb_context *context)
{ {
return context->num_include_paths; 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 * Returns the given entry in the context's include path, or NULL if an
* invalid index is passed. * invalid index is passed.
*/ */
const char * _X_EXPORT const char *
xkb_context_include_path_get(struct xkb_context *context, unsigned int idx) xkb_context_include_path_get(struct xkb_context *context, unsigned int idx)
{ {
if (idx >= xkb_context_num_include_paths(context)) 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. * Take a new reference on the context.
*/ */
struct xkb_context * _X_EXPORT struct xkb_context *
xkb_context_ref(struct xkb_context *context) xkb_context_ref(struct xkb_context *context)
{ {
context->refcnt++; 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 * Drop an existing reference on the context, and free it if the refcnt is
* now 0. * now 0.
*/ */
void _X_EXPORT void
xkb_context_unref(struct xkb_context *context) xkb_context_unref(struct xkb_context *context)
{ {
if (--context->refcnt > 0) if (--context->refcnt > 0)
@ -182,7 +182,7 @@ xkb_context_unref(struct xkb_context *context)
/** /**
* Create a new context. * Create a new context.
*/ */
struct xkb_context * _X_EXPORT struct xkb_context *
xkb_context_new(void) xkb_context_new(void)
{ {
struct xkb_context *context = calloc(1, sizeof(*context)); struct xkb_context *context = calloc(1, sizeof(*context));

View File

@ -28,15 +28,16 @@ authorization from the authors.
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
#include <X11/keysymdef.h>
#include "xkbmisc.h"
#include "xkbcommon/xkbcommon.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <string.h> #include <string.h>
#include <X11/keysymdef.h>
#include "ks_tables.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) xkb_keysym_to_string(xkb_keysym_t ks, char *buffer, size_t size)
{ {
int i, n, h, idx; 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); snprintf(buffer, size, "0x%08x", ks);
} }
xkb_keysym_t _X_EXPORT xkb_keysym_t
xkb_string_to_keysym(const char *s) xkb_string_to_keysym(const char *s)
{ {
int i, n, h, c, idx; int i, n, h, c, idx;

View File

@ -61,7 +61,7 @@
/** /**
* Returns the total number of modifiers active in the keymap. * 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_map_num_mods(struct xkb_keymap *xkb)
{ {
xkb_mod_index_t i; xkb_mod_index_t i;
@ -78,7 +78,7 @@ xkb_map_num_mods(struct xkb_keymap *xkb)
/** /**
* Return the name for a given modifier. * 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) xkb_map_mod_get_name(struct xkb_keymap *xkb, xkb_mod_index_t idx)
{ {
if (idx >= xkb_map_num_mods(xkb)) 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. * 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_map_mod_get_index(struct xkb_keymap *xkb, const char *name)
{ {
xkb_mod_index_t i; 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. * 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_map_num_groups(struct xkb_keymap *xkb)
{ {
xkb_group_index_t ret = 0; 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. * 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) xkb_map_group_get_name(struct xkb_keymap *xkb, xkb_group_index_t idx)
{ {
if (idx >= xkb_map_num_groups(xkb)) 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. * 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_map_group_get_index(struct xkb_keymap *xkb, const char *name)
{ {
xkb_group_index_t num_groups = xkb_map_num_groups(xkb); 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. * 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) xkb_key_num_groups(struct xkb_keymap *xkb, xkb_keycode_t key)
{ {
return XkbKeyNumGroups(xkb, 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. * 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_map_num_leds(struct xkb_keymap *xkb)
{ {
xkb_led_index_t ret = 0; 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. * 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) xkb_map_led_get_name(struct xkb_keymap *xkb, xkb_led_index_t idx)
{ {
if (idx >= xkb_map_num_leds(xkb)) 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. * 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_map_led_get_index(struct xkb_keymap *xkb, const char *name)
{ {
xkb_led_index_t num_leds = xkb_map_num_leds(xkb); 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. * 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, xkb_key_get_level(struct xkb_state *state, xkb_keycode_t key,
unsigned int group) 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 * Returns the group to use for the given key and state, taking
* wrapping/clamping/etc into account. * wrapping/clamping/etc into account.
*/ */
unsigned int _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 key)
{ {
unsigned int info = XkbKeyGroupInfo(state->xkb, 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. * 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, 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) 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 * Provides the symbols to use for the given key and state. Returns the
* number of symbols pointed to in syms_out. * 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, xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
const xkb_keysym_t **syms_out) const xkb_keysym_t **syms_out)
{ {

View File

@ -66,6 +66,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "xkbcommon/xkbcommon.h" #include "xkbcommon/xkbcommon.h"
#include "XKBcommonint.h" #include "XKBcommonint.h"
#include "xkbmisc.h"
struct xkb_filter { struct xkb_filter {
struct xkb_state *state; struct xkb_state *state;
@ -459,7 +460,7 @@ xkb_filter_apply_all(struct xkb_state *state, xkb_keycode_t key,
return; return;
} }
struct xkb_state * _X_EXPORT struct xkb_state *
xkb_state_new(struct xkb_keymap *xkb) xkb_state_new(struct xkb_keymap *xkb)
{ {
struct xkb_state *ret; struct xkb_state *ret;
@ -477,14 +478,14 @@ xkb_state_new(struct xkb_keymap *xkb)
return ret; return ret;
} }
struct xkb_state * _X_EXPORT struct xkb_state *
xkb_state_ref(struct xkb_state *state) xkb_state_ref(struct xkb_state *state)
{ {
state->refcnt++; state->refcnt++;
return state; return state;
} }
void _X_EXPORT void
xkb_state_unref(struct xkb_state *state) xkb_state_unref(struct xkb_state *state)
{ {
state->refcnt--; 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 * Given a particular key event, updates the state structure to reflect the
* new modifiers. * new modifiers.
*/ */
void _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 key,
enum xkb_key_direction direction) 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 * lossy, and should only be used to update a slave state mirroring the
* master, e.g. in a client/server window system. * master, e.g. in a client/server window system.
*/ */
void _X_EXPORT void
xkb_state_update_mask(struct xkb_state *state, xkb_state_update_mask(struct xkb_state *state,
xkb_mod_mask_t base_mods, xkb_mod_mask_t base_mods,
xkb_mod_mask_t latched_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 * Serialises the requested modifier state into an xkb_mod_mask_t, with all
* the same disclaimers as in xkb_state_update_mask. * 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, xkb_state_serialise_mods(struct xkb_state *state,
enum xkb_state_component type) 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 * Serialises the requested group state, with all the same disclaimers as
* in xkb_state_update_mask. * in xkb_state_update_mask.
*/ */
xkb_group_index_t _X_EXPORT xkb_group_index_t
xkb_state_serialise_group(struct xkb_state *state, xkb_state_serialise_group(struct xkb_state *state,
enum xkb_state_component type) 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 * Returns 1 if the given modifier is active with the specified type(s), 0 if
* not, or -1 if the modifier is invalid. * not, or -1 if the modifier is invalid.
*/ */
int _X_EXPORT int
xkb_state_mod_index_is_active(struct xkb_state *state, xkb_state_mod_index_is_active(struct xkb_state *state,
xkb_mod_index_t idx, xkb_mod_index_t idx,
enum xkb_state_component type) 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 * Returns 1 if the given modifier is active with the specified type(s), 0 if
* not, or -1 if the modifier is invalid. * 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, xkb_state_mod_name_is_active(struct xkb_state *state, const char *name,
enum xkb_state_component type) 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 * Returns 1 if the given group is active with the specified type(s), 0 if
* not, or -1 if the group is invalid. * not, or -1 if the group is invalid.
*/ */
int _X_EXPORT int
xkb_state_group_index_is_active(struct xkb_state *state, xkb_state_group_index_is_active(struct xkb_state *state,
xkb_group_index_t idx, xkb_group_index_t idx,
enum xkb_state_component type) 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 * Returns 1 if the given modifier is active with the specified type(s), 0 if
* not, or -1 if the modifier is invalid. * 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, xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
enum xkb_state_component type) 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. * 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) xkb_state_led_index_is_active(struct xkb_state *state, xkb_led_index_t idx)
{ {
if (idx >= xkb_map_num_leds(state->xkb)) 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. * 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_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); xkb_led_index_t idx = xkb_map_led_get_index(state->xkb, name);

View File

@ -27,6 +27,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
#include <stdio.h>
#include "xkbmisc.h" #include "xkbmisc.h"
#include "xkbcommon/xkbcommon.h" #include "xkbcommon/xkbcommon.h"
#include "XKBcommonint.h" #include "XKBcommonint.h"
@ -81,7 +83,7 @@ XkbcCanonicaliseComponent(char *name, const char *old)
return name; return name;
} }
void _X_EXPORT void
xkb_canonicalise_components(struct xkb_component_names * names, xkb_canonicalise_components(struct xkb_component_names * names,
const struct xkb_component_names * old) const struct xkb_component_names * old)
{ {

View File

@ -114,7 +114,7 @@ unwind_file:
return names; return names;
} }
struct xkb_keymap * _X_EXPORT struct xkb_keymap *
xkb_map_new_from_names(struct xkb_context *context, xkb_map_new_from_names(struct xkb_context *context,
const struct xkb_rule_names *rmlvo) const struct xkb_rule_names *rmlvo)
{ {
@ -216,7 +216,7 @@ err:
return xkb; return xkb;
} }
struct xkb_keymap * _X_EXPORT struct xkb_keymap *
xkb_map_new_from_kccgst(struct xkb_context *context, xkb_map_new_from_kccgst(struct xkb_context *context,
const struct xkb_component_names *kccgst) const struct xkb_component_names *kccgst)
{ {
@ -255,7 +255,7 @@ xkb_map_new_from_kccgst(struct xkb_context *context,
return compile_keymap(context, file); return compile_keymap(context, file);
} }
struct xkb_keymap * _X_EXPORT struct xkb_keymap *
xkb_map_new_from_string(struct xkb_context *context, xkb_map_new_from_string(struct xkb_context *context,
const char *string, const char *string,
enum xkb_keymap_format format) enum xkb_keymap_format format)
@ -280,7 +280,7 @@ xkb_map_new_from_string(struct xkb_context *context,
return compile_keymap(context, file); return compile_keymap(context, file);
} }
struct xkb_keymap * _X_EXPORT struct xkb_keymap *
xkb_map_new_from_fd(struct xkb_context *context, xkb_map_new_from_fd(struct xkb_context *context,
int fd, int fd,
enum xkb_keymap_format format) enum xkb_keymap_format format)
@ -312,14 +312,14 @@ xkb_map_new_from_fd(struct xkb_context *context,
return compile_keymap(context, file); return compile_keymap(context, file);
} }
struct xkb_keymap * _X_EXPORT struct xkb_keymap *
xkb_map_ref(struct xkb_keymap *xkb) xkb_map_ref(struct xkb_keymap *xkb)
{ {
xkb->refcnt++; xkb->refcnt++;
return xkb; return xkb;
} }
void _X_EXPORT void
xkb_map_unref(struct xkb_keymap *xkb) xkb_map_unref(struct xkb_keymap *xkb)
{ {
if (--xkb->refcnt > 0) if (--xkb->refcnt > 0)

View File

@ -28,6 +28,8 @@ authorization from the authors.
#define _XKBMISC_H_ #define _XKBMISC_H_
#include <X11/Xdefs.h> #include <X11/Xdefs.h>
#include <X11/Xfuncproto.h>
#include "xkbcommon/xkbcommon.h" #include "xkbcommon/xkbcommon.h"
#include "XKBcommonint.h" #include "XKBcommonint.h"