summaryrefslogtreecommitdiff
path: root/xkbcommon
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2012-09-12 19:55:06 +0100
committerDaniel Stone <daniel@fooishbar.org>2012-09-20 23:30:23 +1000
commit33a66515d6bd28b4c2f31ecfc1c51f8b45b034e8 (patch)
treeb7151302f3e1016b75b3fd6ecf0fbebb07479d69 /xkbcommon
parent005dee2bb6d0c7c6927eda1a1173ccd9b68b8754 (diff)
API change: Rename xkb_map_* and group -> layout
Move xkb_map_* functions to xkb_keymap_*, xkb_key_* functions under either xkb_keymap or xkb_state, and rename groups to layout in all user-visible API. Backwards-compatible hooks are provided, such that old source will build, but silently mangled to the new names, and old binaries will also continue to work. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'xkbcommon')
-rw-r--r--xkbcommon/xkbcommon-compat.h54
-rw-r--r--xkbcommon/xkbcommon.h103
2 files changed, 105 insertions, 52 deletions
diff --git a/xkbcommon/xkbcommon-compat.h b/xkbcommon/xkbcommon-compat.h
index f258651..2cd764f 100644
--- a/xkbcommon/xkbcommon-compat.h
+++ b/xkbcommon/xkbcommon-compat.h
@@ -26,4 +26,58 @@
#ifndef _XKBCOMMON_COMPAT_H
#define _XKBCOMMON_COMPAT_H
+/**
+ * Renamed keymap API.
+ */
+#define xkb_group_index_t xkb_layout_index_t
+#define xkb_group_mask_t xkb_layout_mask_t
+#define xkb_map_compile_flags xkb_keymap_compile_flags
+#define XKB_GROUP_INVALID XKB_LAYOUT_INVALID
+
+#define xkb_map_new_from_names(context, names, flags) \
+ xkb_keymap_new_from_names(context, names, flags)
+#define xkb_map_new_from_file(context, file, format, flags) \
+ xkb_keymap_new_from_file(context, file, format, flags)
+#define xkb_map_new_from_string(context, string, format, flags) \
+ xkb_keymap_new_from_string(context, string, format, flags)
+#define xkb_map_get_as_string(keymap) xkb_keymap_get_as_string(keymap)
+#define xkb_map_ref(keymap) xkb_keymap_ref(keymap)
+#define xkb_map_unref(keymap) xkb_keymap_unref(keymap)
+
+#define xkb_map_num_mods(keymap) xkb_keymap_num_mods(keymap)
+#define xkb_map_mod_get_name(keymap, idx) xkb_keymap_mod_get_name(keymap, idx)
+#define xkb_map_mod_get_index(keymap, str) xkb_keymap_mod_get_index(keymap, str)
+#define xkb_key_mod_index_is_consumed(state, key, mod) \
+ xkb_state_mod_index_is_consumed(state, key, mod)
+#define xkb_key_mod_mask_remove_consumed(state, key, modmask) \
+ xkb_state_mod_mask_remove_consumed(state, key, modmask)
+
+#define xkb_map_num_groups(keymap) xkb_keymap_num_layouts(keymap)
+#define xkb_key_num_groups(keymap, key) \
+ xkb_keymap_num_layouts_for_key(keymap, key)
+#define xkb_map_group_get_name(keymap, idx) \
+ xkb_keymap_layout_get_name(keymap, idx)
+#define xkb_map_group_get_index(keymap, str) \
+ xkb_keymap_layout_get_index(keymap, str)
+
+#define xkb_map_num_leds(keymap) xkb_keymap_num_leds(keymap)
+#define xkb_map_led_get_name(keymap, idx) xkb_keymap_led_get_name(keymap, idx)
+#define xkb_map_led_get_index(keymap, str) \
+ xkb_keymap_led_get_index(keymap, str)
+
+#define xkb_key_repeats(keymap, key) xkb_keymap_key_repeats(keymap, key)
+
+#define xkb_key_get_syms(state, key, syms_out) \
+ xkb_state_key_get_syms(state, key, syms_out)
+
+#define xkb_state_group_name_is_active(state, name, type) \
+ xkb_state_layout_name_is_active(state, name, type)
+#define xkb_state_group_index_is_active(state, idx, type) \
+ xkb_state_layout_index_is_active(state, idx, type)
+
+#define xkb_state_serialize_group(state, component) \
+ xkb_state_serialize_layout(state, component)
+
+#define xkb_state_get_map(state) xkb_state_get_keymap(state)
+
#endif
diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h
index fb5d450..f464c21 100644
--- a/xkbcommon/xkbcommon.h
+++ b/xkbcommon/xkbcommon.h
@@ -91,12 +91,13 @@ typedef uint32_t xkb_keycode_t;
typedef uint32_t xkb_keysym_t;
typedef uint32_t xkb_mod_index_t;
typedef uint32_t xkb_mod_mask_t;
-typedef uint32_t xkb_group_index_t;
-typedef uint32_t xkb_group_mask_t;
+typedef uint32_t xkb_layout_index_t;
+typedef uint32_t xkb_layout_mask_t;
typedef uint32_t xkb_led_index_t;
+typedef uint32_t xkb_led_mask_t;
#define XKB_MOD_INVALID (0xffffffff)
-#define XKB_GROUP_INVALID (0xffffffff)
+#define XKB_LAYOUT_INVALID (0xffffffff)
#define XKB_KEYCODE_INVALID (0xffffffff)
#define XKB_LED_INVALID (0xffffffff)
@@ -341,7 +342,7 @@ xkb_set_user_data(struct xkb_context *context, void *user_data);
* @{
*/
-enum xkb_map_compile_flags {
+enum xkb_keymap_compile_flags {
/** Apparently you can't have empty enums. What a drag. */
XKB_MAP_COMPILE_PLACEHOLDER = 0,
};
@@ -354,9 +355,9 @@ enum xkb_map_compile_flags {
* keymaps.
*/
struct xkb_keymap *
-xkb_map_new_from_names(struct xkb_context *context,
- const struct xkb_rule_names *names,
- enum xkb_map_compile_flags flags);
+xkb_keymap_new_from_names(struct xkb_context *context,
+ const struct xkb_rule_names *names,
+ enum xkb_keymap_compile_flags flags);
enum xkb_keymap_format {
/** The current/classic XKB text format, as generated by xkbcomp -xkb. */
@@ -368,37 +369,37 @@ enum xkb_keymap_format {
* file.
*/
struct xkb_keymap *
-xkb_map_new_from_file(struct xkb_context *context, FILE *file,
- enum xkb_keymap_format format,
- enum xkb_map_compile_flags flags);
+xkb_keymap_new_from_file(struct xkb_context *context, FILE *file,
+ enum xkb_keymap_format format,
+ enum xkb_keymap_compile_flags flags);
/**
* Creates an XKB keymap from a full text XKB keymap serialized into one
* enormous string.
*/
struct xkb_keymap *
-xkb_map_new_from_string(struct xkb_context *context, const char *string,
- enum xkb_keymap_format format,
- enum xkb_map_compile_flags flags);
+xkb_keymap_new_from_string(struct xkb_context *context, const char *string,
+ enum xkb_keymap_format format,
+ enum xkb_keymap_compile_flags flags);
/**
* Returns the compiled XKB map as a string which can later be fed back into
* xkb_map_new_from_string to return the exact same keymap.
*/
char *
-xkb_map_get_as_string(struct xkb_keymap *keymap);
+xkb_keymap_get_as_string(struct xkb_keymap *keymap);
/**
* Takes a new reference on a keymap.
*/
struct xkb_keymap *
-xkb_map_ref(struct xkb_keymap *keymap);
+xkb_keymap_ref(struct xkb_keymap *keymap);
/**
* Releases a reference on a keymap.
*/
void
-xkb_map_unref(struct xkb_keymap *keymap);
+xkb_keymap_unref(struct xkb_keymap *keymap);
/** @} */
@@ -414,67 +415,67 @@ xkb_map_unref(struct xkb_keymap *keymap);
* Returns the number of modifiers active in the keymap.
*/
xkb_mod_index_t
-xkb_map_num_mods(struct xkb_keymap *keymap);
+xkb_keymap_num_mods(struct xkb_keymap *keymap);
/**
* Returns the name of the modifier specified by 'idx', or NULL if invalid.
*/
const char *
-xkb_map_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx);
+xkb_keymap_mod_get_name(struct xkb_keymap *keymap, xkb_mod_index_t idx);
/**
* Returns the index of the modifier specified by 'name', or XKB_MOD_INVALID.
*/
xkb_mod_index_t
-xkb_map_mod_get_index(struct xkb_keymap *keymap, const char *name);
+xkb_keymap_mod_get_index(struct xkb_keymap *keymap, const char *name);
/**
* Returns the number of groups active in the keymap.
*/
-xkb_group_index_t
-xkb_map_num_groups(struct xkb_keymap *keymap);
+xkb_layout_index_t
+xkb_keymap_num_layouts(struct xkb_keymap *keymap);
/**
* Returns the name of the group specified by 'idx', or NULL if invalid.
*/
const char *
-xkb_map_group_get_name(struct xkb_keymap *keymap, xkb_group_index_t idx);
+xkb_keymap_layout_get_name(struct xkb_keymap *keymap, xkb_layout_index_t idx);
/**
- * Returns the index of the group specified by 'name', or XKB_GROUP_INVALID.
+ * Returns the index of the layout specified by 'name', or XKB_LAYOUT_INVALID.
*/
-xkb_group_index_t
-xkb_map_group_get_index(struct xkb_keymap *keymap, const char *name);
+xkb_layout_index_t
+xkb_keymap_layout_get_index(struct xkb_keymap *keymap, const char *name);
/**
- * Returns the number of groups active for the specified key.
+ * Returns the number of layouts active for the specified key.
*/
-xkb_group_index_t
-xkb_key_num_groups(struct xkb_keymap *keymap, xkb_keycode_t key);
+xkb_layout_index_t
+xkb_keymap_num_layouts_for_key(struct xkb_keymap *keymap, xkb_keycode_t key);
/**
* Returns 1 if the key should repeat, or 0 otherwise.
*/
int
-xkb_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key);
+xkb_keymap_key_repeats(struct xkb_keymap *keymap, xkb_keycode_t key);
/**
* Returns the number of LEDs in the given map.
*/
xkb_led_index_t
-xkb_map_num_leds(struct xkb_keymap *keymap);
+xkb_keymap_num_leds(struct xkb_keymap *keymap);
/**
* Returns the name of the LED specified by 'idx', or NULL if invalid.
*/
const char *
-xkb_map_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx);
+xkb_keymap_led_get_name(struct xkb_keymap *keymap, xkb_led_index_t idx);
/**
* Returns the index of the LED specified by 'name', or XKB_LED_INVALID.
*/
xkb_led_index_t
-xkb_map_led_get_index(struct xkb_keymap *keymap, const char *name);
+xkb_keymap_led_get_index(struct xkb_keymap *keymap, const char *name);
/** @} */
@@ -512,7 +513,7 @@ xkb_state_unref(struct xkb_state *state);
* if you plan to use it beyond the lifetime of the state.
*/
struct xkb_keymap *
-xkb_state_get_map(struct xkb_state *state);
+xkb_state_get_keymap(struct xkb_state *state);
enum xkb_key_direction {
XKB_KEY_UP,
@@ -532,12 +533,10 @@ xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
* return value being the number of symbols in *syms_out. If the return
* value is 0, *syms_out will be set to NULL, as there are no symbols produced
* by this event.
- *
- * This should be called before xkb_state_update_key.
*/
int
-xkb_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
- const xkb_keysym_t **syms_out);
+xkb_state_key_get_syms(struct xkb_state *state, xkb_keycode_t key,
+ const xkb_keysym_t **syms_out);
/**
* Modifier and group types for state objects. This enum is bitmaskable,
@@ -593,9 +592,9 @@ enum xkb_state_match {
void
xkb_state_update_mask(struct xkb_state *state, xkb_mod_mask_t base_mods,
xkb_mod_mask_t latched_mods, xkb_mod_mask_t locked_mods,
- xkb_group_index_t base_group,
- xkb_group_index_t latched_group,
- xkb_group_index_t locked_group);
+ xkb_layout_index_t base_group,
+ xkb_layout_index_t latched_group,
+ xkb_layout_index_t locked_group);
/**
* The counterpart to xkb_state_update_mask, to be used on the server side
@@ -615,9 +614,9 @@ xkb_state_serialize_mods(struct xkb_state *state,
* The group equivalent of xkb_state_serialize_mods: please see its
* documentation.
*/
-xkb_group_index_t
-xkb_state_serialize_group(struct xkb_state *state,
- enum xkb_state_component component);
+xkb_layout_index_t
+xkb_state_serialize_layout(struct xkb_state *state,
+ enum xkb_state_component component);
/**
* Returns 1 if the modifier specified by 'name' is active in the manner
@@ -668,8 +667,8 @@ xkb_state_mod_indices_are_active(struct xkb_state *state,
* Returns 0 otherwise.
*/
int
-xkb_key_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key,
- xkb_mod_index_t idx);
+xkb_state_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key,
+ xkb_mod_index_t idx);
/**
* Takes the given modifier mask, and removes all modifiers which are
@@ -677,8 +676,8 @@ xkb_key_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key,
* for that particular key.
*/
xkb_mod_mask_t
-xkb_key_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key,
- xkb_mod_mask_t mask);
+xkb_state_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key,
+ xkb_mod_mask_t mask);
/**
* Returns 1 if the group specified by 'name' is active in the manner
@@ -686,8 +685,8 @@ xkb_key_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key,
* exist in the current map.
*/
int
-xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
- enum xkb_state_component type);
+xkb_state_layout_name_is_active(struct xkb_state *state, const char *name,
+ enum xkb_state_component type);
/**
* Returns 1 if the group specified by 'idx' is active in the manner
@@ -695,9 +694,9 @@ xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
* exist in the current map.
*/
int
-xkb_state_group_index_is_active(struct xkb_state *state,
- xkb_group_index_t idx,
- enum xkb_state_component type);
+xkb_state_layout_index_is_active(struct xkb_state *state,
+ xkb_layout_index_t idx,
+ enum xkb_state_component type);
/**
* Returns 1 if the LED specified by 'name' is active, 0 if it is unset, or