static union xkb_action *
xkb_key_get_action(struct xkb_state *state, xkb_keycode_t kc)
{
- unsigned int group, level;
+ xkb_group_index_t group;
+ unsigned int level;
+ struct xkb_key *key = NULL;
- if (!XkbKeyHasActions(state->keymap, kc) ||
- !XkbKeycodeInRange(state->keymap, kc)) {
+ if (XkbKeycodeInRange(state->keymap, kc))
+ key = XkbKey(state->keymap, kc);
+
+ if (!key || !XkbKeyHasActions(key)) {
static union xkb_action fake;
memset(&fake, 0, sizeof(fake));
fake.type = XkbSA_NoAction;
group = xkb_key_get_group(state, kc);
level = xkb_key_get_level(state, kc, group);
- return XkbKeyActionEntry(state->keymap, kc, group, level);
+ return XkbKeyActionEntry(state->keymap, key, group, level);
}
static struct xkb_filter *
return;
}
-_X_EXPORT struct xkb_state *
+XKB_EXPORT struct xkb_state *
xkb_state_new(struct xkb_keymap *keymap)
{
struct xkb_state *ret;
return ret;
}
-_X_EXPORT struct xkb_state *
+XKB_EXPORT struct xkb_state *
xkb_state_ref(struct xkb_state *state)
{
state->refcnt++;
return state;
}
-_X_EXPORT void
+XKB_EXPORT void
xkb_state_unref(struct xkb_state *state)
{
state->refcnt--;
free(state);
}
-_X_EXPORT struct xkb_keymap *
+XKB_EXPORT struct xkb_keymap *
xkb_state_get_map(struct xkb_state *state)
{
return state->keymap;
* Given a particular key event, updates the state structure to reflect the
* new modifiers.
*/
-_X_EXPORT void
+XKB_EXPORT void
xkb_state_update_key(struct xkb_state *state, xkb_keycode_t kc,
enum xkb_key_direction direction)
{
* lossy, and should only be used to update a slave state mirroring the
* master, e.g. in a client/server window system.
*/
-_X_EXPORT void
+XKB_EXPORT void
xkb_state_update_mask(struct xkb_state *state,
xkb_mod_mask_t base_mods,
xkb_mod_mask_t latched_mods,
* Serialises the requested modifier state into an xkb_mod_mask_t, with all
* the same disclaimers as in xkb_state_update_mask.
*/
-_X_EXPORT xkb_mod_mask_t
+XKB_EXPORT xkb_mod_mask_t
xkb_state_serialize_mods(struct xkb_state *state,
enum xkb_state_component type)
{
* Serialises the requested group state, with all the same disclaimers as
* in xkb_state_update_mask.
*/
-_X_EXPORT xkb_group_index_t
+XKB_EXPORT xkb_group_index_t
xkb_state_serialize_group(struct xkb_state *state,
enum xkb_state_component type)
{
* Returns 1 if the given modifier is active with the specified type(s), 0 if
* not, or -1 if the modifier is invalid.
*/
-_X_EXPORT int
+XKB_EXPORT int
xkb_state_mod_index_is_active(struct xkb_state *state,
xkb_mod_index_t idx,
enum xkb_state_component type)
* Returns 1 if the modifiers are active with the specified type(s), 0 if
* not, or -1 if any of the modifiers are invalid.
*/
-_X_EXPORT int
+XKB_EXPORT int
xkb_state_mod_indices_are_active(struct xkb_state *state,
enum xkb_state_component type,
enum xkb_state_match match,
* Returns 1 if the given modifier is active with the specified type(s), 0 if
* not, or -1 if the modifier is invalid.
*/
-_X_EXPORT int
+XKB_EXPORT int
xkb_state_mod_name_is_active(struct xkb_state *state, const char *name,
enum xkb_state_component type)
{
* Returns 1 if the modifiers are active with the specified type(s), 0 if
* not, or -1 if any of the modifiers are invalid.
*/
-_X_EXPORT int
+XKB_EXPORT int
xkb_state_mod_names_are_active(struct xkb_state *state,
enum xkb_state_component type,
enum xkb_state_match match,
* Returns 1 if the given group is active with the specified type(s), 0 if
* not, or -1 if the group is invalid.
*/
-_X_EXPORT int
+XKB_EXPORT int
xkb_state_group_index_is_active(struct xkb_state *state,
xkb_group_index_t idx,
enum xkb_state_component type)
* Returns 1 if the given modifier is active with the specified type(s), 0 if
* not, or -1 if the modifier is invalid.
*/
-_X_EXPORT int
+XKB_EXPORT int
xkb_state_group_name_is_active(struct xkb_state *state, const char *name,
enum xkb_state_component type)
{
/**
* Returns 1 if the given LED is active, 0 if not, or -1 if the LED is invalid.
*/
-_X_EXPORT int
+XKB_EXPORT int
xkb_state_led_index_is_active(struct xkb_state *state, xkb_led_index_t idx)
{
if (idx >= xkb_map_num_leds(state->keymap))
/**
* Returns 1 if the given LED is active, 0 if not, or -1 if the LED is invalid.
*/
-_X_EXPORT int
+XKB_EXPORT int
xkb_state_led_name_is_active(struct xkb_state *state, const char *name)
{
xkb_led_index_t idx = xkb_map_led_get_index(state->keymap, name);