diff --git a/include/xkbcommon/xkbcommon-compose.h b/include/xkbcommon/xkbcommon-compose.h index 6d6d23ff8..c682a4aaa 100644 --- a/include/xkbcommon/xkbcommon-compose.h +++ b/include/xkbcommon/xkbcommon-compose.h @@ -214,7 +214,7 @@ enum xkb_compose_format { * * @memberof xkb_compose_table */ -struct xkb_compose_table * +XKB_EXPORT struct xkb_compose_table * xkb_compose_table_new_from_locale(struct xkb_context *context, const char *locale, enum xkb_compose_compile_flags flags); @@ -238,7 +238,7 @@ xkb_compose_table_new_from_locale(struct xkb_context *context, * * @memberof xkb_compose_table */ -struct xkb_compose_table * +XKB_EXPORT struct xkb_compose_table * xkb_compose_table_new_from_file(struct xkb_context *context, FILE *file, const char *locale, @@ -254,7 +254,7 @@ xkb_compose_table_new_from_file(struct xkb_context *context, * @see xkb_compose_table_new_from_file() * @memberof xkb_compose_table */ -struct xkb_compose_table * +XKB_EXPORT struct xkb_compose_table * xkb_compose_table_new_from_buffer(struct xkb_context *context, const char *buffer, size_t length, const char *locale, @@ -268,7 +268,7 @@ xkb_compose_table_new_from_buffer(struct xkb_context *context, * * @memberof xkb_compose_table */ -struct xkb_compose_table * +XKB_EXPORT struct xkb_compose_table * xkb_compose_table_ref(struct xkb_compose_table *table); /** @@ -278,7 +278,7 @@ xkb_compose_table_ref(struct xkb_compose_table *table); * * @memberof xkb_compose_table */ -void +XKB_EXPORT void xkb_compose_table_unref(struct xkb_compose_table *table); /** @@ -314,7 +314,7 @@ struct xkb_compose_table_entry; * @memberof xkb_compose_table_entry * @since 1.6.0 */ -const xkb_keysym_t * +XKB_EXPORT const xkb_keysym_t * xkb_compose_table_entry_sequence(struct xkb_compose_table_entry *entry, size_t *sequence_length); @@ -335,7 +335,7 @@ xkb_compose_table_entry_sequence(struct xkb_compose_table_entry *entry, * @memberof xkb_compose_table_entry * @since 1.6.0 */ -xkb_keysym_t +XKB_EXPORT xkb_keysym_t xkb_compose_table_entry_keysym(struct xkb_compose_table_entry *entry); /** @@ -357,7 +357,7 @@ xkb_compose_table_entry_keysym(struct xkb_compose_table_entry *entry); * @memberof xkb_compose_table_entry * @since 1.6.0 */ -const char * +XKB_EXPORT const char * xkb_compose_table_entry_utf8(struct xkb_compose_table_entry *entry); /** @@ -389,7 +389,7 @@ struct xkb_compose_table_iterator; * @sa xkb_compose_table_iterator_free() * @since 1.6.0 */ -struct xkb_compose_table_iterator * +XKB_EXPORT struct xkb_compose_table_iterator * xkb_compose_table_iterator_new(struct xkb_compose_table *table); /** @@ -398,7 +398,7 @@ xkb_compose_table_iterator_new(struct xkb_compose_table *table); * @memberof xkb_compose_table_iterator * @since 1.6.0 */ -void +XKB_EXPORT void xkb_compose_table_iterator_free(struct xkb_compose_table_iterator *iter); /** @@ -415,7 +415,7 @@ xkb_compose_table_iterator_free(struct xkb_compose_table_iterator *iter); * @memberof xkb_compose_table_iterator * @since 1.6.0 */ -struct xkb_compose_table_entry * +XKB_EXPORT struct xkb_compose_table_entry * xkb_compose_table_iterator_next(struct xkb_compose_table_iterator *iter); /** Flags for compose state creation. */ @@ -436,7 +436,7 @@ enum xkb_compose_state_flags { * * @memberof xkb_compose_state */ -struct xkb_compose_state * +XKB_EXPORT struct xkb_compose_state * xkb_compose_state_new(struct xkb_compose_table *table, enum xkb_compose_state_flags flags); @@ -447,7 +447,7 @@ xkb_compose_state_new(struct xkb_compose_table *table, * * @memberof xkb_compose_state */ -struct xkb_compose_state * +XKB_EXPORT struct xkb_compose_state * xkb_compose_state_ref(struct xkb_compose_state *state); /** @@ -457,7 +457,7 @@ xkb_compose_state_ref(struct xkb_compose_state *state); * * @memberof xkb_compose_state */ -void +XKB_EXPORT void xkb_compose_state_unref(struct xkb_compose_state *state); /** @@ -472,7 +472,7 @@ xkb_compose_state_unref(struct xkb_compose_state *state); * * @memberof xkb_compose_state */ -struct xkb_compose_table * +XKB_EXPORT struct xkb_compose_table * xkb_compose_state_get_compose_table(struct xkb_compose_state *state); /** Status of the Compose sequence state machine. */ @@ -540,7 +540,7 @@ enum xkb_compose_feed_result { * * @memberof xkb_compose_state */ -enum xkb_compose_feed_result +XKB_EXPORT enum xkb_compose_feed_result xkb_compose_state_feed(struct xkb_compose_state *state, xkb_keysym_t keysym); @@ -552,7 +552,7 @@ xkb_compose_state_feed(struct xkb_compose_state *state, * * @memberof xkb_compose_state */ -void +XKB_EXPORT void xkb_compose_state_reset(struct xkb_compose_state *state); /** @@ -561,7 +561,7 @@ xkb_compose_state_reset(struct xkb_compose_state *state); * @see xkb_compose_status * @memberof xkb_compose_state **/ -enum xkb_compose_status +XKB_EXPORT enum xkb_compose_status xkb_compose_state_get_status(struct xkb_compose_state *state); /** @@ -592,7 +592,7 @@ xkb_compose_state_get_status(struct xkb_compose_state *state); * * @memberof xkb_compose_state **/ -int +XKB_EXPORT int xkb_compose_state_get_utf8(struct xkb_compose_state *state, char *buffer, size_t size); @@ -607,7 +607,7 @@ xkb_compose_state_get_utf8(struct xkb_compose_state *state, * * @memberof xkb_compose_state **/ -xkb_keysym_t +XKB_EXPORT xkb_keysym_t xkb_compose_state_get_one_sym(struct xkb_compose_state *state); /** @} */ diff --git a/include/xkbcommon/xkbcommon-x11.h b/include/xkbcommon/xkbcommon-x11.h index 0e37ea3b5..91f554803 100644 --- a/include/xkbcommon/xkbcommon-x11.h +++ b/include/xkbcommon/xkbcommon-x11.h @@ -145,7 +145,7 @@ enum xkb_x11_setup_xkb_extension_flags { * * @returns 1 on success, or 0 on failure. */ -int +XKB_EXPORT int xkb_x11_setup_xkb_extension(xcb_connection_t *connection, uint16_t major_xkb_version, uint16_t minor_xkb_version, @@ -163,7 +163,7 @@ xkb_x11_setup_xkb_extension(xcb_connection_t *connection, * @returns A device ID which may be used with other xkb_x11_* functions, * or -1 on failure. */ -int32_t +XKB_EXPORT int32_t xkb_x11_get_core_keyboard_device_id(xcb_connection_t *connection); /** @@ -188,7 +188,7 @@ xkb_x11_get_core_keyboard_device_id(xcb_connection_t *connection); * * @memberof xkb_keymap */ -struct xkb_keymap * +XKB_EXPORT struct xkb_keymap * xkb_x11_keymap_new_from_device(struct xkb_context *context, xcb_connection_t *connection, int32_t device_id, @@ -212,7 +212,7 @@ xkb_x11_keymap_new_from_device(struct xkb_context *context, * * @memberof xkb_state */ -struct xkb_state * +XKB_EXPORT struct xkb_state * xkb_x11_state_new_from_device(struct xkb_keymap *keymap, xcb_connection_t *connection, int32_t device_id); diff --git a/include/xkbcommon/xkbcommon.h b/include/xkbcommon/xkbcommon.h index cabf52aaa..59732e13d 100644 --- a/include/xkbcommon/xkbcommon.h +++ b/include/xkbcommon/xkbcommon.h @@ -31,6 +31,14 @@ extern "C" { #endif +#if defined(__GNUC__) && !defined(__CYGWIN__) +# define XKB_EXPORT __attribute__((visibility("default"))) +#elif defined(_WIN32) +# define XKB_EXPORT __declspec(dllexport) +#else +# define XKB_EXPORT +#endif + /** * @file * Main libxkbcommon API. @@ -391,7 +399,7 @@ struct xkb_rule_names { * * @sa xkb_keysym_t */ -int +XKB_EXPORT int xkb_keysym_get_name(xkb_keysym_t keysym, char *buffer, size_t size); /** Flags for xkb_keysym_from_name(). */ @@ -425,7 +433,7 @@ enum xkb_keysym_flags { * * @sa xkb_keysym_t */ -xkb_keysym_t +XKB_EXPORT xkb_keysym_t xkb_keysym_from_name(const char *name, enum xkb_keysym_flags flags); /** @@ -444,7 +452,7 @@ xkb_keysym_from_name(const char *name, enum xkb_keysym_flags flags); * * @sa xkb_state_key_get_utf8() */ -int +XKB_EXPORT int xkb_keysym_to_utf8(xkb_keysym_t keysym, char *buffer, size_t size); /** @@ -459,7 +467,7 @@ xkb_keysym_to_utf8(xkb_keysym_t keysym, char *buffer, size_t size); * * @sa xkb_state_key_get_utf32() */ -uint32_t +XKB_EXPORT uint32_t xkb_keysym_to_utf32(xkb_keysym_t keysym); /** @@ -482,7 +490,7 @@ xkb_keysym_to_utf32(xkb_keysym_t keysym); * @sa xkb_keysym_to_utf32() * @since 1.0.0 */ -xkb_keysym_t +XKB_EXPORT xkb_keysym_t xkb_utf32_to_keysym(uint32_t ucs); /** @@ -507,7 +515,7 @@ xkb_utf32_to_keysym(uint32_t ucs); * @since 0.8.0: Initial implementation, based on `libX11`. * @since 1.8.0: Use Unicode 16.0 mappings for complete Unicode coverage. */ -xkb_keysym_t +XKB_EXPORT xkb_keysym_t xkb_keysym_to_upper(xkb_keysym_t ks); /** @@ -523,7 +531,7 @@ xkb_keysym_to_upper(xkb_keysym_t ks); * @since 0.8.0: Initial implementation, based on `libX11`. * @since 1.8.0: Use Unicode 16.0 mappings for complete Unicode coverage. */ -xkb_keysym_t +XKB_EXPORT xkb_keysym_t xkb_keysym_to_lower(xkb_keysym_t ks); /** @} */ @@ -580,7 +588,7 @@ enum xkb_context_flags { * * @memberof xkb_context */ -struct xkb_context * +XKB_EXPORT struct xkb_context * xkb_context_new(enum xkb_context_flags flags); /** @@ -590,7 +598,7 @@ xkb_context_new(enum xkb_context_flags flags); * * @memberof xkb_context */ -struct xkb_context * +XKB_EXPORT struct xkb_context * xkb_context_ref(struct xkb_context *context); /** @@ -600,7 +608,7 @@ xkb_context_ref(struct xkb_context *context); * * @memberof xkb_context */ -void +XKB_EXPORT void xkb_context_unref(struct xkb_context *context); /** @@ -611,7 +619,7 @@ xkb_context_unref(struct xkb_context *context); * * @memberof xkb_context */ -void +XKB_EXPORT void xkb_context_set_user_data(struct xkb_context *context, void *user_data); /** @@ -625,7 +633,7 @@ xkb_context_set_user_data(struct xkb_context *context, void *user_data); * * @memberof xkb_context **/ -void * +XKB_EXPORT void * xkb_context_get_user_data(struct xkb_context *context); /** @} */ @@ -659,7 +667,7 @@ xkb_context_get_user_data(struct xkb_context *context); * * @memberof xkb_context */ -int +XKB_EXPORT int xkb_context_include_path_append(struct xkb_context *context, const char *path); /** @@ -669,7 +677,7 @@ xkb_context_include_path_append(struct xkb_context *context, const char *path); * * @memberof xkb_context */ -int +XKB_EXPORT int xkb_context_include_path_append_default(struct xkb_context *context); /** @@ -682,7 +690,7 @@ xkb_context_include_path_append_default(struct xkb_context *context); * * @memberof xkb_context */ -int +XKB_EXPORT int xkb_context_include_path_reset_defaults(struct xkb_context *context); /** @@ -690,7 +698,7 @@ xkb_context_include_path_reset_defaults(struct xkb_context *context); * * @memberof xkb_context */ -void +XKB_EXPORT void xkb_context_include_path_clear(struct xkb_context *context); /** @@ -698,7 +706,7 @@ xkb_context_include_path_clear(struct xkb_context *context); * * @memberof xkb_context */ -unsigned int +XKB_EXPORT unsigned int xkb_context_num_include_paths(struct xkb_context *context); /** @@ -709,7 +717,7 @@ xkb_context_num_include_paths(struct xkb_context *context); * * @memberof xkb_context */ -const char * +XKB_EXPORT const char * xkb_context_include_path_get(struct xkb_context *context, unsigned int index); /** @} */ @@ -743,7 +751,7 @@ enum xkb_log_level { * * @memberof xkb_context */ -void +XKB_EXPORT void xkb_context_set_log_level(struct xkb_context *context, enum xkb_log_level level); @@ -752,7 +760,7 @@ xkb_context_set_log_level(struct xkb_context *context, * * @memberof xkb_context */ -enum xkb_log_level +XKB_EXPORT enum xkb_log_level xkb_context_get_log_level(struct xkb_context *context); /** @@ -774,7 +782,7 @@ xkb_context_get_log_level(struct xkb_context *context); * * @memberof xkb_context */ -void +XKB_EXPORT void xkb_context_set_log_verbosity(struct xkb_context *context, int verbosity); /** @@ -782,7 +790,7 @@ xkb_context_set_log_verbosity(struct xkb_context *context, int verbosity); * * @memberof xkb_context */ -int +XKB_EXPORT int xkb_context_get_log_verbosity(struct xkb_context *context); /** @@ -805,7 +813,7 @@ xkb_context_get_log_verbosity(struct xkb_context *context); * * @memberof xkb_context */ -void +XKB_EXPORT void xkb_context_set_log_fn(struct xkb_context *context, void (*log_fn)(struct xkb_context *context, enum xkb_log_level level, @@ -842,7 +850,7 @@ enum xkb_keymap_compile_flags { * @sa xkb_rule_names * @memberof xkb_keymap */ -struct xkb_keymap * +XKB_EXPORT struct xkb_keymap * xkb_keymap_new_from_names(struct xkb_context *context, const struct xkb_rule_names *names, enum xkb_keymap_compile_flags flags); @@ -871,7 +879,7 @@ enum xkb_keymap_format { * * @memberof xkb_keymap */ -struct xkb_keymap * +XKB_EXPORT struct xkb_keymap * xkb_keymap_new_from_file(struct xkb_context *context, FILE *file, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags); @@ -885,7 +893,7 @@ xkb_keymap_new_from_file(struct xkb_context *context, FILE *file, * @see xkb_keymap_new_from_file() * @memberof xkb_keymap */ -struct xkb_keymap * +XKB_EXPORT struct xkb_keymap * xkb_keymap_new_from_string(struct xkb_context *context, const char *string, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags); @@ -900,7 +908,7 @@ xkb_keymap_new_from_string(struct xkb_context *context, const char *string, * @memberof xkb_keymap * @since 0.3.0 */ -struct xkb_keymap * +XKB_EXPORT struct xkb_keymap * xkb_keymap_new_from_buffer(struct xkb_context *context, const char *buffer, size_t length, enum xkb_keymap_format format, enum xkb_keymap_compile_flags flags); @@ -912,7 +920,7 @@ xkb_keymap_new_from_buffer(struct xkb_context *context, const char *buffer, * * @memberof xkb_keymap */ -struct xkb_keymap * +XKB_EXPORT struct xkb_keymap * xkb_keymap_ref(struct xkb_keymap *keymap); /** @@ -922,7 +930,7 @@ xkb_keymap_ref(struct xkb_keymap *keymap); * * @memberof xkb_keymap */ -void +XKB_EXPORT void xkb_keymap_unref(struct xkb_keymap *keymap); /** @@ -949,7 +957,7 @@ xkb_keymap_unref(struct xkb_keymap *keymap); * * @memberof xkb_keymap */ -char * +XKB_EXPORT char * xkb_keymap_get_as_string(struct xkb_keymap *keymap, enum xkb_keymap_format format); @@ -969,7 +977,7 @@ xkb_keymap_get_as_string(struct xkb_keymap *keymap, * @memberof xkb_keymap * @since 0.3.1 */ -xkb_keycode_t +XKB_EXPORT xkb_keycode_t xkb_keymap_min_keycode(struct xkb_keymap *keymap); /** @@ -979,7 +987,7 @@ xkb_keymap_min_keycode(struct xkb_keymap *keymap); * @memberof xkb_keymap * @since 0.3.1 */ -xkb_keycode_t +XKB_EXPORT xkb_keycode_t xkb_keymap_max_keycode(struct xkb_keymap *keymap); /** @@ -1002,7 +1010,7 @@ typedef void * @memberof xkb_keymap * @since 0.3.1 */ -void +XKB_EXPORT void xkb_keymap_key_for_each(struct xkb_keymap *keymap, xkb_keymap_key_iter_t iter, void *data); @@ -1019,7 +1027,7 @@ xkb_keymap_key_for_each(struct xkb_keymap *keymap, xkb_keymap_key_iter_t iter, * @memberof xkb_keymap * @since 0.6.0 */ -const char * +XKB_EXPORT const char * xkb_keymap_key_get_name(struct xkb_keymap *keymap, xkb_keycode_t key); /** @@ -1034,7 +1042,7 @@ xkb_keymap_key_get_name(struct xkb_keymap *keymap, xkb_keycode_t key); * @memberof xkb_keymap * @since 0.6.0 */ -xkb_keycode_t +XKB_EXPORT xkb_keycode_t xkb_keymap_key_by_name(struct xkb_keymap *keymap, const char *name); /** @@ -1043,7 +1051,7 @@ xkb_keymap_key_by_name(struct xkb_keymap *keymap, const char *name); * @sa xkb_mod_index_t * @memberof xkb_keymap */ -xkb_mod_index_t +XKB_EXPORT xkb_mod_index_t xkb_keymap_num_mods(struct xkb_keymap *keymap); /** @@ -1054,7 +1062,7 @@ xkb_keymap_num_mods(struct xkb_keymap *keymap); * @sa xkb_mod_index_t * @memberof xkb_keymap */ -const char * +XKB_EXPORT const char * xkb_keymap_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx); /** @@ -1066,7 +1074,7 @@ xkb_keymap_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx); * @sa xkb_mod_index_t * @memberof xkb_keymap */ -xkb_mod_index_t +XKB_EXPORT xkb_mod_index_t xkb_keymap_mod_get_index(struct xkb_keymap *keymap, const char *name); /** @@ -1075,7 +1083,7 @@ xkb_keymap_mod_get_index(struct xkb_keymap *keymap, const char *name); * @sa xkb_layout_index_t xkb_rule_names xkb_keymap_num_layouts_for_key() * @memberof xkb_keymap */ -xkb_layout_index_t +XKB_EXPORT xkb_layout_index_t xkb_keymap_num_layouts(struct xkb_keymap *keymap); /** @@ -1088,7 +1096,7 @@ xkb_keymap_num_layouts(struct xkb_keymap *keymap); * For notes on layout names. * @memberof xkb_keymap */ -const char * +XKB_EXPORT const char * xkb_keymap_layout_get_name(struct xkb_keymap *keymap, xkb_layout_index_t idx); /** @@ -1102,7 +1110,7 @@ xkb_keymap_layout_get_name(struct xkb_keymap *keymap, xkb_layout_index_t idx); * For notes on layout names. * @memberof xkb_keymap */ -xkb_layout_index_t +XKB_EXPORT xkb_layout_index_t xkb_keymap_layout_get_index(struct xkb_keymap *keymap, const char *name); /** @@ -1116,7 +1124,7 @@ xkb_keymap_layout_get_index(struct xkb_keymap *keymap, const char *name); * @sa xkb_led_index_t * @memberof xkb_keymap */ -xkb_led_index_t +XKB_EXPORT xkb_led_index_t xkb_keymap_num_leds(struct xkb_keymap *keymap); /** @@ -1126,7 +1134,7 @@ xkb_keymap_num_leds(struct xkb_keymap *keymap); * * @memberof xkb_keymap */ -const char * +XKB_EXPORT const char * xkb_keymap_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx); /** @@ -1137,7 +1145,7 @@ xkb_keymap_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx); * * @memberof xkb_keymap */ -xkb_led_index_t +XKB_EXPORT xkb_led_index_t xkb_keymap_led_get_index(struct xkb_keymap *keymap, const char *name); /** @@ -1150,7 +1158,7 @@ xkb_keymap_led_get_index(struct xkb_keymap *keymap, const char *name); * @sa xkb_layout_index_t * @memberof xkb_keymap */ -xkb_layout_index_t +XKB_EXPORT xkb_layout_index_t xkb_keymap_num_layouts_for_key(struct xkb_keymap *keymap, xkb_keycode_t key); /** @@ -1163,7 +1171,7 @@ xkb_keymap_num_layouts_for_key(struct xkb_keymap *keymap, xkb_keycode_t key); * @sa xkb_level_index_t * @memberof xkb_keymap */ -xkb_level_index_t +XKB_EXPORT xkb_level_index_t xkb_keymap_num_levels_for_key(struct xkb_keymap *keymap, xkb_keycode_t key, xkb_layout_index_t layout); @@ -1203,7 +1211,7 @@ xkb_keymap_num_levels_for_key(struct xkb_keymap *keymap, xkb_keycode_t key, * @memberof xkb_keymap * @since 1.0.0 */ -size_t +XKB_EXPORT size_t xkb_keymap_key_get_mods_for_level(struct xkb_keymap *keymap, xkb_keycode_t key, xkb_layout_index_t layout, @@ -1239,7 +1247,7 @@ xkb_keymap_key_get_mods_for_level(struct xkb_keymap *keymap, * @sa xkb_state_key_get_syms() * @memberof xkb_keymap */ -int +XKB_EXPORT int xkb_keymap_key_get_syms_by_level(struct xkb_keymap *keymap, xkb_keycode_t key, xkb_layout_index_t layout, @@ -1261,7 +1269,7 @@ xkb_keymap_key_get_syms_by_level(struct xkb_keymap *keymap, * * @memberof xkb_keymap */ -int +XKB_EXPORT int xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key); /** @} */ @@ -1282,7 +1290,7 @@ xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key); * * @memberof xkb_state */ -struct xkb_state * +XKB_EXPORT struct xkb_state * xkb_state_new(struct xkb_keymap *keymap); /** @@ -1292,7 +1300,7 @@ xkb_state_new(struct xkb_keymap *keymap); * * @memberof xkb_state */ -struct xkb_state * +XKB_EXPORT struct xkb_state * xkb_state_ref(struct xkb_state *state); /** @@ -1302,7 +1310,7 @@ xkb_state_ref(struct xkb_state *state); * * @memberof xkb_state */ -void +XKB_EXPORT void xkb_state_unref(struct xkb_state *state); /** @@ -1317,7 +1325,7 @@ xkb_state_unref(struct xkb_state *state); * * @memberof xkb_state */ -struct xkb_keymap * +XKB_EXPORT struct xkb_keymap * xkb_state_get_keymap(struct xkb_state *state); /** @@ -1415,7 +1423,7 @@ enum xkb_state_component { * * @sa xkb_state_update_mask() */ -enum xkb_state_component +XKB_EXPORT enum xkb_state_component xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key, enum xkb_key_direction direction); @@ -1441,7 +1449,7 @@ xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key, * @sa xkb_state_component * @sa xkb_state_update_key */ -enum xkb_state_component +XKB_EXPORT enum xkb_state_component xkb_state_update_mask(struct xkb_state *state, xkb_mod_mask_t depressed_mods, xkb_mod_mask_t latched_mods, @@ -1476,7 +1484,7 @@ xkb_state_update_mask(struct xkb_state *state, * * @memberof xkb_state */ -int +XKB_EXPORT int xkb_state_key_get_syms(struct xkb_state *state, xkb_keycode_t key, const xkb_keysym_t **syms_out); @@ -1506,7 +1514,7 @@ xkb_state_key_get_syms(struct xkb_state *state, xkb_keycode_t key, * @memberof xkb_state * @since 0.4.1 */ -int +XKB_EXPORT int xkb_state_key_get_utf8(struct xkb_state *state, xkb_keycode_t key, char *buffer, size_t size); @@ -1523,7 +1531,7 @@ xkb_state_key_get_utf8(struct xkb_state *state, xkb_keycode_t key, * @memberof xkb_state * @since 0.4.1 */ -uint32_t +XKB_EXPORT uint32_t xkb_state_key_get_utf32(struct xkb_state *state, xkb_keycode_t key); /** @@ -1543,7 +1551,7 @@ xkb_state_key_get_utf32(struct xkb_state *state, xkb_keycode_t key); * @sa xkb_state_key_get_syms() * @memberof xkb_state */ -xkb_keysym_t +XKB_EXPORT xkb_keysym_t xkb_state_key_get_one_sym(struct xkb_state *state, xkb_keycode_t key); /** @@ -1560,7 +1568,7 @@ xkb_state_key_get_one_sym(struct xkb_state *state, xkb_keycode_t key); * * @memberof xkb_state */ -xkb_layout_index_t +XKB_EXPORT xkb_layout_index_t xkb_state_key_get_layout(struct xkb_state *state, xkb_keycode_t key); /** @@ -1585,7 +1593,7 @@ xkb_state_key_get_layout(struct xkb_state *state, xkb_keycode_t key); * * @memberof xkb_state */ -xkb_level_index_t +XKB_EXPORT xkb_level_index_t xkb_state_key_get_level(struct xkb_state *state, xkb_keycode_t key, xkb_layout_index_t layout); @@ -1624,7 +1632,7 @@ enum xkb_state_match { * * @memberof xkb_state */ -xkb_mod_mask_t +XKB_EXPORT xkb_mod_mask_t xkb_state_serialize_mods(struct xkb_state *state, enum xkb_state_component components); @@ -1647,7 +1655,7 @@ xkb_state_serialize_mods(struct xkb_state *state, * * @memberof xkb_state */ -xkb_layout_index_t +XKB_EXPORT xkb_layout_index_t xkb_state_serialize_layout(struct xkb_state *state, enum xkb_state_component components); @@ -1668,7 +1676,7 @@ xkb_state_serialize_layout(struct xkb_state *state, * [virtual modifiers]: @ref virtual-modifier-def * [real modifiers]: @ref real-modifier-def */ -int +XKB_EXPORT int xkb_state_mod_name_is_active(struct xkb_state *state, const char *name, enum xkb_state_component type); @@ -1698,7 +1706,7 @@ xkb_state_mod_name_is_active(struct xkb_state *state, const char *name, * [virtual modifiers]: @ref virtual-modifier-def * [real modifiers]: @ref real-modifier-def */ -int +XKB_EXPORT int xkb_state_mod_names_are_active(struct xkb_state *state, enum xkb_state_component type, enum xkb_state_match match, @@ -1721,7 +1729,7 @@ xkb_state_mod_names_are_active(struct xkb_state *state, * [virtual modifiers]: @ref virtual-modifier-def * [real modifiers]: @ref real-modifier-def */ -int +XKB_EXPORT int xkb_state_mod_index_is_active(struct xkb_state *state, xkb_mod_index_t idx, enum xkb_state_component type); @@ -1751,7 +1759,7 @@ xkb_state_mod_index_is_active(struct xkb_state *state, xkb_mod_index_t idx, * [virtual modifiers]: @ref virtual-modifier-def * [real modifiers]: @ref real-modifier-def */ -int +XKB_EXPORT int xkb_state_mod_indices_are_active(struct xkb_state *state, enum xkb_state_component type, enum xkb_state_match match, @@ -1873,7 +1881,7 @@ enum xkb_consumed_mode { * * [real modifiers]: @ref real-modifier-def */ -xkb_mod_mask_t +XKB_EXPORT xkb_mod_mask_t xkb_state_key_get_consumed_mods2(struct xkb_state *state, xkb_keycode_t key, enum xkb_consumed_mode mode); @@ -1883,7 +1891,7 @@ xkb_state_key_get_consumed_mods2(struct xkb_state *state, xkb_keycode_t key, * @memberof xkb_state * @since 0.4.1 */ -xkb_mod_mask_t +XKB_EXPORT xkb_mod_mask_t xkb_state_key_get_consumed_mods(struct xkb_state *state, xkb_keycode_t key); /** @@ -1910,7 +1918,7 @@ xkb_state_key_get_consumed_mods(struct xkb_state *state, xkb_keycode_t key); * [virtual modifiers]: @ref virtual-modifier-def * [real modifiers]: @ref real-modifier-def */ -int +XKB_EXPORT int xkb_state_mod_index_is_consumed2(struct xkb_state *state, xkb_keycode_t key, xkb_mod_index_t idx, @@ -1929,7 +1937,7 @@ xkb_state_mod_index_is_consumed2(struct xkb_state *state, * [virtual modifiers]: @ref virtual-modifier-def * [real modifiers]: @ref real-modifier-def */ -int +XKB_EXPORT int xkb_state_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key, xkb_mod_index_t idx); @@ -1950,7 +1958,7 @@ xkb_state_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key, * * [real modifiers]: @ref real-modifier-def */ -xkb_mod_mask_t +XKB_EXPORT xkb_mod_mask_t xkb_state_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key, xkb_mod_mask_t mask); @@ -1966,7 +1974,7 @@ xkb_state_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key, * @sa xkb_layout_index_t * @memberof xkb_state */ -int +XKB_EXPORT int xkb_state_layout_name_is_active(struct xkb_state *state, const char *name, enum xkb_state_component type); @@ -1979,7 +1987,7 @@ xkb_state_layout_name_is_active(struct xkb_state *state, const char *name, * @sa xkb_layout_index_t * @memberof xkb_state */ -int +XKB_EXPORT int xkb_state_layout_index_is_active(struct xkb_state *state, xkb_layout_index_t idx, enum xkb_state_component type); @@ -1993,7 +2001,7 @@ xkb_state_layout_index_is_active(struct xkb_state *state, * @sa xkb_led_index_t * @memberof xkb_state */ -int +XKB_EXPORT int xkb_state_led_name_is_active(struct xkb_state *state, const char *name); /** @@ -2005,7 +2013,7 @@ xkb_state_led_name_is_active(struct xkb_state *state, const char *name); * @sa xkb_led_index_t * @memberof xkb_state */ -int +XKB_EXPORT int xkb_state_led_index_is_active(struct xkb_state *state, xkb_led_index_t idx); /** @} */ diff --git a/include/xkbcommon/xkbregistry.h b/include/xkbcommon/xkbregistry.h index b61398d68..dd4640494 100644 --- a/include/xkbcommon/xkbregistry.h +++ b/include/xkbcommon/xkbregistry.h @@ -19,6 +19,14 @@ extern "C" { #endif +#if defined(__GNUC__) && !defined(__CYGWIN__) +# define RXKB_EXPORT __attribute__((visibility("default"))) +#elif defined(_WIN32) +# define RXKB_EXPORT __declspec(dllexport) +#else +# define RXKB_EXPORT +#endif + /** * @defgroup registry Query for available RMLVO * @@ -165,7 +173,7 @@ enum rxkb_context_flags { * @param flags Flags affecting context behavior * @return A new xkb registry context or NULL on failure */ -struct rxkb_context * +RXKB_EXPORT struct rxkb_context * rxkb_context_new(enum rxkb_context_flags flags); /** Specifies a logging level. */ @@ -188,14 +196,14 @@ enum rxkb_log_level { * RXKB_LOG_LEVEL, if set at the time the context was created, overrides the * default value. It may be specified as a level number or name. */ -void +RXKB_EXPORT void rxkb_context_set_log_level(struct rxkb_context *ctx, enum rxkb_log_level level); /** * Get the current logging level. */ -enum rxkb_log_level +RXKB_EXPORT enum rxkb_log_level rxkb_context_get_log_level(struct rxkb_context *ctx); /** @@ -216,7 +224,7 @@ rxkb_context_get_log_level(struct rxkb_context *ctx); * rxkb_context_get_user_data() from within the logging function to provide * it with additional private context. */ -void +RXKB_EXPORT void rxkb_context_set_log_fn(struct rxkb_context *ctx, void (*log_fn)(struct rxkb_context *ctx, enum rxkb_log_level level, @@ -243,14 +251,14 @@ rxkb_context_set_log_fn(struct rxkb_context *ctx, * @param ruleset The ruleset to parse, e.g. "evdev" * @return true on success or false on failure */ -bool +RXKB_EXPORT bool rxkb_context_parse(struct rxkb_context *ctx, const char *ruleset); /** * Parse the default ruleset as configured at build time. See * rxkb_context_parse() for details. */ -bool +RXKB_EXPORT bool rxkb_context_parse_default_ruleset(struct rxkb_context *ctx); /** @@ -259,7 +267,7 @@ rxkb_context_parse_default_ruleset(struct rxkb_context *ctx); * @param ctx The xkb registry context * @return The passed in object */ -struct rxkb_context* +RXKB_EXPORT struct rxkb_context* rxkb_context_ref(struct rxkb_context *ctx); /** @@ -269,7 +277,7 @@ rxkb_context_ref(struct rxkb_context *ctx); * @param ctx The xkb registry context * @return always NULL */ -struct rxkb_context* +RXKB_EXPORT struct rxkb_context* rxkb_context_unref(struct rxkb_context *ctx); /** @@ -280,7 +288,7 @@ rxkb_context_unref(struct rxkb_context *ctx); * @param ctx The xkb registry context * @param user_data User-specific data pointer */ -void +RXKB_EXPORT void rxkb_context_set_user_data(struct rxkb_context *ctx, void *user_data); /** @@ -289,7 +297,7 @@ rxkb_context_set_user_data(struct rxkb_context *ctx, void *user_data); * @param ctx The xkb registry context * @return User-specific data pointer */ -void * +RXKB_EXPORT void * rxkb_context_get_user_data(struct rxkb_context *ctx); /** @@ -356,7 +364,7 @@ rxkb_context_get_user_data(struct rxkb_context *ctx); * @returns true on success, or false if the include path could not be added * or is inaccessible. */ -bool +RXKB_EXPORT bool rxkb_context_include_path_append(struct rxkb_context *ctx, const char *path); /** @@ -369,7 +377,7 @@ rxkb_context_include_path_append(struct rxkb_context *ctx, const char *path); * @returns true on success, or false if the include path could not be added * or is inaccessible. */ -bool +RXKB_EXPORT bool rxkb_context_include_path_append_default(struct rxkb_context *ctx); /** @@ -381,7 +389,7 @@ rxkb_context_include_path_append_default(struct rxkb_context *ctx); * * @return The first model in the model list. */ -struct rxkb_model * +RXKB_EXPORT struct rxkb_model * rxkb_model_first(struct rxkb_context *ctx); /** @@ -393,7 +401,7 @@ rxkb_model_first(struct rxkb_context *ctx); * * @return the next model or NULL at the end of the list */ -struct rxkb_model * +RXKB_EXPORT struct rxkb_model * rxkb_model_next(struct rxkb_model *m); /** @@ -401,7 +409,7 @@ rxkb_model_next(struct rxkb_model *m); * * @returns The argument passed in to this function. */ -struct rxkb_model * +RXKB_EXPORT struct rxkb_model * rxkb_model_ref(struct rxkb_model *m); /** @@ -410,33 +418,33 @@ rxkb_model_ref(struct rxkb_model *m); * * @returns always NULL */ -struct rxkb_model * +RXKB_EXPORT struct rxkb_model * rxkb_model_unref(struct rxkb_model *m); /** * Return the name of this model. This is the value for M in RMLVO, to be used * with libxkbcommon. */ -const char * +RXKB_EXPORT const char * rxkb_model_get_name(struct rxkb_model *m); /** * Return a human-readable description of this model. This function may return * NULL. */ -const char * +RXKB_EXPORT const char * rxkb_model_get_description(struct rxkb_model *m); /** * Return the vendor name for this model. This function may return NULL. */ -const char * +RXKB_EXPORT const char * rxkb_model_get_vendor(struct rxkb_model *m); /** * Return the popularity for this model. */ -enum rxkb_popularity +RXKB_EXPORT enum rxkb_popularity rxkb_model_get_popularity(struct rxkb_model *m); /** @@ -448,7 +456,7 @@ rxkb_model_get_popularity(struct rxkb_model *m); * * @return The first layout in the layout list. */ -struct rxkb_layout * +RXKB_EXPORT struct rxkb_layout * rxkb_layout_first(struct rxkb_context *ctx); /** @@ -460,7 +468,7 @@ rxkb_layout_first(struct rxkb_context *ctx); * * @return the next layout or NULL at the end of the list */ -struct rxkb_layout * +RXKB_EXPORT struct rxkb_layout * rxkb_layout_next(struct rxkb_layout *l); /** @@ -468,7 +476,7 @@ rxkb_layout_next(struct rxkb_layout *l); * * @returns The argument passed in to this function. */ -struct rxkb_layout * +RXKB_EXPORT struct rxkb_layout * rxkb_layout_ref(struct rxkb_layout *l); /** @@ -477,14 +485,14 @@ rxkb_layout_ref(struct rxkb_layout *l); * * @returns always NULL */ -struct rxkb_layout * +RXKB_EXPORT struct rxkb_layout * rxkb_layout_unref(struct rxkb_layout *l); /** * Return the name of this layout. This is the value for L in RMLVO, to be used * with libxkbcommon. */ -const char * +RXKB_EXPORT const char * rxkb_layout_get_name(struct rxkb_layout *l); /** @@ -497,27 +505,27 @@ rxkb_layout_get_name(struct rxkb_layout *l); * * Where the variant is NULL, the layout is the base layout (e.g. "us"). */ -const char * +RXKB_EXPORT const char * rxkb_layout_get_variant(struct rxkb_layout *l); /** * Return a short (one-word) description of this layout. This function may * return NULL. */ -const char * +RXKB_EXPORT const char * rxkb_layout_get_brief(struct rxkb_layout *l); /** * Return a human-readable description of this layout. This function may return * NULL. */ -const char * +RXKB_EXPORT const char * rxkb_layout_get_description(struct rxkb_layout *l); /** * Return the popularity for this layout. */ -enum rxkb_popularity +RXKB_EXPORT enum rxkb_popularity rxkb_layout_get_popularity(struct rxkb_layout *l); /** @@ -531,7 +539,7 @@ rxkb_layout_get_popularity(struct rxkb_layout *l); * * @return The first option group in the option group list. */ -struct rxkb_option_group * +RXKB_EXPORT struct rxkb_option_group * rxkb_option_group_first(struct rxkb_context *ctx); /** @@ -544,7 +552,7 @@ rxkb_option_group_first(struct rxkb_context *ctx); * * @return the next option group or NULL at the end of the list */ -struct rxkb_option_group * +RXKB_EXPORT struct rxkb_option_group * rxkb_option_group_next(struct rxkb_option_group *g); /** @@ -552,7 +560,7 @@ rxkb_option_group_next(struct rxkb_option_group *g); * * @returns The argument passed in to this function. */ -struct rxkb_option_group * +RXKB_EXPORT struct rxkb_option_group * rxkb_option_group_ref(struct rxkb_option_group *g); /** @@ -561,7 +569,7 @@ rxkb_option_group_ref(struct rxkb_option_group *g); * * @returns always NULL */ -struct rxkb_option_group * +RXKB_EXPORT struct rxkb_option_group * rxkb_option_group_unref(struct rxkb_option_group *g); /** @@ -569,14 +577,14 @@ rxkb_option_group_unref(struct rxkb_option_group *g); * RMLVO, the name can be used for internal sorting in the caller. This function * may return NULL. */ -const char * +RXKB_EXPORT const char * rxkb_option_group_get_name(struct rxkb_option_group *m); /** * Return a human-readable description of this option group. This function may * return NULL. */ -const char * +RXKB_EXPORT const char * rxkb_option_group_get_description(struct rxkb_option_group *m); /** @@ -584,13 +592,13 @@ rxkb_option_group_get_description(struct rxkb_option_group *m); * simultaneously, false if all options within this option group * are mutually exclusive. */ -bool +RXKB_EXPORT bool rxkb_option_group_allows_multiple(struct rxkb_option_group *g); /** * Return the popularity for this option group. */ -enum rxkb_popularity +RXKB_EXPORT enum rxkb_popularity rxkb_option_group_get_popularity(struct rxkb_option_group *g); /** @@ -603,7 +611,7 @@ rxkb_option_group_get_popularity(struct rxkb_option_group *g); * * @return The first option in the option list. */ -struct rxkb_option * +RXKB_EXPORT struct rxkb_option * rxkb_option_first(struct rxkb_option_group *group); /** @@ -615,7 +623,7 @@ rxkb_option_first(struct rxkb_option_group *group); * * @returns The next option or NULL at the end of the list */ -struct rxkb_option * +RXKB_EXPORT struct rxkb_option * rxkb_option_next(struct rxkb_option *o); /** @@ -623,7 +631,7 @@ rxkb_option_next(struct rxkb_option *o); * * @returns The argument passed in to this function. */ -struct rxkb_option * +RXKB_EXPORT struct rxkb_option * rxkb_option_ref(struct rxkb_option *o); /** @@ -632,34 +640,34 @@ rxkb_option_ref(struct rxkb_option *o); * * @returns always NULL */ -struct rxkb_option * +RXKB_EXPORT struct rxkb_option * rxkb_option_unref(struct rxkb_option *o); /** * Return the name of this option. This is the value for O in RMLVO, to be used * with libxkbcommon. */ -const char * +RXKB_EXPORT const char * rxkb_option_get_name(struct rxkb_option *o); /** * Return a short (one-word) description of this option. This function may * return NULL. */ -const char * +RXKB_EXPORT const char * rxkb_option_get_brief(struct rxkb_option *o); /** * Return a human-readable description of this option. This function may return * NULL. */ -const char * +RXKB_EXPORT const char * rxkb_option_get_description(struct rxkb_option *o); /** * Return the popularity for this option. */ -enum rxkb_popularity +RXKB_EXPORT enum rxkb_popularity rxkb_option_get_popularity(struct rxkb_option *o); /** @@ -667,7 +675,7 @@ rxkb_option_get_popularity(struct rxkb_option *o); * * @returns The argument passed in to this function. */ -struct rxkb_iso639_code * +RXKB_EXPORT struct rxkb_iso639_code * rxkb_iso639_code_ref(struct rxkb_iso639_code *iso639); /** @@ -676,13 +684,13 @@ rxkb_iso639_code_ref(struct rxkb_iso639_code *iso639); * * @returns always NULL */ -struct rxkb_iso639_code * +RXKB_EXPORT struct rxkb_iso639_code * rxkb_iso639_code_unref(struct rxkb_iso639_code *iso639); /** * Return the ISO 639-3 code for this code (e.g. "eng", "fra"). */ -const char * +RXKB_EXPORT const char * rxkb_iso639_code_get_code(struct rxkb_iso639_code *iso639); /** @@ -695,7 +703,7 @@ rxkb_iso639_code_get_code(struct rxkb_iso639_code *iso639); * * @return The first code in the code list. */ -struct rxkb_iso639_code * +RXKB_EXPORT struct rxkb_iso639_code * rxkb_layout_get_iso639_first(struct rxkb_layout *layout); /** @@ -708,7 +716,7 @@ rxkb_layout_get_iso639_first(struct rxkb_layout *layout); * * @returns The next code or NULL at the end of the list */ -struct rxkb_iso639_code * +RXKB_EXPORT struct rxkb_iso639_code * rxkb_iso639_code_next(struct rxkb_iso639_code *iso639); /** @@ -716,7 +724,7 @@ rxkb_iso639_code_next(struct rxkb_iso639_code *iso639); * * @returns The argument passed in to this function. */ -struct rxkb_iso3166_code * +RXKB_EXPORT struct rxkb_iso3166_code * rxkb_iso3166_code_ref(struct rxkb_iso3166_code *iso3166); /** @@ -725,13 +733,13 @@ rxkb_iso3166_code_ref(struct rxkb_iso3166_code *iso3166); * * @returns always NULL */ -struct rxkb_iso3166_code * +RXKB_EXPORT struct rxkb_iso3166_code * rxkb_iso3166_code_unref(struct rxkb_iso3166_code *iso3166); /** * Return the ISO 3166 Alpha 2 code for this code (e.g. "US", "FR"). */ -const char * +RXKB_EXPORT const char * rxkb_iso3166_code_get_code(struct rxkb_iso3166_code *iso3166); /** @@ -745,7 +753,7 @@ rxkb_iso3166_code_get_code(struct rxkb_iso3166_code *iso3166); * * @return The first code in the code list. */ -struct rxkb_iso3166_code * +RXKB_EXPORT struct rxkb_iso3166_code * rxkb_layout_get_iso3166_first(struct rxkb_layout *layout); /** @@ -758,7 +766,7 @@ rxkb_layout_get_iso3166_first(struct rxkb_layout *layout); * * @returns The next code or NULL at the end of the list */ -struct rxkb_iso3166_code * +RXKB_EXPORT struct rxkb_iso3166_code * rxkb_iso3166_code_next(struct rxkb_iso3166_code *iso3166); /** @} */ diff --git a/meson.build b/meson.build index ee1833034..ce4655772 100644 --- a/meson.build +++ b/meson.build @@ -450,18 +450,12 @@ icu_dep = dependency('icu-uc', required: false) build_tools = get_option('enable-tools') and cc.has_header_symbol('getopt.h', 'getopt_long', prefix: '#define _GNU_SOURCE') if build_tools # Common resources - libxkbcommon_tools_internal_sources = [ - 'tools/tools-common.h', - 'tools/tools-common.c', - ] - libxkbcommon_tools_internal = static_library( - 'tools-internal', - libxkbcommon_tools_internal_sources, - dependencies: dep_libxkbcommon, - ) tools_dep = declare_dependency( + sources: [ + 'tools/tools-common.h', + 'tools/tools-common.c', + ], include_directories: [include_directories('tools', 'include')], - link_with: libxkbcommon_tools_internal, dependencies: dep_libxkbcommon, ) configh_data.set10('HAVE_TOOLS', true) @@ -553,8 +547,6 @@ if build_tools # The same tool again, but with access to some private APIs. executable('interactive-evdev', 'tools/interactive-evdev.c', - libxkbcommon_sources, - libxkbcommon_tools_internal_sources, dependencies: [tools_dep], c_args: ['-DENABLE_PRIVATE_APIS'], include_directories: [include_directories('src', 'include')], @@ -687,30 +679,34 @@ configure_file(output: 'test-config.h', configuration: test_configh_data) m_dep = cc.find_library('m', required : false) # Some tests need to use unexported symbols, so we link them against # an internal copy of libxkbcommon with all symbols exposed. -libxkbcommon_test_internal = static_library( +libxkbcommon_test_internal = library( 'xkbcommon-test-internal', - 'test/common.c', - 'test/test.h', - 'test/evdev-scancodes.h', - 'bench/bench.c', - 'bench/bench.h', libxkbcommon_sources, include_directories: include_directories('src', 'include'), c_args: ['-DENABLE_PRIVATE_APIS'], - dependencies: [m_dep], + gnu_symbol_visibility: 'hidden', ) test_dep = declare_dependency( + sources: [ + 'bench/bench.c', + 'bench/bench.h', + 'test/common.c', + 'test/evdev-scancodes.h', + 'test/test.h', + 'tools/tools-common.c', + 'tools/tools-common.h', + ], include_directories: include_directories('src', 'include'), link_with: libxkbcommon_test_internal, - dependencies: [tools_dep], + dependencies: [m_dep], ) if get_option('enable-x11') - libxkbcommon_x11_test_internal = static_library( + libxkbcommon_x11_test_internal = library( 'xkbcommon-x11-internal', libxkbcommon_x11_sources, - 'test/xvfb-wrapper.c', - 'test/xvfb-wrapper.h', include_directories: include_directories('src', 'include'), + c_args: ['-DENABLE_PRIVATE_APIS'], + gnu_symbol_visibility: 'hidden', link_with: libxkbcommon_test_internal, dependencies: [ xcb_dep, @@ -722,9 +718,15 @@ if get_option('enable-x11') dependencies: [ test_dep, xcb_dep, - xcb_xkb_dep, ], ) + x11_xvfb_test_dep = declare_dependency( + sources: [ + 'test/xvfb-wrapper.c', + 'test/xvfb-wrapper.h', + ], + dependencies: [x11_test_dep], + ) endif # TODO: version range? keysyms_test_dep = [test_dep] @@ -889,13 +891,13 @@ if get_option('enable-x11') endif test( 'x11', - executable('test-x11', 'test/x11.c', dependencies: x11_test_dep), + executable('test-x11', 'test/x11.c', dependencies: x11_xvfb_test_dep), env: test_env, is_parallel : false, ) test( 'x11comp', - executable('test-x11comp', 'test/x11comp.c', dependencies: x11_test_dep), + executable('test-x11comp', 'test/x11comp.c', dependencies: x11_xvfb_test_dep), env: test_env, is_parallel : false, ) diff --git a/scripts/update-unicode.py b/scripts/update-unicode.py index bd2b9364a..21ba02b86 100755 --- a/scripts/update-unicode.py +++ b/scripts/update-unicode.py @@ -1728,7 +1728,7 @@ def generate(cls, root: Path, write: bool, config: Config) -> None: {unicode_mappings} -XKB_EXPORT xkb_keysym_t +xkb_keysym_t xkb_keysym_to_lower(xkb_keysym_t ks) {{ if (ks <= 0x{max_non_unicode:0>4x}) {{ @@ -1747,7 +1747,7 @@ def generate(cls, root: Path, write: bool, config: Config) -> None: }} }} -XKB_EXPORT xkb_keysym_t +xkb_keysym_t xkb_keysym_to_upper(xkb_keysym_t ks) {{ if (ks <= 0x{max_non_unicode:0>4x}) {{ diff --git a/src/atom.h b/src/atom.h index d953f7333..160d9cef6 100644 --- a/src/atom.h +++ b/src/atom.h @@ -8,20 +8,22 @@ #include #include +#include "utils.h" + typedef uint32_t xkb_atom_t; #define XKB_ATOM_NONE 0 struct atom_table; -struct atom_table * +XKB_EXPORT_PRIVATE struct atom_table * atom_table_new(void); -void +XKB_EXPORT_PRIVATE void atom_table_free(struct atom_table *table); -xkb_atom_t +XKB_EXPORT_PRIVATE xkb_atom_t atom_intern(struct atom_table *table, const char *string, size_t len, bool add); -const char * +XKB_EXPORT_PRIVATE const char * atom_text(struct atom_table *table, xkb_atom_t atom); diff --git a/src/compose/dump.c b/src/compose/dump.c index c4052f241..cb398675a 100644 --- a/src/compose/dump.c +++ b/src/compose/dump.c @@ -16,7 +16,6 @@ #include "escape.h" #include "dump.h" #include "src/keysym.h" -#include "src/utils.h" bool print_compose_table_entry(FILE *file, struct xkb_compose_table_entry *entry) diff --git a/src/compose/parser.h b/src/compose/parser.h index fda53cbc9..c77ebd51b 100644 --- a/src/compose/parser.h +++ b/src/compose/parser.h @@ -11,12 +11,14 @@ #include "xkbcommon/xkbcommon.h" #include "xkbcommon/xkbcommon-compose.h" +#include "src/utils.h" + #define MAX_LHS_LEN 10 #define MAX_INCLUDE_DEPTH 5 /** Maximum size of the string returned by xkb_compose_state_get_utf8() */ #define XKB_COMPOSE_MAX_STRING_SIZE 256 -char * +XKB_EXPORT_PRIVATE char * parse_string_literal(struct xkb_context *ctx, const char *string); bool diff --git a/src/compose/state.c b/src/compose/state.c index 23ef2deb8..e9132430d 100644 --- a/src/compose/state.c +++ b/src/compose/state.c @@ -27,7 +27,7 @@ struct xkb_compose_state { uint32_t context; }; -XKB_EXPORT struct xkb_compose_state * +struct xkb_compose_state * xkb_compose_state_new(struct xkb_compose_table *table, enum xkb_compose_state_flags flags) { @@ -47,14 +47,14 @@ xkb_compose_state_new(struct xkb_compose_table *table, return state; } -XKB_EXPORT struct xkb_compose_state * +struct xkb_compose_state * xkb_compose_state_ref(struct xkb_compose_state *state) { state->refcnt++; return state; } -XKB_EXPORT void +void xkb_compose_state_unref(struct xkb_compose_state *state) { if (!state || --state->refcnt > 0) @@ -64,13 +64,13 @@ xkb_compose_state_unref(struct xkb_compose_state *state) free(state); } -XKB_EXPORT struct xkb_compose_table * +struct xkb_compose_table * xkb_compose_state_get_compose_table(struct xkb_compose_state *state) { return state->table; } -XKB_EXPORT enum xkb_compose_feed_result +enum xkb_compose_feed_result xkb_compose_state_feed(struct xkb_compose_state *state, xkb_keysym_t keysym) { uint32_t context; @@ -110,14 +110,14 @@ xkb_compose_state_feed(struct xkb_compose_state *state, xkb_keysym_t keysym) return XKB_COMPOSE_FEED_ACCEPTED; } -XKB_EXPORT void +void xkb_compose_state_reset(struct xkb_compose_state *state) { state->prev_context = 0; state->context = 0; } -XKB_EXPORT enum xkb_compose_status +enum xkb_compose_status xkb_compose_state_get_status(struct xkb_compose_state *state) { const struct compose_node *prev_node, *node; @@ -137,7 +137,7 @@ xkb_compose_state_get_status(struct xkb_compose_state *state) return XKB_COMPOSE_COMPOSED; } -XKB_EXPORT int +int xkb_compose_state_get_utf8(struct xkb_compose_state *state, char *buffer, size_t size) { @@ -172,7 +172,7 @@ xkb_compose_state_get_utf8(struct xkb_compose_state *state, return 0; } -XKB_EXPORT xkb_keysym_t +xkb_keysym_t xkb_compose_state_get_one_sym(struct xkb_compose_state *state) { const struct compose_node *node = diff --git a/src/compose/table.c b/src/compose/table.c index b7084a981..6a90c8964 100644 --- a/src/compose/table.c +++ b/src/compose/table.c @@ -52,14 +52,14 @@ xkb_compose_table_new(struct xkb_context *ctx, return table; } -XKB_EXPORT struct xkb_compose_table * +struct xkb_compose_table * xkb_compose_table_ref(struct xkb_compose_table *table) { table->refcnt++; return table; } -XKB_EXPORT void +void xkb_compose_table_unref(struct xkb_compose_table *table) { if (!table || --table->refcnt > 0) @@ -71,7 +71,7 @@ xkb_compose_table_unref(struct xkb_compose_table *table) free(table); } -XKB_EXPORT struct xkb_compose_table * +struct xkb_compose_table * xkb_compose_table_new_from_file(struct xkb_context *ctx, FILE *file, const char *locale, @@ -106,7 +106,7 @@ xkb_compose_table_new_from_file(struct xkb_context *ctx, return table; } -XKB_EXPORT struct xkb_compose_table * +struct xkb_compose_table * xkb_compose_table_new_from_buffer(struct xkb_context *ctx, const char *buffer, size_t length, const char *locale, @@ -141,7 +141,7 @@ xkb_compose_table_new_from_buffer(struct xkb_context *ctx, return table; } -XKB_EXPORT struct xkb_compose_table * +struct xkb_compose_table * xkb_compose_table_new_from_locale(struct xkb_context *ctx, const char *locale, enum xkb_compose_compile_flags flags) @@ -209,7 +209,7 @@ xkb_compose_table_new_from_locale(struct xkb_context *ctx, return table; } -XKB_EXPORT const xkb_keysym_t * +const xkb_keysym_t * xkb_compose_table_entry_sequence(struct xkb_compose_table_entry *entry, size_t *sequence_length) { @@ -217,13 +217,13 @@ xkb_compose_table_entry_sequence(struct xkb_compose_table_entry *entry, return entry->sequence; } -XKB_EXPORT xkb_keysym_t +xkb_keysym_t xkb_compose_table_entry_keysym(struct xkb_compose_table_entry *entry) { return entry->keysym; } -XKB_EXPORT const char * +const char * xkb_compose_table_entry_utf8(struct xkb_compose_table_entry *entry) { return entry->utf8; @@ -246,7 +246,7 @@ struct xkb_compose_table_iterator { darray(struct xkb_compose_table_iterator_pending_node) pending_nodes; }; -XKB_EXPORT struct xkb_compose_table_iterator * +struct xkb_compose_table_iterator * xkb_compose_table_iterator_new(struct xkb_compose_table *table) { struct xkb_compose_table_iterator *iter; @@ -289,7 +289,7 @@ xkb_compose_table_iterator_new(struct xkb_compose_table *table) return iter; } -XKB_EXPORT void +void xkb_compose_table_iterator_free(struct xkb_compose_table_iterator *iter) { xkb_compose_table_unref(iter->table); @@ -298,7 +298,7 @@ xkb_compose_table_iterator_free(struct xkb_compose_table_iterator *iter) free(iter); } -XKB_EXPORT struct xkb_compose_table_entry * +struct xkb_compose_table_entry * xkb_compose_table_iterator_next(struct xkb_compose_table_iterator *iter) { /* Traversal algorithm (simplified): diff --git a/src/context.c b/src/context.c index ce484236c..049c80345 100644 --- a/src/context.c +++ b/src/context.c @@ -20,7 +20,7 @@ /** * Append one directory to the context's include path. */ -XKB_EXPORT int +int xkb_context_include_path_append(struct xkb_context *ctx, const char *path) { struct stat stat_buf; @@ -75,7 +75,7 @@ xkb_context_include_path_get_system_path(struct xkb_context *ctx) /** * Append the default include directories to the context. */ -XKB_EXPORT int +int xkb_context_include_path_append_default(struct xkb_context *ctx) { const char *home, *xdg, *root, *extra; @@ -119,7 +119,7 @@ xkb_context_include_path_append_default(struct xkb_context *ctx) /** * Remove all entries in the context's include path. */ -XKB_EXPORT void +void xkb_context_include_path_clear(struct xkb_context *ctx) { char **path; @@ -136,7 +136,7 @@ xkb_context_include_path_clear(struct xkb_context *ctx) /** * xkb_context_include_path_clear() + xkb_context_include_path_append_default() */ -XKB_EXPORT int +int xkb_context_include_path_reset_defaults(struct xkb_context *ctx) { xkb_context_include_path_clear(ctx); @@ -146,7 +146,7 @@ xkb_context_include_path_reset_defaults(struct xkb_context *ctx) /** * Returns the number of entries in the context's include path. */ -XKB_EXPORT unsigned int +unsigned int xkb_context_num_include_paths(struct xkb_context *ctx) { return darray_size(ctx->includes); @@ -156,7 +156,7 @@ xkb_context_num_include_paths(struct xkb_context *ctx) * Returns the given entry in the context's include path, or NULL if an * invalid index is passed. */ -XKB_EXPORT const char * +const char * xkb_context_include_path_get(struct xkb_context *ctx, unsigned int idx) { if (idx >= xkb_context_num_include_paths(ctx)) @@ -168,7 +168,7 @@ xkb_context_include_path_get(struct xkb_context *ctx, unsigned int idx) /** * Take a new reference on the context. */ -XKB_EXPORT struct xkb_context * +struct xkb_context * xkb_context_ref(struct xkb_context *ctx) { ctx->refcnt++; @@ -179,7 +179,7 @@ xkb_context_ref(struct xkb_context *ctx) * Drop an existing reference on the context, and free it if the refcnt is * now 0. */ -XKB_EXPORT void +void xkb_context_unref(struct xkb_context *ctx) { if (!ctx || --ctx->refcnt > 0) @@ -260,7 +260,7 @@ log_verbosity(const char *verbosity) { /** * Create a new context. */ -XKB_EXPORT struct xkb_context * +struct xkb_context * xkb_context_new(enum xkb_context_flags flags) { const char *env; @@ -305,7 +305,7 @@ xkb_context_new(enum xkb_context_flags flags) return ctx; } -XKB_EXPORT void +void xkb_context_set_log_fn(struct xkb_context *ctx, void (*log_fn)(struct xkb_context *ctx, enum xkb_log_level level, @@ -314,31 +314,31 @@ xkb_context_set_log_fn(struct xkb_context *ctx, ctx->log_fn = (log_fn ? log_fn : default_log_fn); } -XKB_EXPORT enum xkb_log_level +enum xkb_log_level xkb_context_get_log_level(struct xkb_context *ctx) { return ctx->log_level; } -XKB_EXPORT void +void xkb_context_set_log_level(struct xkb_context *ctx, enum xkb_log_level level) { ctx->log_level = level; } -XKB_EXPORT int +int xkb_context_get_log_verbosity(struct xkb_context *ctx) { return ctx->log_verbosity; } -XKB_EXPORT void +void xkb_context_set_log_verbosity(struct xkb_context *ctx, int verbosity) { ctx->log_verbosity = verbosity; } -XKB_EXPORT void * +void * xkb_context_get_user_data(struct xkb_context *ctx) { if (ctx) @@ -346,7 +346,7 @@ xkb_context_get_user_data(struct xkb_context *ctx) return NULL; } -XKB_EXPORT void +void xkb_context_set_user_data(struct xkb_context *ctx, void *user_data) { ctx->user_data = user_data; diff --git a/src/context.h b/src/context.h index 53c6f1dad..3048fc5dc 100644 --- a/src/context.h +++ b/src/context.h @@ -65,7 +65,7 @@ xkb_context_include_path_get_system_path(struct xkb_context *ctx); xkb_atom_t xkb_atom_lookup(struct xkb_context *ctx, const char *string); -xkb_atom_t +XKB_EXPORT_PRIVATE xkb_atom_t xkb_atom_intern(struct xkb_context *ctx, const char *string, size_t len); #define xkb_atom_intern_literal(ctx, literal) \ @@ -80,13 +80,13 @@ xkb_atom_intern(struct xkb_context *ctx, const char *string, size_t len); xkb_atom_t xkb_atom_steal(struct xkb_context *ctx, char *string); -const char * +XKB_EXPORT_PRIVATE const char * xkb_atom_text(struct xkb_context *ctx, xkb_atom_t atom); char * xkb_context_get_buffer(struct xkb_context *ctx, size_t size); -ATTR_PRINTF(4, 5) void +XKB_EXPORT_PRIVATE ATTR_PRINTF(4, 5) void xkb_log(struct xkb_context *ctx, enum xkb_log_level level, int verbosity, const char *fmt, ...); diff --git a/src/keymap.c b/src/keymap.c index 651aa11f7..830d883a5 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -16,14 +16,14 @@ #include "keymap.h" #include "text.h" -XKB_EXPORT struct xkb_keymap * +struct xkb_keymap * xkb_keymap_ref(struct xkb_keymap *keymap) { keymap->refcnt++; return keymap; } -XKB_EXPORT void +void xkb_keymap_unref(struct xkb_keymap *keymap) { if (!keymap || --keymap->refcnt > 0) @@ -80,7 +80,7 @@ get_keymap_format_ops(enum xkb_keymap_format format) return keymap_format_ops[(int) format]; } -XKB_EXPORT struct xkb_keymap * +struct xkb_keymap * xkb_keymap_new_from_names(struct xkb_context *ctx, const struct xkb_rule_names *rmlvo_in, enum xkb_keymap_compile_flags flags) @@ -121,7 +121,7 @@ xkb_keymap_new_from_names(struct xkb_context *ctx, return keymap; } -XKB_EXPORT struct xkb_keymap * +struct xkb_keymap * xkb_keymap_new_from_string(struct xkb_context *ctx, const char *string, enum xkb_keymap_format format, @@ -131,7 +131,7 @@ xkb_keymap_new_from_string(struct xkb_context *ctx, format, flags); } -XKB_EXPORT struct xkb_keymap * +struct xkb_keymap * xkb_keymap_new_from_buffer(struct xkb_context *ctx, const char *buffer, size_t length, enum xkb_keymap_format format, @@ -175,7 +175,7 @@ xkb_keymap_new_from_buffer(struct xkb_context *ctx, return keymap; } -XKB_EXPORT struct xkb_keymap * +struct xkb_keymap * xkb_keymap_new_from_file(struct xkb_context *ctx, FILE *file, enum xkb_keymap_format format, @@ -215,7 +215,7 @@ xkb_keymap_new_from_file(struct xkb_context *ctx, return keymap; } -XKB_EXPORT char * +char * xkb_keymap_get_as_string(struct xkb_keymap *keymap, enum xkb_keymap_format format) { @@ -237,7 +237,7 @@ xkb_keymap_get_as_string(struct xkb_keymap *keymap, /** * Returns the total number of modifiers active in the keymap. */ -XKB_EXPORT xkb_mod_index_t +xkb_mod_index_t xkb_keymap_num_mods(struct xkb_keymap *keymap) { return keymap->mods.num_mods; @@ -246,7 +246,7 @@ xkb_keymap_num_mods(struct xkb_keymap *keymap) /** * Return the name for a given modifier. */ -XKB_EXPORT const char * +const char * xkb_keymap_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx) { if (idx >= keymap->mods.num_mods) @@ -258,7 +258,7 @@ xkb_keymap_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx) /** * Returns the index for a named modifier. */ -XKB_EXPORT xkb_mod_index_t +xkb_mod_index_t xkb_keymap_mod_get_index(struct xkb_keymap *keymap, const char *name) { xkb_atom_t atom; @@ -273,7 +273,7 @@ xkb_keymap_mod_get_index(struct xkb_keymap *keymap, const char *name) /** * Return the total number of active groups in the keymap. */ -XKB_EXPORT xkb_layout_index_t +xkb_layout_index_t xkb_keymap_num_layouts(struct xkb_keymap *keymap) { return keymap->num_groups; @@ -282,7 +282,7 @@ xkb_keymap_num_layouts(struct xkb_keymap *keymap) /** * Returns the name for a given group. */ -XKB_EXPORT const char * +const char * xkb_keymap_layout_get_name(struct xkb_keymap *keymap, xkb_layout_index_t idx) { if (idx >= keymap->num_group_names) @@ -294,7 +294,7 @@ xkb_keymap_layout_get_name(struct xkb_keymap *keymap, xkb_layout_index_t idx) /** * Returns the index for a named layout. */ -XKB_EXPORT xkb_layout_index_t +xkb_layout_index_t xkb_keymap_layout_get_index(struct xkb_keymap *keymap, const char *name) { xkb_atom_t atom = xkb_atom_lookup(keymap->ctx, name); @@ -313,7 +313,7 @@ xkb_keymap_layout_get_index(struct xkb_keymap *keymap, const char *name) /** * Returns the number of layouts active for a particular key. */ -XKB_EXPORT xkb_layout_index_t +xkb_layout_index_t xkb_keymap_num_layouts_for_key(struct xkb_keymap *keymap, xkb_keycode_t kc) { const struct xkb_key *key = XkbKey(keymap, kc); @@ -327,7 +327,7 @@ xkb_keymap_num_layouts_for_key(struct xkb_keymap *keymap, xkb_keycode_t kc) /** * Returns the number of levels active for a particular key and layout. */ -XKB_EXPORT xkb_level_index_t +xkb_level_index_t xkb_keymap_num_levels_for_key(struct xkb_keymap *keymap, xkb_keycode_t kc, xkb_layout_index_t layout) { @@ -348,7 +348,7 @@ xkb_keymap_num_levels_for_key(struct xkb_keymap *keymap, xkb_keycode_t kc, /** * Return the total number of LEDs in the keymap. */ -XKB_EXPORT xkb_led_index_t +xkb_led_index_t xkb_keymap_num_leds(struct xkb_keymap *keymap) { return keymap->num_leds; @@ -357,7 +357,7 @@ xkb_keymap_num_leds(struct xkb_keymap *keymap) /** * Returns the name for a given LED. */ -XKB_EXPORT const char * +const char * xkb_keymap_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx) { if (idx >= keymap->num_leds) @@ -369,7 +369,7 @@ xkb_keymap_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx) /** * Returns the index for a named LED. */ -XKB_EXPORT xkb_led_index_t +xkb_led_index_t xkb_keymap_led_get_index(struct xkb_keymap *keymap, const char *name) { xkb_atom_t atom = xkb_atom_lookup(keymap->ctx, name); @@ -386,7 +386,7 @@ xkb_keymap_led_get_index(struct xkb_keymap *keymap, const char *name) return XKB_LED_INVALID; } -XKB_EXPORT size_t +size_t xkb_keymap_key_get_mods_for_level(struct xkb_keymap *keymap, xkb_keycode_t kc, xkb_layout_index_t layout, @@ -449,7 +449,7 @@ xkb_keymap_key_get_mods_for_level(struct xkb_keymap *keymap, /** * As below, but takes an explicit layout/level rather than state. */ -XKB_EXPORT int +int xkb_keymap_key_get_syms_by_level(struct xkb_keymap *keymap, xkb_keycode_t kc, xkb_layout_index_t layout, @@ -486,19 +486,19 @@ xkb_keymap_key_get_syms_by_level(struct xkb_keymap *keymap, return 0; } -XKB_EXPORT xkb_keycode_t +xkb_keycode_t xkb_keymap_min_keycode(struct xkb_keymap *keymap) { return keymap->min_key_code; } -XKB_EXPORT xkb_keycode_t +xkb_keycode_t xkb_keymap_max_keycode(struct xkb_keymap *keymap) { return keymap->max_key_code; } -XKB_EXPORT void +void xkb_keymap_key_for_each(struct xkb_keymap *keymap, xkb_keymap_key_iter_t iter, void *data) { @@ -508,7 +508,7 @@ xkb_keymap_key_for_each(struct xkb_keymap *keymap, xkb_keymap_key_iter_t iter, iter(keymap, key->keycode, data); } -XKB_EXPORT const char * +const char * xkb_keymap_key_get_name(struct xkb_keymap *keymap, xkb_keycode_t kc) { const struct xkb_key *key = XkbKey(keymap, kc); @@ -519,7 +519,7 @@ xkb_keymap_key_get_name(struct xkb_keymap *keymap, xkb_keycode_t kc) return xkb_atom_text(keymap->ctx, key->name); } -XKB_EXPORT xkb_keycode_t +xkb_keycode_t xkb_keymap_key_by_name(struct xkb_keymap *keymap, const char *name) { struct xkb_key *key; @@ -545,7 +545,7 @@ xkb_keymap_key_by_name(struct xkb_keymap *keymap, const char *name) /** * Simple boolean specifying whether or not the key should repeat. */ -XKB_EXPORT int +int xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t kc) { const struct xkb_key *key = XkbKey(keymap, kc); diff --git a/src/keysym-case-mappings.c b/src/keysym-case-mappings.c index a585a7fa7..eaa00e149 100644 --- a/src/keysym-case-mappings.c +++ b/src/keysym-case-mappings.c @@ -578,7 +578,7 @@ get_unicode_entry(xkb_keysym_t ks) return &unicode_data[unicode_offsets1[unicode_offsets2[ks >> 8] + ((ks >> 3) & 0x1f)] + (ks & 0x07)]; } -XKB_EXPORT xkb_keysym_t +xkb_keysym_t xkb_keysym_to_lower(xkb_keysym_t ks) { if (ks <= 0x13be) { @@ -597,7 +597,7 @@ xkb_keysym_to_lower(xkb_keysym_t ks) } } -XKB_EXPORT xkb_keysym_t +xkb_keysym_t xkb_keysym_to_upper(xkb_keysym_t ks) { if (ks <= 0x13be) { diff --git a/src/keysym-utf.c b/src/keysym-utf.c index 3338e69eb..a90f08fca 100644 --- a/src/keysym-utf.c +++ b/src/keysym-utf.c @@ -853,7 +853,7 @@ bin_search(const struct codepair *table, size_t length, xkb_keysym_t keysym) return NO_KEYSYM_UNICODE_CONVERSION; } -XKB_EXPORT uint32_t +uint32_t xkb_keysym_to_utf32(xkb_keysym_t keysym) { /* first check for Latin-1 characters (1:1 mapping) */ @@ -894,7 +894,7 @@ xkb_keysym_to_utf32(xkb_keysym_t keysym) return bin_search(keysymtab, ARRAY_SIZE(keysymtab) - 1, keysym); } -XKB_EXPORT xkb_keysym_t +xkb_keysym_t xkb_utf32_to_keysym(uint32_t ucs) { /* first check for Latin-1 characters (1:1 mapping) */ @@ -932,7 +932,7 @@ xkb_utf32_to_keysym(uint32_t ucs) * Author: Rob Bradford */ -XKB_EXPORT int +int xkb_keysym_to_utf8(xkb_keysym_t keysym, char *buffer, size_t size) { uint32_t codepoint; diff --git a/src/keysym.c b/src/keysym.c index 39e6d0086..9bd796acf 100644 --- a/src/keysym.c +++ b/src/keysym.c @@ -62,7 +62,7 @@ get_unicode_name(xkb_keysym_t ks, char *buffer, size_t size) return snprintf(buffer, size, "U%0*lX", width, ks & 0xffffffUL); } -XKB_EXPORT int +int xkb_keysym_get_name(xkb_keysym_t ks, char *buffer, size_t size) { if (ks > XKB_KEYSYM_MAX) { @@ -206,7 +206,7 @@ parse_keysym_hex(const char *s, uint32_t *out) return s[i] == '\0' && i > 0; } -XKB_EXPORT xkb_keysym_t +xkb_keysym_t xkb_keysym_from_name(const char *name, enum xkb_keysym_flags flags) { const struct name_keysym *entry = NULL; diff --git a/src/keysym.h b/src/keysym.h index 0ceb47fe3..3ae079aa1 100644 --- a/src/keysym.h +++ b/src/keysym.h @@ -11,6 +11,7 @@ #include #include "xkbcommon/xkbcommon.h" +#include "utils.h" /* * NOTE: this is not defined in xkbcommon.h, because if we did, it may add @@ -47,31 +48,31 @@ * 4 bytes + NULL-terminating byte */ #define XKB_KEYSYM_UTF8_MAX_SIZE 5 -bool +XKB_EXPORT_PRIVATE bool xkb_keysym_is_assigned(xkb_keysym_t ks); struct xkb_keysym_iterator; -struct xkb_keysym_iterator* +XKB_EXPORT_PRIVATE struct xkb_keysym_iterator* xkb_keysym_iterator_new(bool explicit); -struct xkb_keysym_iterator* +XKB_EXPORT_PRIVATE struct xkb_keysym_iterator* xkb_keysym_iterator_unref(struct xkb_keysym_iterator *iter); -bool +XKB_EXPORT_PRIVATE bool xkb_keysym_iterator_next(struct xkb_keysym_iterator *iter); -xkb_keysym_t +XKB_EXPORT_PRIVATE xkb_keysym_t xkb_keysym_iterator_get_keysym(struct xkb_keysym_iterator *iter); -int +XKB_EXPORT_PRIVATE int xkb_keysym_iterator_get_name(struct xkb_keysym_iterator *iter, char *buffer, size_t size); -bool +XKB_EXPORT_PRIVATE bool xkb_keysym_iterator_is_explicitly_named(struct xkb_keysym_iterator *iter); -bool +XKB_EXPORT_PRIVATE bool xkb_keysym_is_deprecated(xkb_keysym_t keysym, const char *name, const char **reference_name); @@ -92,14 +93,14 @@ xkb_keysym_is_deprecated(xkb_keysym_t keysym, } \ } -bool +XKB_EXPORT_PRIVATE bool xkb_keysym_is_lower(xkb_keysym_t keysym); -bool +XKB_EXPORT_PRIVATE bool xkb_keysym_is_upper_or_title(xkb_keysym_t keysym); -bool +XKB_EXPORT_PRIVATE bool xkb_keysym_is_keypad(xkb_keysym_t keysym); -bool +XKB_EXPORT_PRIVATE bool xkb_keysym_is_modifier(xkb_keysym_t keysym); diff --git a/src/registry.c b/src/registry.c index 03eee5245..df18304e9 100644 --- a/src/registry.c +++ b/src/registry.c @@ -151,11 +151,11 @@ rxkb_log(struct rxkb_context *ctx, enum rxkb_log_level level, #define DECLARE_REF_UNREF_FOR_TYPE(type_) \ -XKB_EXPORT struct type_ * type_##_ref(struct type_ *object) { \ +struct type_ * type_##_ref(struct type_ *object) { \ rxkb_object_ref(&object->base); \ return object; \ } \ -XKB_EXPORT struct type_ * type_##_unref(struct type_ *object) { \ +struct type_ * type_##_unref(struct type_ *object) { \ if (!object) return NULL; \ assert(object->base.refcount >= 1); \ if (--object->base.refcount == 0) {\ @@ -175,7 +175,7 @@ static inline struct type_ * type_##_create(struct rxkb_object *parent) { \ } #define DECLARE_TYPED_GETTER_FOR_TYPE(type_, field_, rtype_) \ -XKB_EXPORT rtype_ type_##_get_##field_(struct type_ *object) { \ +rtype_ type_##_get_##field_(struct type_ *object) { \ return object->field_; \ } @@ -183,13 +183,13 @@ XKB_EXPORT rtype_ type_##_get_##field_(struct type_ *object) { \ DECLARE_TYPED_GETTER_FOR_TYPE(type_, field_, const char*) #define DECLARE_FIRST_NEXT_FOR_TYPE(type_, parent_type_, parent_field_) \ -XKB_EXPORT struct type_ * type_##_first(struct parent_type_ *parent) { \ +struct type_ * type_##_first(struct parent_type_ *parent) { \ struct type_ *o = NULL; \ if (!list_empty(&parent->parent_field_)) \ o = list_first_entry(&parent->parent_field_, o, base.link); \ return o; \ } \ -XKB_EXPORT struct type_ * \ +struct type_ * \ type_##_next(struct type_ *o) \ { \ struct parent_type_ *parent; \ @@ -223,7 +223,7 @@ rxkb_iso639_code_destroy(struct rxkb_iso639_code *code) free(code->code); } -XKB_EXPORT struct rxkb_iso639_code * +struct rxkb_iso639_code * rxkb_layout_get_iso639_first(struct rxkb_layout *layout) { struct rxkb_iso639_code *code = NULL; @@ -234,7 +234,7 @@ rxkb_layout_get_iso639_first(struct rxkb_layout *layout) return code; } -XKB_EXPORT struct rxkb_iso639_code * +struct rxkb_iso639_code * rxkb_iso639_code_next(struct rxkb_iso639_code *code) { struct rxkb_iso639_code *next = NULL; @@ -260,7 +260,7 @@ rxkb_iso3166_code_destroy(struct rxkb_iso3166_code *code) free(code->code); } -XKB_EXPORT struct rxkb_iso3166_code * +struct rxkb_iso3166_code * rxkb_layout_get_iso3166_first(struct rxkb_layout *layout) { struct rxkb_iso3166_code *code = NULL; @@ -271,7 +271,7 @@ rxkb_layout_get_iso3166_first(struct rxkb_layout *layout) return code; } -XKB_EXPORT struct rxkb_iso3166_code * +struct rxkb_iso3166_code * rxkb_iso3166_code_next(struct rxkb_iso3166_code *code) { struct rxkb_iso3166_code *next = NULL; @@ -364,7 +364,7 @@ rxkb_option_group_destroy(struct rxkb_option_group *og) } } -XKB_EXPORT bool +bool rxkb_option_group_allows_multiple(struct rxkb_option_group *g) { return g->allow_multiple; @@ -419,7 +419,7 @@ rxkb_context_getenv(struct rxkb_context *ctx, const char *name) } -XKB_EXPORT void +void rxkb_context_set_log_level(struct rxkb_context *ctx, enum rxkb_log_level level) { @@ -479,7 +479,7 @@ log_level(const char *level) { return RXKB_LOG_LEVEL_ERROR; } -XKB_EXPORT struct rxkb_context * +struct rxkb_context * rxkb_context_new(enum rxkb_context_flags flags) { struct rxkb_context *ctx = rxkb_context_create(NULL); @@ -512,7 +512,7 @@ rxkb_context_new(enum rxkb_context_flags flags) return ctx; } -XKB_EXPORT void +void rxkb_context_set_log_fn(struct rxkb_context *ctx, void (*log_fn)(struct rxkb_context *ctx, enum rxkb_log_level level, @@ -521,7 +521,7 @@ rxkb_context_set_log_fn(struct rxkb_context *ctx, ctx->log_fn = (log_fn ? log_fn : default_log_fn); } -XKB_EXPORT bool +bool rxkb_context_include_path_append(struct rxkb_context *ctx, const char *path) { struct stat stat_buf; @@ -566,7 +566,7 @@ rxkb_context_include_path_append(struct rxkb_context *ctx, const char *path) return true; } -XKB_EXPORT bool +bool rxkb_context_include_path_append_default(struct rxkb_context *ctx) { const char *home, *xdg, *root, *extra; @@ -611,13 +611,13 @@ rxkb_context_include_path_append_default(struct rxkb_context *ctx) return ret; } -XKB_EXPORT bool +bool rxkb_context_parse_default_ruleset(struct rxkb_context *ctx) { return rxkb_context_parse(ctx, DEFAULT_XKB_RULES); } -XKB_EXPORT bool +bool rxkb_context_parse(struct rxkb_context *ctx, const char *ruleset) { char **path; @@ -654,13 +654,13 @@ rxkb_context_parse(struct rxkb_context *ctx, const char *ruleset) } -XKB_EXPORT void +void rxkb_context_set_user_data(struct rxkb_context *ctx, void *userdata) { ctx->userdata = userdata; } -XKB_EXPORT void * +void * rxkb_context_get_user_data(struct rxkb_context *ctx) { return ctx->userdata; diff --git a/src/state.c b/src/state.c index 8ebc8e082..105ba8170 100644 --- a/src/state.c +++ b/src/state.c @@ -102,7 +102,7 @@ get_entry_for_key_state(struct xkb_state *state, const struct xkb_key *key, * Returns the level to use for the given key and state, or * XKB_LEVEL_INVALID. */ -XKB_EXPORT xkb_level_index_t +xkb_level_index_t xkb_state_key_get_level(struct xkb_state *state, xkb_keycode_t kc, xkb_layout_index_t layout) { @@ -124,7 +124,7 @@ xkb_state_key_get_level(struct xkb_state *state, xkb_keycode_t kc, * Returns the layout to use for the given key and state, taking * wrapping/clamping/etc into account, or XKB_LAYOUT_INVALID. */ -XKB_EXPORT xkb_layout_index_t +xkb_layout_index_t xkb_state_key_get_layout(struct xkb_state *state, xkb_keycode_t kc) { const struct xkb_key *key = XkbKey(state->keymap, kc); @@ -657,7 +657,7 @@ xkb_filter_apply_all(struct xkb_state *state, } } -XKB_EXPORT struct xkb_state * +struct xkb_state * xkb_state_new(struct xkb_keymap *keymap) { struct xkb_state *ret; @@ -672,14 +672,14 @@ xkb_state_new(struct xkb_keymap *keymap) return ret; } -XKB_EXPORT struct xkb_state * +struct xkb_state * xkb_state_ref(struct xkb_state *state) { state->refcnt++; return state; } -XKB_EXPORT void +void xkb_state_unref(struct xkb_state *state) { if (!state || --state->refcnt > 0) @@ -690,7 +690,7 @@ xkb_state_unref(struct xkb_state *state) free(state); } -XKB_EXPORT struct xkb_keymap * +struct xkb_keymap * xkb_state_get_keymap(struct xkb_state *state) { return state->keymap; @@ -835,7 +835,7 @@ get_state_component_changes(const struct state_components *a, * Given a particular key event, updates the state structure to reflect the * new modifiers. */ -XKB_EXPORT enum xkb_state_component +enum xkb_state_component xkb_state_update_key(struct xkb_state *state, xkb_keycode_t kc, enum xkb_key_direction direction) { @@ -885,7 +885,7 @@ xkb_state_update_key(struct xkb_state *state, xkb_keycode_t kc, * lossy, and should only be used to update a slave state mirroring the * master, e.g. in a client/server window system. */ -XKB_EXPORT enum xkb_state_component +enum xkb_state_component xkb_state_update_mask(struct xkb_state *state, xkb_mod_mask_t base_mods, xkb_mod_mask_t latched_mods, @@ -941,7 +941,7 @@ xkb_state_update_mask(struct xkb_state *state, * Provides the symbols to use for the given key and state. Returns the * number of symbols pointed to in syms_out. */ -XKB_EXPORT int +int xkb_state_key_get_syms(struct xkb_state *state, xkb_keycode_t kc, const xkb_keysym_t **syms_out) { @@ -1040,7 +1040,7 @@ XkbToControl(char ch) /** * Provides either exactly one symbol, or XKB_KEY_NoSymbol. */ -XKB_EXPORT xkb_keysym_t +xkb_keysym_t xkb_state_key_get_one_sym(struct xkb_state *state, xkb_keycode_t kc) { const xkb_keysym_t *syms; @@ -1112,7 +1112,7 @@ get_one_sym_for_string(struct xkb_state *state, xkb_keycode_t kc) return sym; } -XKB_EXPORT int +int xkb_state_key_get_utf8(struct xkb_state *state, xkb_keycode_t kc, char *buffer, size_t size) { @@ -1167,7 +1167,7 @@ xkb_state_key_get_utf8(struct xkb_state *state, xkb_keycode_t kc, return 0; } -XKB_EXPORT uint32_t +uint32_t xkb_state_key_get_utf32(struct xkb_state *state, xkb_keycode_t kc) { xkb_keysym_t sym; @@ -1186,7 +1186,7 @@ xkb_state_key_get_utf32(struct xkb_state *state, xkb_keycode_t kc) * Serialises the requested modifier state into an xkb_mod_mask_t, with all * the same disclaimers as in xkb_state_update_mask. */ -XKB_EXPORT xkb_mod_mask_t +xkb_mod_mask_t xkb_state_serialize_mods(struct xkb_state *state, enum xkb_state_component type) { @@ -1209,7 +1209,7 @@ xkb_state_serialize_mods(struct xkb_state *state, * Serialises the requested group state, with all the same disclaimers as * in xkb_state_update_mask. */ -XKB_EXPORT xkb_layout_index_t +xkb_layout_index_t xkb_state_serialize_layout(struct xkb_state *state, enum xkb_state_component type) { @@ -1265,7 +1265,7 @@ mod_mapping(struct xkb_mod *mod, xkb_mod_index_t idx) * Returns 1 if the given modifier is active with the specified type(s), 0 if * not, or -1 if the modifier is invalid. */ -XKB_EXPORT int +int xkb_state_mod_index_is_active(struct xkb_state *state, xkb_mod_index_t idx, enum xkb_state_component type) @@ -1307,7 +1307,7 @@ match_mod_masks(struct xkb_state *state, * Returns 1 if the modifiers are active with the specified type(s), 0 if * not, or -1 if any of the modifiers are invalid. */ -XKB_EXPORT int +int xkb_state_mod_indices_are_active(struct xkb_state *state, enum xkb_state_component type, enum xkb_state_match match, @@ -1346,7 +1346,7 @@ xkb_state_mod_indices_are_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. */ -XKB_EXPORT int +int xkb_state_mod_name_is_active(struct xkb_state *state, const char *name, enum xkb_state_component type) { @@ -1362,7 +1362,7 @@ xkb_state_mod_name_is_active(struct xkb_state *state, const char *name, * Returns 1 if the modifiers are active with the specified type(s), 0 if * not, or -1 if any of the modifiers are invalid. */ -XKB_EXPORT ATTR_NULL_SENTINEL int +ATTR_NULL_SENTINEL int xkb_state_mod_names_are_active(struct xkb_state *state, enum xkb_state_component type, enum xkb_state_match match, @@ -1402,7 +1402,7 @@ xkb_state_mod_names_are_active(struct xkb_state *state, * Returns 1 if the given group is active with the specified type(s), 0 if * not, or -1 if the group is invalid. */ -XKB_EXPORT int +int xkb_state_layout_index_is_active(struct xkb_state *state, xkb_layout_index_t idx, enum xkb_state_component type) @@ -1428,7 +1428,7 @@ xkb_state_layout_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. */ -XKB_EXPORT int +int xkb_state_layout_name_is_active(struct xkb_state *state, const char *name, enum xkb_state_component type) { @@ -1443,7 +1443,7 @@ xkb_state_layout_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. */ -XKB_EXPORT int +int xkb_state_led_index_is_active(struct xkb_state *state, xkb_led_index_t idx) { if (idx >= state->keymap->num_leds || @@ -1456,7 +1456,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. */ -XKB_EXPORT int +int xkb_state_led_name_is_active(struct xkb_state *state, const char *name) { xkb_led_index_t idx = xkb_keymap_led_get_index(state->keymap, name); @@ -1525,7 +1525,7 @@ key_get_consumed(struct xkb_state *state, const struct xkb_key *key, return consumed & ~preserve; } -XKB_EXPORT int +int xkb_state_mod_index_is_consumed2(struct xkb_state *state, xkb_keycode_t kc, xkb_mod_index_t idx, enum xkb_consumed_mode mode) @@ -1543,7 +1543,7 @@ xkb_state_mod_index_is_consumed2(struct xkb_state *state, xkb_keycode_t kc, return !!((mapping & key_get_consumed(state, key, mode)) == mapping); } -XKB_EXPORT int +int xkb_state_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t kc, xkb_mod_index_t idx) { @@ -1551,7 +1551,7 @@ xkb_state_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t kc, XKB_CONSUMED_MODE_XKB); } -XKB_EXPORT xkb_mod_mask_t +xkb_mod_mask_t xkb_state_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t kc, xkb_mod_mask_t mask) { @@ -1564,7 +1564,7 @@ xkb_state_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t kc, ~key_get_consumed(state, key, XKB_CONSUMED_MODE_XKB); } -XKB_EXPORT xkb_mod_mask_t +xkb_mod_mask_t xkb_state_key_get_consumed_mods2(struct xkb_state *state, xkb_keycode_t kc, enum xkb_consumed_mode mode) { @@ -1587,7 +1587,7 @@ xkb_state_key_get_consumed_mods2(struct xkb_state *state, xkb_keycode_t kc, return key_get_consumed(state, key, mode); } -XKB_EXPORT xkb_mod_mask_t +xkb_mod_mask_t xkb_state_key_get_consumed_mods(struct xkb_state *state, xkb_keycode_t kc) { return xkb_state_key_get_consumed_mods2(state, kc, XKB_CONSUMED_MODE_XKB); diff --git a/src/utf8.c b/src/utf8.c index c6f4adb3b..b7ab0425f 100644 --- a/src/utf8.c +++ b/src/utf8.c @@ -8,6 +8,7 @@ #include "config.h" +#include "utils.h" #include "utf8.h" /* Conformant encoding form conversion from UTF-32 to UTF-8. diff --git a/src/utf8.h b/src/utf8.h index e490bb9f3..54da07ae6 100644 --- a/src/utf8.h +++ b/src/utf8.h @@ -11,8 +11,10 @@ #include #include -int +#include "utils.h" + +XKB_EXPORT_PRIVATE int utf32_to_utf8(uint32_t unichar, char *buffer); -bool +XKB_EXPORT_PRIVATE bool is_valid_utf8(const char *ss, size_t len); diff --git a/src/utils-paths.h b/src/utils-paths.h index 22890281e..c4d1a1290 100644 --- a/src/utils-paths.h +++ b/src/utils-paths.h @@ -16,5 +16,5 @@ #define is_path_separator(s) ((s) == PATH_SEPARATOR) #endif -bool +XKB_EXPORT_PRIVATE bool is_absolute(const char *path); diff --git a/src/utils.h b/src/utils.h index 920ec00dd..99be496b9 100644 --- a/src/utils.h +++ b/src/utils.h @@ -265,10 +265,17 @@ open_file(const char *path); /* Compiler Attributes */ -#if defined(__GNUC__) && !defined(__CYGWIN__) -# define XKB_EXPORT __attribute__((visibility("default"))) +/* Private functions only exposed in tests. */ +#ifdef ENABLE_PRIVATE_APIS +# if defined(__GNUC__) && !defined(__CYGWIN__) +# define XKB_EXPORT_PRIVATE __attribute__((visibility("default"))) +# elif defined(_WIN32) +# define XKB_EXPORT_PRIVATE __declspec(dllexport) +# else +# define XKB_EXPORT_PRIVATE +# endif #else -# define XKB_EXPORT +# define XKB_EXPORT_PRIVATE #endif #if defined(__MINGW32__) @@ -304,10 +311,10 @@ open_file(const char *path); #endif #if !(defined(HAVE_ASPRINTF) && HAVE_ASPRINTF) -int asprintf(char **strp, const char *fmt, ...) ATTR_PRINTF(2, 3); +XKB_EXPORT_PRIVATE int asprintf(char **strp, const char *fmt, ...) ATTR_PRINTF(2, 3); # if !(defined(HAVE_VASPRINTF) && HAVE_VASPRINTF) # include -int vasprintf(char **strp, const char *fmt, va_list ap); +XKB_EXPORT_PRIVATE int vasprintf(char **strp, const char *fmt, va_list ap); # endif /* !HAVE_VASPRINTF */ #endif /* !HAVE_ASPRINTF */ diff --git a/src/x11/keymap.c b/src/x11/keymap.c index 7e932f3ff..f59a74305 100644 --- a/src/x11/keymap.c +++ b/src/x11/keymap.c @@ -1140,7 +1140,7 @@ get_controls(struct xkb_keymap *keymap, xcb_connection_t *conn, return false; } -XKB_EXPORT struct xkb_keymap * +struct xkb_keymap * xkb_x11_keymap_new_from_device(struct xkb_context *ctx, xcb_connection_t *conn, int32_t device_id, diff --git a/src/x11/state.c b/src/x11/state.c index 36068ede3..d1ea16c67 100644 --- a/src/x11/state.c +++ b/src/x11/state.c @@ -31,7 +31,7 @@ update_initial_state(struct xkb_state *state, xcb_connection_t *conn, return true; } -XKB_EXPORT struct xkb_state * +struct xkb_state * xkb_x11_state_new_from_device(struct xkb_keymap *keymap, xcb_connection_t *conn, int32_t device_id) { diff --git a/src/x11/util.c b/src/x11/util.c index 9e2f8ab23..b953e18a7 100644 --- a/src/x11/util.c +++ b/src/x11/util.c @@ -7,7 +7,7 @@ #include "x11-priv.h" -XKB_EXPORT int +int xkb_x11_setup_xkb_extension(xcb_connection_t *conn, uint16_t major_xkb_version, uint16_t minor_xkb_version, @@ -88,7 +88,7 @@ xkb_x11_setup_xkb_extension(xcb_connection_t *conn, return 1; } -XKB_EXPORT int32_t +int32_t xkb_x11_get_core_keyboard_device_id(xcb_connection_t *conn) { int32_t device_id; diff --git a/src/xkbcomp/rules.h b/src/xkbcomp/rules.h index bd090d094..b34456240 100644 --- a/src/xkbcomp/rules.h +++ b/src/xkbcomp/rules.h @@ -8,7 +8,7 @@ #include "xkbcomp-priv.h" -bool +XKB_EXPORT_PRIVATE bool xkb_components_from_rules(struct xkb_context *ctx, const struct xkb_rule_names *rmlvo, struct xkb_component_names *out, diff --git a/test/compose-iter.c b/test/compose-iter.c index 2391b686f..9f312049f 100644 --- a/test/compose-iter.c +++ b/test/compose-iter.c @@ -47,7 +47,7 @@ for_each_helper(struct xkb_compose_table *table, for_each_helper(table, iter, data, syms, nsyms, node->hikid); } -XKB_EXPORT void +void xkb_compose_table_for_each(struct xkb_compose_table *table, xkb_compose_table_iter_t iter, void *data) diff --git a/test/symbols-leak-test.py b/test/symbols-leak-test.py index 6915780d1..ba8e879de 100755 --- a/test/symbols-leak-test.py +++ b/test/symbols-leak-test.py @@ -19,7 +19,7 @@ def symbols_from_map(path): def symbols_from_src(path): - return re.findall(r"XKB_EXPORT.*\n(xkb_.*)\(", path.read_text("utf-8")) + return re.findall(r"\bXKB_EXPORT\b.*\n(xkb_.*)\(", path.read_text("utf-8")) def diff(map_path, src_paths): @@ -34,9 +34,8 @@ def diff(map_path, src_paths): left, right = diff( top_srcdir / "xkbcommon.map", [ - *(top_srcdir / "src").glob("*.c"), - *(top_srcdir / "src" / "xkbcomp").glob("*.c"), - *(top_srcdir / "src" / "compose").glob("*.c"), + top_srcdir / "include/xkbcommon/xkbcommon.h", + top_srcdir / "include/xkbcommon/xkbcommon-compose.h", ], ) if left: @@ -50,7 +49,7 @@ def diff(map_path, src_paths): left, right = diff( top_srcdir / "xkbcommon-x11.map", [ - *(top_srcdir / "src" / "x11").glob("*.c"), + top_srcdir / "include/xkbcommon/xkbcommon-x11.h", ], ) if left: diff --git a/test/test.h b/test/test.h index fe0753b96..854ff6838 100644 --- a/test/test.h +++ b/test/test.h @@ -7,6 +7,7 @@ #pragma once #include +#include /* Don't use compat names in internal code. */ #define _XKBCOMMON_COMPAT_H diff --git a/tools/tools-common.c b/tools/tools-common.c index d34805c3b..4fbc0588b 100644 --- a/tools/tools-common.c +++ b/tools/tools-common.c @@ -21,6 +21,7 @@ #ifdef _WIN32 #include #include +#include #else #include #include @@ -31,6 +32,10 @@ #include "src/keysym.h" #include "src/compose/parser.h" +#ifdef _WIN32 +#define S_ISFIFO(mode) 0 +#endif + static void print_keycode(struct xkb_keymap *keymap, const char* prefix, xkb_keycode_t keycode, const char *suffix) {