summaryrefslogtreecommitdiff
path: root/xkbcommon
diff options
context:
space:
mode:
Diffstat (limited to 'xkbcommon')
-rw-r--r--xkbcommon/xkbcommon.h84
1 files changed, 45 insertions, 39 deletions
diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h
index 846b619..e9b324f 100644
--- a/xkbcommon/xkbcommon.h
+++ b/xkbcommon/xkbcommon.h
@@ -965,14 +965,49 @@ enum xkb_key_direction {
};
/**
+ * Modifier and layout types for state objects. This enum is bitmaskable,
+ * e.g. (XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED) is valid to
+ * exclude locked modifiers.
+ *
+ * In XKB, the DEPRESSED states are also known as 'base'.
+ */
+enum xkb_state_component {
+ /** Depressed modifiers, i.e. a key is physically holding them. */
+ XKB_STATE_MODS_DEPRESSED = (1 << 0),
+ /** Latched modifiers, i.e. will be unset after the next non-modifier
+ * key press. */
+ XKB_STATE_MODS_LATCHED = (1 << 1),
+ /** Locked modifiers, i.e. will be unset after the key provoking the
+ * lock has been pressed again. */
+ XKB_STATE_MODS_LOCKED = (1 << 2),
+ /** Effective modifiers, i.e. currently active and affect key
+ * processing (derived from the other state components). */
+ XKB_STATE_MODS_EFFECTIVE = (1 << 3),
+ /** Depressed layout, i.e. a key is physically holding it. */
+ XKB_STATE_LAYOUT_DEPRESSED = (1 << 4),
+ /** Latched layout, i.e. will be unset after the next non-modifier
+ * key press. */
+ XKB_STATE_LAYOUT_LATCHED = (1 << 5),
+ /** Locked layout, i.e. will be unset after the key provoking the lock
+ * has been pressed again. */
+ XKB_STATE_LAYOUT_LOCKED = (1 << 6),
+ /** Effective layout, i.e. currently active and affects key processing
+ * (derived from the other state components). */
+ XKB_STATE_LAYOUT_EFFECTIVE = (1 << 7),
+ /** LEDs (derived from the other state components). */
+ XKB_STATE_LEDS = (1 << 8),
+};
+
+/**
* Update the keyboard state to reflect a given key being pressed or
* released.
*
- * @todo Explain.
+ * @returns A mask of state components that have changed as a result of
+ * the update. If nothing in the state has changed, returns 0.
*
* @memberof xkb_state
*/
-void
+enum xkb_state_component
xkb_state_update_key(struct xkb_state *state, xkb_keycode_t key,
enum xkb_key_direction direction);
@@ -1101,40 +1136,6 @@ xkb_keymap_key_get_syms_by_level(struct xkb_keymap *keymap,
const xkb_keysym_t **syms_out);
/**
- * Modifier and layout types for state objects. This enum is bitmaskable,
- * e.g. (XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED) is valid to
- * exclude locked modifiers.
- *
- * In XKB, the DEPRESSED states are also known as 'base'.
- */
-enum xkb_state_component {
- /** Depressed modifiers, i.e. a key is physically holding them. */
- XKB_STATE_MODS_DEPRESSED = (1 << 0),
- /** Latched modifiers, i.e. will be unset after the next non-modifier
- * key press. */
- XKB_STATE_MODS_LATCHED = (1 << 1),
- /** Locked modifiers, i.e. will be unset after the key provoking the
- * lock has been pressed again. */
- XKB_STATE_MODS_LOCKED = (1 << 2),
- /** Effective modifiers, i.e. currently active and affect key
- * processing (derived from the other state components). */
- XKB_STATE_MODS_EFFECTIVE = (1 << 3),
- /** Depressed layout, i.e. a key is physically holding it. */
- XKB_STATE_LAYOUT_DEPRESSED = (1 << 4),
- /** Latched layout, i.e. will be unset after the next non-modifier
- * key press. */
- XKB_STATE_LAYOUT_LATCHED = (1 << 5),
- /** Locked layout, i.e. will be unset after the key provoking the lock
- * has been pressed again. */
- XKB_STATE_LAYOUT_LOCKED = (1 << 6),
- /** Effective layout, i.e. currently active and affects key processing
- * (derived from the other state components). */
- XKB_STATE_LAYOUT_EFFECTIVE = (1 << 7),
- /** LEDs (derived from the other state components). */
- XKB_STATE_LEDS = (1 << 8),
-};
-
-/**
* Match flags for xkb_state_mod_indices_are_active and
* xkb_state_mod_names_are_active, specifying how the conditions for a
* successful match. XKB_STATE_MATCH_NON_EXCLUSIVE is bitmaskable with
@@ -1167,11 +1168,16 @@ enum xkb_state_match {
*
* Please do not use this unless you fit the description above.
*
+ * @returns A mask of state components that have changed as a result of
+ * the update. If nothing in the state has changed, returns 0.
+ *
* @memberof xkb_state
*/
-void
-xkb_state_update_mask(struct xkb_state *state, xkb_mod_mask_t base_mods,
- xkb_mod_mask_t latched_mods, xkb_mod_mask_t locked_mods,
+enum xkb_state_component
+xkb_state_update_mask(struct xkb_state *state,
+ xkb_mod_mask_t base_mods,
+ xkb_mod_mask_t latched_mods,
+ xkb_mod_mask_t locked_mods,
xkb_layout_index_t base_layout,
xkb_layout_index_t latched_layout,
xkb_layout_index_t locked_layout);