summaryrefslogtreecommitdiff
path: root/xkbcommon
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-08-30 12:13:37 +0300
committerRan Benita <ran234@gmail.com>2012-09-02 19:17:09 +0300
commit06d7803a6d0f7dbcdb098d8e00122c097d40b80d (patch)
treea1fb53d4cc9f76899af2b2b9746625539788b61a /xkbcommon
parent9f0c01606346e63861b52bfc7ed8cff964cf9699 (diff)
state: fix mod_names_are_active
This function was always returning -1. Adding a test, we see that test/state.c treat the is_active functions as returning booleans, which would treat -1 as success, so we test for > 0 instead (most users would probably get this wrong as well...). Also update the documentation for the are_active functions, and add a ATTR_NULL_SENTINEL for gcc __attribute__((sentinel)). Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'xkbcommon')
-rw-r--r--xkbcommon/xkbcommon.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h
index 0c2f06f..9fc6c7b 100644
--- a/xkbcommon/xkbcommon.h
+++ b/xkbcommon/xkbcommon.h
@@ -626,10 +626,10 @@ xkb_state_mod_name_is_active(struct xkb_state *state, const char *name,
enum xkb_state_component type);
/**
- * Returns 1 if the modifiers specified by the varargs (treated as
- * NULL-terminated pointers to strings) are active in the manner
- * specified by 'match', 0 otherwise, or -1 if any of the modifiers
- * do not exist in the map.
+ * Returns 1 if the modifiers specified by the varargs (NULL-terminated
+ * strings, with a NULL sentinel) are active in the manner specified by
+ * 'match', 0 otherwise, or -1 if any of the modifiers do not exist in
+ * the map.
*/
int
xkb_state_mod_names_are_active(struct xkb_state *state,
@@ -647,6 +647,18 @@ xkb_state_mod_index_is_active(struct xkb_state *state, xkb_mod_index_t idx,
enum xkb_state_component type);
/**
+ * Returns 1 if the modifiers specified by the varargs (of type
+ * xkb_mod_index_t, with a XKB_MOD_INVALID sentinel) are active in the
+ * manner specified by 'match' and 'type', 0 otherwise, or -1 if any of
+ * the modifiers do not exist in the map.
+ */
+int
+xkb_state_mod_indices_are_active(struct xkb_state *state,
+ enum xkb_state_component type,
+ enum xkb_state_match match,
+ ...);
+
+/**
* 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.
@@ -666,18 +678,6 @@ xkb_key_mod_mask_remove_consumed(struct xkb_state *state, xkb_keycode_t key,
xkb_mod_mask_t mask);
/**
- * Returns 1 if the modifiers specified by the varargs (treated as
- * xkb_mod_index_t, terminated with XKB_MOD_INVALID) are active in the manner
- * specified by 'match' and 'type', 0 otherwise, or -1 if the modifier does not
- * exist in the current map.
- */
-int
-xkb_state_mod_indices_are_active(struct xkb_state *state,
- enum xkb_state_component type,
- enum xkb_state_match match,
- ...);
-
-/**
* Returns 1 if the group specified by 'name' is active in the manner
* specified by 'type', 0 if it is unset, or -1 if the group does not
* exist in the current map.