H

Keysyms

This appendix provides a list of keysyms and a brief description of each keysym. Keysyms, as you may remember, are the portable representation of the symbols on the caps of keys.

The normal way to process a keyboard event is to use XLookupKeysym to determine the keysym or, if the application allows remapping of keys to strings, it may use XLookupString to get the ASCII string mapped to the key or keys pressed. This allows the application to treat keys in a simple and portable manner, and places the responsibility of tailoring the mapping between keys and keysyms on the server vendor.*

Many keysyms do not have obvious counterparts on the keyboard, but may be generated with certain key combinations. You will need a table for each particular model of hardware you intend the program to work on, to tell you what key combination results in each keysym that is not present on the caps of the keyboard. For real portability, you will want to use only the keysyms that are supported on all vendors equipment you intend the program to be displayed on.

The keysyms are defined in two standard include files: <X11/keysym.h> and <X11/keysymdef.h>. There are several families of keysyms defined in <X11/keysymdef.h>; LATIN1, LATIN2, LATIN3, LATIN4, KATAKANA, ARABIC, CYRILLIC, GREEK, TECHNICAL, SPECIAL, PUBLISHING, APL, HEBREW, and MISCELLANY. The <X11/keysym.h> file specifies which families are enabled. Only the LATIN1, LATIN2, LATIN3, LATIN4, GREEK, and MISCELLANY families are enabled in the standard <X11/keysym.h> file, probably because some compilers have an upper limit on the number of defined symbols that are allowed.

The developers of X at MIT say that to the best of their knowledge the Latin, Kana, Arabic, Cyrillic, Greek, Technical, APL, and Hebrew keysym sets are from the appropriate ISO (International Standards Organization) and/or ECMA international standards. There are no Technical, Special nor Publishing international standards, so these sets are based on Digital Equipment Corporation standards.

Keysyms are four byte long values. In the standard keysyms, the least significant 8 bits indicate a particular character within a set. and the next 8 bits indicate a particular keysym set. The order of the sets is important since not all the sets are complete. Each character set contains gaps where codes have been removed that were duplicates with codes in previous (that is, with lesser keysym set) character sets.

The 94 and 96 character code sets have been moved to occupy the right hand quadrant (decimal 129 - 256), so the ASCII subset has a unique encoding across the least significant byte which corresponds to the ASCII character code. However, this cannot be guaranteed in the keysym sets of future releases and does not apply to all of the MISCELLANY set.

As far as possible, keysym codes are the same as the character code. In the LATIN1 to LATIN4 sets, all duplicate glyphs occupy the same position. However, duplicates between GREEK and TECHNICAL do not occupy the same code position. Thus, applications wishing to use the TECHNICAL character set must transform the keysym using an array.

The MISCELLANY set is a miscellaneous collection of commonly occurring keys on keyboards. Within this set, the keypad symbols are generally duplicates of symbols found on keys on the alphanumeric part of the keyboard but are distinguished here because they often have distinguishable keycodes associated with them.

There is a difference between European and US usage of the names Pilcrow, Paragraph, and Section, as shown in Table H-1.

Table H-1. European vs. US usage of Pilcrow, Paragraph, and Section symbol names

images

X has adopted the names used by both the ISO and ECMA standards. Thus, XK_paragraph is what Europeans call the pilcrow sign, and XK_section is what they would call the paragraph sign. This favors the US usage.

Keysyms and Description

Tables H-2 through H-7 list the six commonly available sets of keysyms (MISCELLANY, LATIN1 through LATIN4, and GREEK) and describe each keysym briefly. When necessary and possible, these tables show a representative character or characters that might appear on the cap of the key or on the screen when the key or keys corresponding to the keysym were typed.

Table H-2. MISCELLANY

