Like all the other functions.
Signed-off-by: Ran Benita <ran234@gmail.com>
{
const struct xkb_key *key = XkbKey(state->keymap, kc);
- if (!key)
- return 0;
+ if (!key || idx >= xkb_keymap_num_mods(state->keymap))
+ return -1;
return !!((1 << idx) & key_get_consumed(state, key));
}
/**
* Returns 1 if the modifier specified by 'idx' is used in the
* translation of the keycode 'key' to the key symbols obtained by
- * pressing it (as in xkb_key_get_syms), given the current state.
- * Returns 0 otherwise.
+ * pressing it (as in xkb_state_key_get_syms), given the current state,
+ * 0 otherwise, or -1 if the index is invalid in the keymap.
*/
int
xkb_state_mod_index_is_consumed(struct xkb_state *state, xkb_keycode_t key,