summaryrefslogtreecommitdiff
path: root/src/keymap.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-05-09 15:31:21 +0100
committerDaniel Stone <daniel@fooishbar.org>2013-05-09 15:31:21 +0100
commitb06de3072b46a5108878b8e00f934f01fdb6a0ff (patch)
treefc173b401d3b31731abdddc211e3540f00a58792 /src/keymap.c
parent17a956d80781846903c90b7bd4beaf8ac7aac40c (diff)
downloadlibxkbcommon-b06de3072b46a5108878b8e00f934f01fdb6a0ff.tar.gz
libxkbcommon-b06de3072b46a5108878b8e00f934f01fdb6a0ff.tar.bz2
libxkbcommon-b06de3072b46a5108878b8e00f934f01fdb6a0ff.zip
Add keycode min/max and iteration API
Add three new pieces of API: - xkb_keymap_min_keycode does what it says on the tin - xkb_keymap_max_keycode likewise - xkb_keymap_key_for_each calls the provided function once for every valid key in the keymap Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'src/keymap.c')
-rw-r--r--src/keymap.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/keymap.c b/src/keymap.c
index 55000f4..8205bab 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -484,6 +484,28 @@ err:
return 0;
}
+XKB_EXPORT xkb_keycode_t
+xkb_keymap_min_keycode(struct xkb_keymap *keymap)
+{
+ return keymap->min_key_code;
+}
+
+XKB_EXPORT xkb_keycode_t
+xkb_keymap_max_keycode(struct xkb_keymap *keymap)
+{
+ return keymap->max_key_code;
+}
+
+XKB_EXPORT void
+xkb_keymap_key_for_each(struct xkb_keymap *keymap, xkb_keymap_key_iter_t iter,
+ void *data)
+{
+ struct xkb_key *key;
+
+ xkb_foreach_key(key, keymap)
+ iter(keymap, key->keycode, data);
+}
+
/**
* Simple boolean specifying whether or not the key should repeat.
*/