Keysym Description
XK_Backspace Backspace, Back Space, Back Char
XK_Tab Tab
XK_Linefeed Linefeed, LF
XK_Clear Clear
XK_Return Return, Enter
XK_Pause Pause, Hold, Scroll Lock
XK_Escape Escape
XK_Delete Delete, Rubout
XK_Multi_key Multi-key character preface
XK_Kanji Kanji, Kanji convert
XK_Home Home
XK_Left Left, move left, left arrow
XK_Up Up, move up, up arrow
XK_Right Right, move right, right arrow
XK_Down Down, move down, down arrow
XK_Prior Prior, previous
XK_Next Next
XK_End End, EOL
XK_Begin Begin, BOL
XK_Select Select, mark
XK_Print Print
XK_Execute Execute, run, do
XK_Insert Insert, insert here
XK_Undo Undo, oops
XK_Redo Redo, again
XK_Menu Menu
XK_Find Find, search
XK_Cancel Cancel, stop, abort, exit
XK_Help Help, question mark
XK_Break Break
XK_Mode_switch Mode switch, script switch, character set switch
XK_script_switch Alias for mode switch, script switch, character set switch
XK_Num_Lock Num Lock
XK_KP_Space Keypad Space
XK_KP_Tab Keypad Tab
XK_KP_Enter Keypad Enter
XK_KP_F1 Keypad F1, PF1, a
XK_KP_F2 Keypad F2, PF2, b
XK_KP_F3 Keypad F3, PF3, c
XK_KP_F4 Keypad F4, PF4, d
XK_KP_Equal Keypad equals sign
XK_KP_Multiply Keypad multiplication sign, asterisk
XK_KP_Add Keypad plus sign
XK_KP_Separator Keypad separator, comma
XK_KP_Subtract Keypad minus sign, hyphen
XK_KP_Decimal Keypad decimal point, full stop
XK_KP_Divide Keypad division sign, solidus
XK_KP_0 Keypad digit zero
XK_KP_1 Keypad digit one
XK_KP_2 Keypad digit two
XK_KP_3 Keypad digit three
XK_KP_4 Keypad digit four
XK_KP_5 Keypad digit five
XK_KP_6 Keypad digit six
XK_KP_7 Keypad digit seven
XK_KP_8 Keypad digit eight
XK_KP_9 Keypad digit nine
XK_F1 F1 function key
XK_F2 F2 function key
XK_F3 F3 function key
XK_F4 F4 function key
XK_F5 F5 function key
XK_F6 F6 function key
XK_F7 F7 function key
XK_F8 F8 function key
XK_F9 F9 function key
XK_F10 F10 function key
XK_F11 F11 function key
XK_L1 L1 function key
XK_F12 F12 function key
XK_L2 L2 function key
XK_F13 F13 function key
XK_L3 L3 function key
XK_F14 F14 function key
XK_L4 L4 function key
XK_F15 F15 function key
XK_L5 L5 function key
XK_F16 F16 function key
XK_L6 L6 function key
XK_F17 F17 function key
XK_L7 L7 function key
XK_F18 F18 function key
XK_L8 L8 function key
XK_F19 F19 function key
XK_L9 L9 function key
XK_F20 F20 function key
XK_L10 L10 function key
XK_F21 F21 function key
XK_R1 R1 function key
XK_F22 F22 function key
XK_R2 R2 function key
XK_F23 F23 function key
XK_R3 R3 function key
XK_F24 F24 function key
XK_R4 R4 function key
XK_F25 F25 function key
XK_R5 R5 function key
XK_F26 F26 function key
XK_R6 R6 function key
XK_F27 F27 function key
XK_R7 R7 function key
XK_F28 F28 function key
XK_R8 R8 function key
XK_F29 F29 function key
XK_R9 R9 function key
XK_F30 F30 function key
XK_R10 R10 function key
XK_F31 F31 function key
XK_R11 R11 function key
XK_F32 F32 function key
XK_R12 R12 function key
XK_R13 F33 function key
XK_F33 R13 function key
XK_F34 F34 function key
XK_R14 R14 function key
XK_F35 F35 function key
XK_R15 R15 function key
XK_Shift_L Left Shift
XK_Shift_R Right Shift
XK_Control_L Left Control
XK_Control_R Right Control
XK_Caps_Lock Caps Lock
XK_Shift_Lock Shift Lock
XK_Meta_L Left Meta
XK_Meta_R Right Meta
XK_Alt_L Left Alt
XK_Alt_R Right Alt
XK_Super_L Left Super
XK_Super_R Right Super
XK_Hyper_L Left Hyper
XK_Hyper_R Right Hyper

Table H-3. LATIN1

images

images

images

images

images

images

Table H-4. LATIN2

images

images

Table H-5. LATIN3

images

Table H-6. LATIN4

images

Table H-7. GREEK

images

images

* While keycode information is not necessary for normal application programming, it may be necessary for writing certain programs that change the keycode to keysym mapping. You will need to obtain a list of keycodes and their normal mappings from the system manufacturer. Any program that uses this mapping is not fully portable.

Get Xlib Reference Manual for Version 11 of the X Window System now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.