1 <chapter id='The_Server_Database_of_Keyboard_Components'>
2 <title>The Server Database of Keyboard Components</title>
5 The X server maintains a database of keyboard components and common keyboard
6 mappings. This database contains five kinds of components; when combined, these
7 five components provide a complete description of a keyboard and its behavior.
12 The X Keyboard Extension provides requests to list the contents of this
13 database, to assemble and complete keyboard descriptions by merging the current
14 keyboard description with the contents of this database, or to replace the
15 current keyboard description with a complete keyboard description assembled as
19 <sect1 id='Component_Names'>
20 <title>Component Names</title>
23 Component and keymap names have the form "<emphasis>
29 describes a subset of the available components for a particular type and the
32 identifies a specific component from that subset. For example, the name
33 "atlantis(acme)" might specify the symbols used for the atlantis national
34 keyboard layout by the vendor "acme." Each class has an optional <emphasis>
36 member — references which specify a class but not a member refer to the
37 default member of the class, if one exists.
46 names are both specified using characters from the Latin-1 character set. XKB
47 implementations must accept all alphanumeric characters, minus (‘-’) and
48 underscore (‘_’) in class or member names, and must not accept parentheses,
49 plus, vertical bar, percent sign, asterisk, question mark or white space. The
50 use of other characters is implementation-dependent.
55 <sect1 id='Partial_Components_and_Combining_Multiple_Components'>
56 <title>Partial Components and Combining Multiple Components</title>
59 Some of the elements in the server database contain describe only a piece of
60 the corresponding keyboard component. These <emphasis>
62 components should be combined with other components of the same type to be
68 For example, a partial symbols map might describe the differences between a
69 common ASCII keyboard and some national layout. Such a partial map is not
70 useful on its own because it does not include those symbols that are the same
71 on both the ASCII and national layouts (such as function keys). On the other
72 hand, this partial map can configure <emphasis>
74 ASCII keyboard to use a national layout.
79 Two components can be combined in two ways:
84 <para>If the second component <emphasis>
86 the first, any definitions that are present in both components are taken from
91 <para>If the second component <emphasis>
93 the first, any definitions that are present in both components are taken from
100 Applications can use a <emphasis>
101 component expression</emphasis>
102 to combine multiple components of some time into a complete description of
103 some aspect of the keyboard. A component expression is a string which lists the
104 components to be combined separated by operators which specify the rules for
105 combining them. A complete description is assembled from the listed components,
106 left to right, as follows:
111 <para>If the new elements are being merged with an existing map, the special
112 component name ‘%’ refers to the unmodified value of the map.
116 <para>The ‘+’ operator specifies that the next specified component should
117 override the current assembled definition.
121 <para>The ‘|’ operator specifies that the next specified component should
122 augment the currently assembled definition.
126 <para>If the new elements are being merged with an existing map and the
127 component expression begins with an operator, a leading ‘%’ is implied.
131 <para>If any unknown or illegal characters appear anywhere in the string, the
132 entire expression is invalid and is ignored.
138 For example, the component expression "+de" specifies that the default element
139 of the "de" map should be applied to the current keyboard mapping, overriding
140 any existing definitions.
145 A slightly more involved example: the expression
146 "acme(ascii)+de(basic)|iso9995-3" constructs a German (de) mapping for the
147 ASCII keyboard supplied by the "acme" vendor. The new definition begins with
148 the symbols for the default ASCII keyboard for Acme, overrides them with any
149 keys that are defined for the default German keyboard layout and then applies
150 the definitions from the iso9995-3 to any undefined keys or groups of keys
151 (part three of the iso9995 standard defines a common set of bindings for the
152 secondary group, but allows national layouts to override those definitions
158 <sect1 id='Component_Hints'>
159 <title>Component Hints</title>
162 Each component has a set of flags that provide some additional hints about that
163 component. XKB provides these hints for clients that present the keyboard
164 database to users and specifies their interpretation only loosely. Clients can
165 use these hints to constrain the list of components or to control the way that
166 components are presented to the user.
171 Hints for a component are reported with its name. The least significant byte of
172 the hints field has the same meaning for all five types of keyboard components,
173 and can contain any combination of the following values:
176 <informaltable frame='topbot'>
177 <?dbfo keep-together="always" ?>
178 <tgroup cols='2' align='left' colsep='0' rowsep='0'>
179 <colspec colname='c1' colwidth='1.0*'/>
180 <colspec colname='c2' colwidth='3.0*'/>
184 <entry>Meaning</entry>
192 <entry>Indicates a component that should not normally be presented to the
197 LC_Default</emphasis>
199 <entry>Indicates a component that is the default member of its
204 LC_Partial</emphasis>
206 <entry>Indicates a partial component.</entry>
213 The interpretation of the most significant byte of the hints field is dependent
214 on the type of component. The hints defined for each kind of component are
215 listed in the section below that describes that kind of component.
220 <sect1 id='Keyboard_Components'>
221 <title>Keyboard Components</title>
224 The five types of components stored in the server database of keyboard
225 components correspond to the <emphasis>
235 symbolic names associated with a keyboard.
239 <sect1 id='The_Keycodes_Component'>
240 <title>The Keycodes Component</title>
245 component of a keyboard mapping specifies the range and interpretation of the
246 raw keycodes reported by the device. It sets the <emphasis>
248 symbolic name, the minimum and maximum legal keycodes for the keyboard, and
249 the symbolic name for each key. The keycodes component might also contain
250 aliases for some keys, symbolic names for some indicators, and a description of
251 which indicators are physically present.
256 The special keycodes component named "computed" indicates that XKB should
257 assign unused keycodes to any unknown keys referenced by name by any of the
258 other components. The computed keycodes component is useful primarily when
259 browsing keymaps because it makes it possible to use the symbols and geometry
260 components without having to find a set of keycodes that includes keycode
261 definitions for all of the keys listed in the two components.
266 XKB defines no hints that are specific to the keycodes component.
270 <sect2 id='The_Types_Component'>
271 <title>The Types Component</title>
276 component of a keyboard mapping specifies the key types that can be associated
277 with the various keyboard keys. It affects the <emphasis>
279 symbolic name and the list of types associated with the keyboard (see
280 <link linkend='Key_Types'>Key Types</link>). The types component
281 of a keyboard mapping can also optionally contain real modifier bindings and
282 symbolic names for one or more virtual modifiers.
287 The special types component named "canonical" always contains the types and
288 definitions listed in <link linkend="canonical_key_types">Canonical Key Types</link> of this document.
293 XKB defines no hints that are specific to the types component.
298 <sect2 id='The_Compatibility_Map_Component'>
299 <title>The Compatibility Map Component</title>
303 compatibility map</emphasis>
304 component of a keyboard mapping primarily specifies the rules used to assign
305 actions to keysyms. It affects the <emphasis>
307 symbolic name, the symbol compatibility map and the group compatibility map.
308 The compat component might also specify maps for some indicators and the real
309 modifier bindings and symbolic names of some virtual modifiers.
314 XKB defines no hints that are specific to the compatibility map component.
319 <sect2 id='The_Symbols_Component'>
320 <title>The Symbols Component</title>
325 component of a keyboard mapping specifies primarily the symbols bound to each
326 keyboard key. It affects the <emphasis>
328 symbolic name, a key symbol mapping for each key, they keyboard modifier
329 mapping, and the symbolic names for the keyboard symbol groups. Optionally, the
332 component can contain explicit actions and behaviors for some keys, or the
333 real modifier bindings and symbolic names for some virtual modifiers.
338 XKB defines the following additional hints for the symbols component:
341 <informaltable frame='topbot'>
342 <?dbfo keep-together="always" ?>
343 <tgroup cols='2' align='left' colsep='0' rowsep='0'>
344 <colspec colname='c1' colwidth='1.0*'/>
345 <colspec colname='c2' colwidth='3.0*'/>
349 <entry>Meaning</entry>
355 LC_AlphanumericKeys</emphasis>
357 <entry>Indicates a symbol component that contains bindings primarily for an
358 alphanumeric section of the keyboard.</entry>
362 LC_ModifierKeys</emphasis>
364 <entry>Indicates a symbol component that contains bindings primarily for
365 modifier keys.</entry>
369 LC_KeypadKeys</emphasis>
371 <entry>Indicates a symbol component that contains bindings primarily for
372 numeric keypad keys.</entry>
375 <entry>LC_FunctionKeys</entry>
376 <entry>Indicates a symbol component that contains bindings primarily for
377 function keys.</entry>
380 <entry>LC_AlternateGroup</entry>
381 <entry>Indicates a symbol component that contains bindings for an alternate
382 keyboard group.</entry>
389 These hints only apply to partial symbols components; full symbols components
390 are assumed to specify all of the pieces listed above.
393 <note><para>The alphanumeric, modifier, keypad or function keys hints should
394 describe the primary intent of the component designer and should not simply an
395 exhaustive list of the kinds of keys that are affected. For example, national
396 keyboard layouts affect primarily alphanumeric keys, but many affect a few
397 modifier keys too; such mappings should set only <emphasis>
398 LC_AlphanumericKeys</emphasis>
399 hint. In general, symbol components should set only one of those four flags
401 LC_AlternateGroup</emphasis>
402 may be combined with any of the other flags).</para></note>
405 <sect2 id='The_Geometry_Component'>
406 <title>The Geometry Component</title>
411 component of a keyboard mapping specifies primarily the geometry of the
412 keyboard. It contains the geometry symbolic name and the keyboard geometry
413 description. The geometry component might also contain aliases for some keys or
414 symbolic names for some indicators and might affect the set of indicators that
415 are physically present. Key aliases defined in the geometry component of a
416 keyboard mapping override those defined in the keycodes component.
421 XKB defines no hints that are specific to the geometry component.
427 <sect1 id='Complete_Keymaps'>
428 <title>Complete Keymaps</title>
431 The X server also reports a set of fully specified keymaps. The keymaps
432 specified in this list are usually assembled from the components stored in the
433 rest of the database and typically represent the most commonly used keymaps for
439 XKB defines no hints that are specific to complete keymaps.