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.
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);
+}
mask);
assert(mask == (1U << alt));
+ mask = xkb_state_key_get_consumed_mods(state, KEY_EQUAL + EVDEV_OFFSET);
+ assert(mask == (1U << shift));
+
xkb_state_unref(state);
}
* index is not valid in the keymap, returns -1.
*
* @sa xkb_state_mod_mask_remove_consumed()
+ * @sa xkb_state_key_get_consumed_mods()
* @memberof xkb_state
*/
int
xkb_mod_mask_t mask);
/**
+ * Get the mask of modifiers consumed by translating a given key.
+ *
+ * @returns a mask of the consumed modifiers.
+ *
+ * @sa xkb_state_mod_index_is_consumed()
+ * @memberof xkb_state
+ */
+xkb_mod_mask_t
+xkb_state_key_get_consumed_mods(struct xkb_state *state, xkb_keycode_t key);
+
+/**
* Test whether a layout is active in a given keyboard state by name.
*
* @returns 1 if the layout is active, 0 if it is not. If no layout with