summaryrefslogtreecommitdiff
path: root/xkbcommon
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 /xkbcommon
parent17a956d80781846903c90b7bd4beaf8ac7aac40c (diff)
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 'xkbcommon')
-rw-r--r--xkbcommon/xkbcommon.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h
index a2aecfb..ff2ce68 100644
--- a/xkbcommon/xkbcommon.h
+++ b/xkbcommon/xkbcommon.h
@@ -812,6 +812,46 @@ xkb_keymap_get_as_string(struct xkb_keymap *keymap,
*/
/**
+ * Get the minimum keycode in the keymap.
+ *
+ * @sa xkb_keycode_t
+ * @memberof xkb_keymap
+ */
+xkb_keycode_t
+xkb_keymap_min_keycode(struct xkb_keymap *keymap);
+
+/**
+ * Get the maximum keycode in the keymap.
+ *
+ * @sa xkb_keycode_t
+ * @memberof xkb_keymap
+ */
+xkb_keycode_t
+xkb_keymap_max_keycode(struct xkb_keymap *keymap);
+
+/**
+ * The iterator used by xkb_keymap_key_for_each().
+ *
+ * @sa xkb_keymap_key_for_each
+ * @memberof xkb_keymap
+ */
+typedef void
+(*xkb_keymap_key_iter_t)(struct xkb_keymap *keymap, xkb_keycode_t key,
+ void *data);
+
+/**
+ * Run a specified function for every valid keycode in the keymap. If a
+ * keymap is sparse, this function may be called fewer than
+ * (max_keycode - min_keycode + 1) times.
+ *
+ * @sa xkb_keymap_min_keycode() xkb_keymap_max_keycode() xkb_keycode_t
+ * @memberof xkb_keymap
+ */
+void
+xkb_keymap_key_for_each(struct xkb_keymap *keymap, xkb_keymap_key_iter_t iter,
+ void *data);
+
+/**
* Get the number of modifiers in the keymap.
*
* @sa xkb_mod_index_t