summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRob Bradford <rob@linux.intel.com>2012-06-08 13:10:28 +0100
committerDaniel Stone <daniel@fooishbar.org>2012-06-08 14:04:49 +0100
commite0524296d2e07426c2979025c81bb261d59e74cd (patch)
tree49618b1f0d27db1ccb8f09bbcdb8234b2ad07f0b /include
parent77c909dee2edbef2e96f95887a6abd96b985df6f (diff)
downloadxorg-lib-libxkbcommon-e0524296d2e07426c2979025c81bb261d59e74cd.tar.gz
Add API for getting unicode representation of a keysym
This code uses a table and code derived from http://www.cl.cam.ac.uk/~mgk25/ucs/keysym2ucs.c The added API calls are: xkb_keysym_to_utf32 xkb_keysym_to_utf8 [daniels: Changed API to be more in line with keysym_get_name, added test, changed formatting to 4-space.]
Diffstat (limited to 'include')
-rw-r--r--include/xkbcommon/xkbcommon.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/xkbcommon/xkbcommon.h b/include/xkbcommon/xkbcommon.h
index fb23425..0fb5178 100644
--- a/include/xkbcommon/xkbcommon.h
+++ b/include/xkbcommon/xkbcommon.h
@@ -154,6 +154,25 @@ xkb_keysym_t
xkb_keysym_from_name(const char *s);
/**
+ * Return the printable representation of the keystring in Unicode/UTF-8.
+ * The buffer passed must be at least 7 bytes long. The return value
+ * is the number of bytes written to the buffer. A return value of zero
+ * means that the keysym does not have a known printable Unicode
+ * representation, and a return value of -1 means that the buffer was too
+ * small to contain the return.
+ */
+int
+xkb_keysym_to_utf8(xkb_keysym_t keysym, char *buffer, size_t size);
+
+/**
+ * Returns the Unicode/UTF-32 representation of the provided keysym, which is
+ * also compatible with UCS-4. A return value of zero means the keysym does
+ * not have a known printable Unicode representation.
+*/
+uint32_t
+xkb_keysym_to_utf32(xkb_keysym_t keysym);
+
+/**
* @defgroup context XKB contexts
* Every keymap compilation request must have an XKB context associated with
* it. The context keeps around state such as the include path.