summaryrefslogtreecommitdiff
path: root/src/state.c
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2014-02-21 18:09:00 -0500
committerRan Benita <ran234@gmail.com>2014-02-22 02:23:37 +0200
commit4fb7b06b0f91bd720603f9fdab458695c6cd8932 (patch)
treec4e243dac832e174bb996da2e2cfb23abfca56dc /src/state.c
parent1fa7d6d3ab5b10e5b399f190245248ec50c94af7 (diff)
downloadxorg-lib-libxkbcommon-4fb7b06b0f91bd720603f9fdab458695c6cd8932.tar.gz
state: Add xkb_state_key_get_consumed_mods
This retrieves the mask of consumed modifiers for a given key and state, which is helpful for toolkits without having them to do it one modifier at a time, or pass in 0xFFFFFFFF to xkb_state_remove_consumed_mods to "reverse-engineer" the consumed mods.
Diffstat (limited to 'src/state.c')
-rw-r--r--src/state.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/state.c b/src/state.c
index 8b1a526..f409a3e 100644
--- a/src/state.c
+++ b/src/state.c
@@ -1169,3 +1169,14 @@ xkb_state_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t kc,
return mask & ~key_get_consumed(state, key);
}
+
+XKB_EXPORT xkb_mod_mask_t
+xkb_state_key_get_consumed_mods(struct xkb_state *state, xkb_keycode_t kc)
+{
+ const struct xkb_key *key = XkbKey(state->keymap, kc);
+
+ if (!key)
+ return 0;
+
+ return key_get_consumed(state, key);
+}