diff options
author | Ran Benita <ran234@gmail.com> | 2012-10-11 16:54:17 +0200 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2012-10-11 16:54:17 +0200 |
commit | bbf388ec1f632f648b0e1323fe90c251c0425bf7 (patch) | |
tree | c71d8425c76d7323e6acd9f11ef873cd73130e4a /xkbcommon | |
parent | b6ddd105686aaa7accb63d5fe9c228cc4d7b1db0 (diff) |
Make xkb_keymap_num_leds return the index range instead of active count
Currently xkb_keymap_num_leds() returns a count of valid (settable)
leds. Because the indexes might be non-consecutive, and some leds
might not be settable, it is incorrect to use this function for
iterating over the leds in the keymap. But this is the main use case of
this function, so instead of the current behavior we adapt the function
to the use case by making it return the needed range of iteration.
The caller needs to handle invalid intermittent indexes, though.
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'xkbcommon')
-rw-r--r-- | xkbcommon/xkbcommon.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h index a6b0fa8..6d196aa 100644 --- a/xkbcommon/xkbcommon.h +++ b/xkbcommon/xkbcommon.h @@ -641,6 +641,10 @@ xkb_keymap_num_levels_for_key(struct xkb_keymap *keymap, xkb_keycode_t key, /** * Returns the number of LEDs in the given map. + * Note that LED indexes are not necessarily consecutive in the keymap. + * This means that some LEDs in the range between 0 and the return value + * might not be valid. Given such an index, xkb_keymap_led_get_name() + * will return NULL, and xkb_state_led_index_is_active() will return -1. */ xkb_led_index_t xkb_keymap_num_leds(struct xkb_keymap *keymap); |