diff options
author | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-02-21 18:09:00 -0500 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2014-02-22 02:23:37 +0200 |
commit | 4fb7b06b0f91bd720603f9fdab458695c6cd8932 (patch) | |
tree | c4e243dac832e174bb996da2e2cfb23abfca56dc /src/state.c | |
parent | 1fa7d6d3ab5b10e5b399f190245248ec50c94af7 (diff) | |
download | xorg-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.c | 11 |
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); +} |