@defgroup keysym-encoding Keysym encoding @brief Description of the [keysyms](@ref xkb_keysym_t) encoding and the categories of keysyms @sa Appendix A [“Keysym Encoding”][encoding] of the X Window System Protocol. @sa Appendix C [“New keysyms”][new-keysyms] of the XKB Protocol Specification. @tableofcontents{html:2} # Encoding @important Keysyms are **32-bit** integers whoose 3 most significant bits are always set to zero. Thus valid keysyms are in the range `0 – 0x1fffffff` = @ref XKB_KEYSYM_MAX. @note Throughout this documentation, keysyms values are viewed as four bytes, numbered from most significant to least significant:
Byte *1*
The most significant 8 bits: 3 zero bits and the most-significant 5 bits of the 29-bit effective value.
Byte *2*
The next most-significant 8 bits
Byte *3*
The next most-significant 8 bits
Byte *4*
The least-significant 8 bits
# Categories There are 6 categories: - @ref special-keysyms - @ref latin-1-keysyms - @ref legacy-keysyms - @ref function-keysyms - @ref unicode-keysyms - @ref vendor-keysyms ## Overview
Category Subcategory Byte 1 Byte 2 Byte 3 Byte 4 First keysym Last keysym
@ref special-keysyms `0` `0` `0` `0` [`NoSymbol`][NoSymbol]
@ref latin-1-keysyms ASCII non-control characters `0` `0` `0` `0x20` – `0x7e` [`space`](@ref XKB_KEY_space) [`asciitilde`](@ref XKB_KEY_asciitilde)
Latin-1 Supplement `0xa0` – `0xff` [`nobreakspace`](@ref XKB_KEY_nobreakspace) [`ydiaeresis`](@ref XKB_KEY_ydiaeresis)
@ref legacy-keysyms [Latin-2] `0` `0` `0x01` `0x00` – `0xff` [`Aogonek`](@ref XKB_KEY_Aogonek) [`abovedot`](@ref XKB_KEY_abovedot)
[Latin-3] `0x02` [`Hstroke`](@ref XKB_KEY_Hstroke) [`scircumflex`](@ref XKB_KEY_scircumflex)
[Latin-4] `0x03` [`kra`](@ref XKB_KEY_kra) [`umacron`](@ref XKB_KEY_umacron)
Kana `0x04` [`overline`](@ref XKB_KEY_overline) [`semivoicedsound`](@ref XKB_KEY_semivoicedsound)
Arabic `0x05` [`Arabic_comma`](@ref XKB_KEY_Arabic_comma) [`Arabic_sukun`](@ref XKB_KEY_Arabic_sukun)
Cyrillic `0x06` [`Serbian_dje`](@ref XKB_KEY_Serbian_dje) [`Cyrillic_HARDSIGN`](@ref XKB_KEY_Cyrillic_HARDSIGN)
Greek `0x07` [`Greek_ALPHAaccent`](@ref XKB_KEY_Greek_ALPHAaccent) [`Greek_omega`](@ref XKB_KEY_Greek_omega)
Technical `0x08` [`leftradical`](@ref XKB_KEY_leftradical) [`downarrow`](@ref XKB_KEY_downarrow)
Special `0x09` [`blank`](@ref XKB_KEY_blank) [`vertbar`](@ref XKB_KEY_vertbar)
Publishing `0x0a` [`emspace`](@ref XKB_KEY_emspace) [`cursor`](@ref XKB_KEY_cursor)
APL `0x0b` [`leftcaret`](@ref XKB_KEY_leftcaret) [`righttack`](@ref XKB_KEY_righttack)
Hebrew `0x0c` [`hebrew_doublelowline`](@ref XKB_KEY_hebrew_doublelowline) [`hebrew_taf`](@ref XKB_KEY_hebrew_taf)
Thai `0x0d` [`Thai_kokai`](@ref XKB_KEY_Thai_kokai) [`Thai_lekkao`](@ref XKB_KEY_Thai_lekkao)
Korean `0x0e` [`Hangul_Kiyeog`](@ref XKB_KEY_Hangul_Kiyeog) [`Korean_Won`](@ref XKB_KEY_Korean_Won)
[Latin-5] `0x0f`
[Latin-6] `0x10`
[Latin-7] `0x11`
[Latin-8] `0x12`
[Latin-9] `0x13` [`OE`](@ref XKB_KEY_OE) [`Ydiaeresis`](@ref XKB_KEY_Ydiaeresis)
Currency `0x20` [`EuroSign`](@ref XKB_KEY_EuroSign)
@ref function-keysyms IBM 3270 terminals `0` `0` `0xfd` `0x00` – `0xff` [`3270_Duplicate`](@ref XKB_KEY_3270_Duplicate) [`3270_Enter`](@ref XKB_KEY_3270_Enter)
Keyboard (XKB) Extension `0xfe` [`ISO_Lock`](@ref XKB_KEY_ISO_Lock) [`Pointer_Drag5`](@ref XKB_KEY_Pointer_Drag5)
Keyboard `0xff` [`BackSpace`](@ref XKB_KEY_BackSpace) [`Delete`](@ref XKB_KEY_Delete)
@ref special-keysyms `0` `0xff` `0xff` `0xff` [`VoidSymbol`][VoidSymbol]
@ref unicode-keysyms `0x01` `0x00` – `0x10` `0x00` – `0xff` `0x00` – `0xff` `0x01000100` `0x0110ffff`
@ref vendor-keysyms DEC, HP, misc. `0x10` `0x00` `0x00` – `0xff` `0x00` – `0xff` `0x10000000` `0x1000ffff`
`0x10` `0x01` – `0x03` `0x10010000` `0x1003ffff`
OSF `0x10` `0x04` `0x10040000` `0x1004ffff`
Sun `0x10` `0x05` `0x10050000` `0x1005ffff`
`0x10` `0x06` – `0x07` `0x10060000` `0x1007ffff`
XFree86 `0x10` `0x08` `0x10080000` `0x1008ffff`
`0x10` – `0x1f` `0x09` – `0xff` `0x10090000` `0x1fffffff`
## Special keysyms There are 2 special values: [`NoSymbol`][NoSymbol] and [`VoidSymbol`][VoidSymbol]. They are used to indicate the *absence of symbols*. Byte 1 | Byte 2 | Byte 3 | Byte 4 | Hex. value | Name ------ | ------ | ------ | -- --- | ------------ | ----- 0 | 0 | 0 | 0 | `0x00000000` | [`NoSymbol`][NoSymbol] 0 | 255 | 255 | 255 | `0x00ffffff` | [`VoidSymbol`][VoidSymbol] @sa Appendix A “[Special keysyms]” of the X Window System Protocol. [NoSymbol]: @ref XKB_KEY_NoSymbol [VoidSymbol]: @ref XKB_KEY_VoidSymbol [Special keysyms]: https://xorg.freedesktop.org/archive/current/doc/xproto/x11protocol.html#Special_KEYSYMs ## Latin-1 keysyms The [Latin-1] keysyms occupy the range `0x0020` – `0x007E` and `0x00a0` – `0x00ff` and represent the [ISO 10646 / Unicode][Unicode] characters `U+0020` – `U+007E` and `U+00A0` – `U+00FF`, respectively. @sa [ISO/IEC 8859-1][Latin-1] character encoding @sa Appendix A “[Latin-1 keysyms]” of the X Window System Protocol. [Latin-1 keysyms]: https://xorg.freedesktop.org/archive/current/doc/xproto/x11protocol.html#Latin_1_KEYSYMs ## Legacy keysyms **Legacy keysyms** date from the time *before* [ISO 10646 / Unicode][Unicode] was available. They represent characters from a number of different older 8-bit coded character sets and have zero values for bytes 1 and 2. Byte 3 indicates a coded character set and byte 4 is the 8-bit value of the particular character within that set.
Byte 3
Value Character set Comment
1 [Latin-2]
2 [Latin-3]
3 [Latin-4]
4 Kana
5 Arabic
6 Cyrillic
7 Greek
8 Technical Based on [DEC Technical]‌: add `0x880` to the original code point
9 Special Based on [DEC Special Graphics]‌: add `0x980` to the original code point
10 Publishing
11 APL
12 Hebrew
13 Thai
14 Korean
15 [Latin-5]
16 [Latin-6]
17 [Latin-7]
18 [Latin-8]
19 [Latin-9]
32 Currency
Each character set contains gaps where codes have been removed that were duplicates with codes in previous character sets (that is, character sets with lesser byte 3 value). @todo Legacy keysyms @sa @ref latin-1-keysyms @sa Appendix A “[Legacy keysyms]” of the X Window System Protocol. [Legacy keysyms]: https://xorg.freedesktop.org/archive/current/doc/xproto/x11protocol.html#Legacy_KEYSYMs [DEC Technical]: https://en.wikipedia.org/wiki/DEC_Technical_Character_Set [DEC Special Graphics]: https://en.wikipedia.org/wiki/DEC_Special_Graphics ## Function keysyms **Function keysyms** represent keycap symbols that do not directly represent elements of a coded character set. Instead, they typically identify a software function, mode, or operation (e.g., cursor up, caps lock, insert) that can be activated using a dedicated key. Function keysyms have zero values for bytes 1 and 2. Byte 3 distinguishes between several 8-bit sets within which byte 4 identifies the individual function key.
Byte 1 Byte 2 Byte 3 Byte 4
Value Value Value Function set Value
0 0 253IBM 3270 terminals (individual function key)
254Keyboard (XKB) Extension
255Keyboard
@todo Function keysyms @sa Appendix A “[Function keysyms]” of the X Window System Protocol. @sa Appendix C “[New keysyms]” of the XKB Protocol Specification. [Function keysyms]: https://xorg.freedesktop.org/archive/current/doc/xproto/x11protocol.html#Function_KEYSYMs [New keysyms]: https://xorg.freedesktop.org/releases/X11R7.7/doc/kbproto/xkbproto.html#New_KeySyms ## Unicode keysyms The **Unicode keysyms** occupy the range `0x01000100` – `0x0110FFFF` and represent the [ISO 10646 / Unicode][Unicode] characters `U+0100` – `U+10FFFF`, respectively. The numeric value of a Unicode keysym is the Unicode code point of the corresponding character plus `0x01000000`. In the interest of backwards compatibility, clients should be able to process both the Unicode keysym and the [legacy keysym](@ref legacy-keysyms) for those characters where both exist. @note *Dead keys*, which place an accent on the next character entered, shall be encoded as [function keysyms](@ref function-keysyms), and not as the Unicode keysym corresponding to an equivalent [*combining* character](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). @note Where a keycap indicates a specific *function* with a graphical symbol that is also available in Unicode (e.g., an upwards arrow for the cursor up function), the appropriate [function keysym](@ref function-keysyms) should be used, and not the Unicode keysym corresponding to the depicted symbol. @sa Appendix A “[Unicode keysyms]” of the X Window System Protocol. @sa [Unicode technical website](https://unicode.org/main.html). [Unicode keysyms]: https://xorg.freedesktop.org/archive/current/doc/xproto/x11protocol.html#Unicode_KEYSYMs ## Vendor keysyms **Vendor keysyms** are vendor-specific extentions in the range `0x10000000` – `0x1fffffff`. Among these, the range `0x11000000` – `0x1100ffff` is designated for *keypad keysyms*. @sa Appendix A “[Vendor keysyms]” of the X Window System Protocol. [Vendor keysyms]: https://xorg.freedesktop.org/archive/current/doc/xproto/x11protocol.html#Vendor_KEYSYMs [encoding]: https://www.x.org/releases/current/doc/xproto/x11protocol.html#keysym_encoding [new-keysyms]: https://xorg.freedesktop.org/releases/X11R7.7/doc/kbproto/xkbproto.html#new_keysyms [Unicode]: https://en.wikipedia.org/wiki/Universal_Coded_Character_Set [Latin-1]: https://en.wikipedia.org/wiki/ISO/IEC_8859-1 [Latin-2]: https://en.wikipedia.org/wiki/ISO/IEC_8859-2 [Latin-3]: https://en.wikipedia.org/wiki/ISO/IEC_8859-3 [Latin-4]: https://en.wikipedia.org/wiki/ISO/IEC_8859-4 [Latin-5]: https://en.wikipedia.org/wiki/ISO/IEC_8859-5 [Latin-6]: https://en.wikipedia.org/wiki/ISO/IEC_8859-6 [Latin-7]: https://en.wikipedia.org/wiki/ISO/IEC_8859-7 [Latin-8]: https://en.wikipedia.org/wiki/ISO/IEC_8859-8 [Latin-9]: https://en.wikipedia.org/wiki/ISO/IEC_8859-9 @ingroup keysyms