[PATCH] Add api to obtain min/max keycode

matthias.clasen at gmail.com matthias.clasen at gmail.com
Tue Apr 9 18:57:29 PDT 2013


From: Matthias Clasen <mclasen at redhat.com>

Users of libxkbcommon need these values to iterate over all
keycodes in the keymap.
---
 src/keymap.c          | 12 ++++++++++++
 xkbcommon/xkbcommon.h | 20 ++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/src/keymap.c b/src/keymap.c
index 55000f4..14ec25f 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -484,6 +484,18 @@ err:
     return 0;
 }
 
+XKB_EXPORT xkb_keycode_t
+xkb_keymap_get_min_keycode (struct xkb_keymap *keymap)
+{
+    return keymap->min_key_code;
+}
+
+XKB_EXPORT xkb_keycode_t
+xkb_keymap_get_max_keycode (struct xkb_keymap *keymap)
+{
+    return keymap->max_key_code;
+}
+
 /**
  * Simple boolean specifying whether or not the key should repeat.
  */
diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h
index a2aecfb..412f429 100644
--- a/xkbcommon/xkbcommon.h
+++ b/xkbcommon/xkbcommon.h
@@ -974,6 +974,26 @@ xkb_led_index_t
 xkb_keymap_led_get_index(struct xkb_keymap *keymap, const char *name);
 
 /**
+ * Get the minimum keycode of the keymap
+ *
+ * @returns The minimum keycode of the keymap.
+ *
+ * @memberof xkb_keymap
+ */
+xkb_keycode_t
+xkb_keymap_get_min_keycode (struct xkb_keymap *keymap);
+
+/**
+ * Get the maximum keycode of the keymap
+ *
+ * @returns The maximum keycode of the keymap.
+ *
+ * @memberof xkb_keymap
+ */
+xkb_keycode_t
+xkb_keymap_get_max_keycode (struct xkb_keymap *keymap);
+
+/**
  * Determine whether a key should repeat or not.
  *
  * A keymap may specify different repeat behaviors for different keys.
-- 
1.8.2



More information about the wayland-devel mailing list