libxkbcommon
0.2.0
|
Utility functions related to keysyms. More...
Enumerations | |
enum | xkb_keysym_flags { XKB_KEYSYM_CASE_INSENSITIVE = (1 << 0) } |
Flags for xkb_keysym_from_name(). More... |
Functions | |
int | xkb_keysym_get_name (xkb_keysym_t keysym, char *buffer, size_t size) |
Get the name of a keysym. | |
xkb_keysym_t | xkb_keysym_from_name (const char *name, enum xkb_keysym_flags flags) |
Get a keysym from its name. | |
int | xkb_keysym_to_utf8 (xkb_keysym_t keysym, char *buffer, size_t size) |
Get the Unicode/UTF-8 representation of a keysym. | |
uint32_t | xkb_keysym_to_utf32 (xkb_keysym_t keysym) |
Get the Unicode/UTF-32 representation of a keysym. |
Utility functions related to keysyms.
enum xkb_keysym_flags |
Flags for xkb_keysym_from_name().
int xkb_keysym_get_name | ( | xkb_keysym_t | keysym, |
char * | buffer, | ||
size_t | size | ||
) |
Get the name of a keysym.
For a description of how keysyms are named, see xkb_keysym_t.
[in] | keysym | The keysym. |
[out] | buffer | A string buffer to write the name into. |
[in] | size | Size of the buffer. |
You may check if truncation has occured by comparing the return value with the length of buffer, similarly to the snprintf(3) function.
xkb_keysym_t xkb_keysym_from_name | ( | const char * | name, |
enum xkb_keysym_flags | flags | ||
) |
Get a keysym from its name.
name | The name of a keysym. See remarks in xkb_keysym_get_name(); this function will accept any name returned by that function. |
flags | A set of flags controlling how the search is done. If invalid flags are passed, this will fail with XKB_KEY_NoSymbol. |
If you use the XKB_KEYSYM_CASE_INSENSITIVE flag and two keysym names differ only by case, then the lower-case keysym is returned. For instance, for KEY_a and KEY_A, this function would return KEY_a for the case-insensitive search. If this functionality is needed, it is recommended to first call this function without this flag; and if that fails, only then to try with this flag, while possibly warning the user he had misspelled the name, and might get wrong results.
int xkb_keysym_to_utf8 | ( | xkb_keysym_t | keysym, |
char * | buffer, | ||
size_t | size | ||
) |
Get the Unicode/UTF-8 representation of a keysym.
[in] | keysym | The keysym. |
[out] | buffer | A buffer to write the UTF-8 string into. |
[in] | size | The size of buffer. Must be at least 7. |
uint32_t xkb_keysym_to_utf32 | ( | xkb_keysym_t | keysym | ) |
Get the Unicode/UTF-32 representation of a keysym.