1ea1d6981Smrg<chapter id='The_Server_Database_of_Keyboard_Components'>
2ea1d6981Smrg<title>The Server Database of Keyboard Components</title>
3ea1d6981Smrg
4ea1d6981Smrg<para>
5ea1d6981SmrgThe X server maintains a database of keyboard components and common keyboard
6ea1d6981Smrgmappings. This database contains five kinds of components; when combined, these
7ea1d6981Smrgfive components provide a complete description of a keyboard and its behavior.
8ea1d6981Smrg</para>
9ea1d6981Smrg
10ea1d6981Smrg
11ea1d6981Smrg<para>
12ea1d6981SmrgThe X Keyboard Extension provides requests to list the contents of this
13ea1d6981Smrgdatabase, to assemble and complete keyboard descriptions by merging the current
14ea1d6981Smrgkeyboard description with the contents of this database, or to replace the
15ea1d6981Smrgcurrent keyboard description with a complete keyboard description assembled as
16ea1d6981Smrgdescribed below.
17ea1d6981Smrg</para>
18ea1d6981Smrg
19ea1d6981Smrg<sect1 id='Component_Names'>
20ea1d6981Smrg<title>Component Names</title>
21ea1d6981Smrg
22ea1d6981Smrg<para>
23ea1d6981SmrgComponent and keymap names have the form "<emphasis>
24ea1d6981Smrgclass</emphasis>
25ea1d6981Smrg(<emphasis>
26ea1d6981Smrgmember</emphasis>
27ea1d6981Smrg)" where <emphasis>
28ea1d6981Smrgclass</emphasis>
29ea1d6981Smrg describes a subset of the available components for a particular type and the
30ea1d6981Smrgoptional <emphasis>
31ea1d6981Smrgmember</emphasis>
32ea1d6981Smrg identifies a specific component from that subset. For example, the name
33ea1d6981Smrg"atlantis(acme)" might specify the symbols used for the atlantis national
34ea1d6981Smrgkeyboard layout by the vendor "acme." Each class has an optional <emphasis>
35ea1d6981Smrgdefault</emphasis>
36ea1d6981Smrg member — references which specify a class but not a member refer to the
37ea1d6981Smrgdefault member of the class, if one exists.
38ea1d6981Smrg</para>
39ea1d6981Smrg
40ea1d6981Smrg
41ea1d6981Smrg<para>
42ea1d6981SmrgThe <emphasis>
43ea1d6981Smrgclass</emphasis>
44ea1d6981Smrg and <emphasis>
45ea1d6981Smrgmember</emphasis>
46ea1d6981Smrg names are both specified using characters from the Latin-1 character set. XKB
47ea1d6981Smrgimplementations must accept all alphanumeric characters, minus (‘-’) and
48ea1d6981Smrgunderscore (‘_’) in class or member names, and must not accept parentheses,
49ea1d6981Smrgplus, vertical bar, percent sign, asterisk, question mark or white space. The
50ea1d6981Smrguse of other characters is implementation-dependent.
51ea1d6981Smrg</para>
52ea1d6981Smrg
53ea1d6981Smrg
54ea1d6981Smrg</sect1>
55ea1d6981Smrg<sect1 id='Partial_Components_and_Combining_Multiple_Components'>
56ea1d6981Smrg<title>Partial Components and Combining Multiple Components</title>
57ea1d6981Smrg
58ea1d6981Smrg<para>
59ea1d6981SmrgSome of the elements in the server database contain describe only a piece of
60ea1d6981Smrgthe corresponding keyboard component. These <emphasis>
61ea1d6981Smrgpartial</emphasis>
62ea1d6981Smrg components should be combined with other components of the same type to be
63ea1d6981Smrguseful.
64ea1d6981Smrg</para>
65ea1d6981Smrg
66ea1d6981Smrg
67ea1d6981Smrg<para>
68ea1d6981SmrgFor example, a partial symbols map might describe the differences between a
69ea1d6981Smrgcommon ASCII keyboard and some national layout. Such a partial map is not
70ea1d6981Smrguseful on its own because it does not include those symbols that are the same
71ea1d6981Smrgon both the ASCII and national layouts (such as function keys). On the other
72ea1d6981Smrghand, this partial map can configure <emphasis>
73ea1d6981Smrgany</emphasis>
74ea1d6981Smrg ASCII keyboard to use a national layout.
75ea1d6981Smrg</para>
76ea1d6981Smrg
77ea1d6981Smrg
78ea1d6981Smrg<para>
79ea1d6981SmrgTwo components can be combined in two ways:
80ea1d6981Smrg</para>
81ea1d6981Smrg
82ea1d6981Smrg<itemizedlist>
83ea1d6981Smrg<listitem>
84ea1d6981Smrg  <para>If the second component <emphasis>
85ea1d6981Smrgoverrides</emphasis>
86ea1d6981Smrg the first, any definitions that are present in both components are taken from
87ea1d6981Smrgthe second.
88ea1d6981Smrg  </para>
89ea1d6981Smrg</listitem>
90ea1d6981Smrg<listitem>
91ea1d6981Smrg  <para>If the second component <emphasis>
92ea1d6981Smrgaugments</emphasis>
93ea1d6981Smrg the first, any definitions that are present in both components are taken from
94ea1d6981Smrgthe first.
95ea1d6981Smrg  </para>
96ea1d6981Smrg</listitem>
97ea1d6981Smrg</itemizedlist>
98ea1d6981Smrg
99ea1d6981Smrg<para>
100ea1d6981SmrgApplications can use a <emphasis>
101ea1d6981Smrgcomponent expression</emphasis>
102ea1d6981Smrg to combine multiple components of some time into a complete description of
103ea1d6981Smrgsome aspect of the keyboard. A component expression is a string which lists the
104ea1d6981Smrgcomponents to be combined separated by operators which specify the rules for
105ea1d6981Smrgcombining them. A complete description is assembled from the listed components,
106ea1d6981Smrgleft to right, as follows:
107ea1d6981Smrg</para>
108ea1d6981Smrg
109ea1d6981Smrg<itemizedlist>
110ea1d6981Smrg<listitem>
111ea1d6981Smrg  <para>If the new elements are being merged with an existing map, the special
112ea1d6981Smrgcomponent name ‘%’ refers to the unmodified value of the map.
113ea1d6981Smrg  </para>
114ea1d6981Smrg</listitem>
115ea1d6981Smrg<listitem>
116ea1d6981Smrg  <para>The ‘+’ operator specifies that the next specified component should
117ea1d6981Smrgoverride the current assembled definition.
118ea1d6981Smrg  </para>
119ea1d6981Smrg</listitem>
120ea1d6981Smrg<listitem>
121ea1d6981Smrg  <para>The ‘|’ operator specifies that the next specified component should
122ea1d6981Smrgaugment the currently assembled definition.
123ea1d6981Smrg  </para>
124ea1d6981Smrg</listitem>
125ea1d6981Smrg<listitem>
126ea1d6981Smrg  <para>If the new elements are being merged with an existing map and the
127ea1d6981Smrgcomponent expression begins with an operator, a leading ‘%’ is implied.
128ea1d6981Smrg  </para>
129ea1d6981Smrg</listitem>
130ea1d6981Smrg<listitem>
131ea1d6981Smrg  <para>If any unknown or illegal characters appear anywhere in the string, the
132ea1d6981Smrgentire expression is invalid and is ignored.
133ea1d6981Smrg  </para>
134ea1d6981Smrg</listitem>
135ea1d6981Smrg</itemizedlist>
136ea1d6981Smrg
137ea1d6981Smrg<para>
138ea1d6981SmrgFor example, the component expression "+de" specifies that the default element
139ea1d6981Smrgof the "de" map should be applied to the current keyboard mapping, overriding
140ea1d6981Smrgany existing definitions.
141ea1d6981Smrg</para>
142ea1d6981Smrg
143ea1d6981Smrg
144ea1d6981Smrg<para>
145ea1d6981SmrgA slightly more involved example: the expression
146ea1d6981Smrg"acme(ascii)+de(basic)|iso9995-3" constructs a German (de) mapping for the
147ea1d6981SmrgASCII keyboard supplied by the "acme" vendor. The new definition begins with
148ea1d6981Smrgthe symbols for the default ASCII keyboard for Acme, overrides them with any
149ea1d6981Smrgkeys that are defined for the default German keyboard layout and then applies
150ea1d6981Smrgthe definitions from the iso9995-3 to any undefined keys or groups of keys
151ea1d6981Smrg(part three of the iso9995 standard defines a common set of bindings for the
152ea1d6981Smrgsecondary group, but allows national layouts to override those definitions
153ea1d6981Smrgwhere necessary).
154ea1d6981Smrg</para>
155ea1d6981Smrg
156ea1d6981Smrg
157ea1d6981Smrg</sect1>
158ea1d6981Smrg<sect1 id='Component_Hints'>
159ea1d6981Smrg<title>Component Hints</title>
160ea1d6981Smrg
161ea1d6981Smrg<para>
162ea1d6981SmrgEach component has a set of flags that provide some additional hints about that
163ea1d6981Smrgcomponent. XKB provides these hints for clients that present the keyboard
164ea1d6981Smrgdatabase to users and specifies their interpretation only loosely. Clients can
165ea1d6981Smrguse these hints to constrain the list of components or to control the way that
166ea1d6981Smrgcomponents are presented to the user.
167ea1d6981Smrg</para>
168ea1d6981Smrg
169ea1d6981Smrg
170ea1d6981Smrg<para>
171ea1d6981SmrgHints for a component are reported with its name. The least significant byte of
172ea1d6981Smrgthe hints field has the same meaning for all five types of keyboard components,
173ea1d6981Smrgand can contain any combination of the following values:
174ea1d6981Smrg</para>
175ea1d6981Smrg
176ea1d6981Smrg<informaltable frame='topbot'>
177ea1d6981Smrg<?dbfo keep-together="always" ?>
178ea1d6981Smrg<tgroup cols='2' align='left' colsep='0' rowsep='0'>
179ea1d6981Smrg<colspec colname='c1' colwidth='1.0*'/>
180ea1d6981Smrg<colspec colname='c2' colwidth='3.0*'/>
181ea1d6981Smrg<thead>
182ea1d6981Smrg  <row rowsep='1'>
183ea1d6981Smrg    <entry>Flag</entry>
184ea1d6981Smrg    <entry>Meaning</entry>
185ea1d6981Smrg  </row>
186ea1d6981Smrg</thead>
187ea1d6981Smrg<tbody>
188ea1d6981Smrg  <row>
189ea1d6981Smrg    <entry><emphasis>
190ea1d6981SmrgLC_Hidden</emphasis>
191ea1d6981Smrg</entry>
192ea1d6981Smrg    <entry>Indicates a component that should not normally be presented to the
193ea1d6981Smrguser.</entry>
194ea1d6981Smrg  </row>
195ea1d6981Smrg  <row>
196ea1d6981Smrg    <entry><emphasis>
197ea1d6981SmrgLC_Default</emphasis>
198ea1d6981Smrg</entry>
199ea1d6981Smrg    <entry>Indicates a component that is the default member of its
200ea1d6981Smrgclass.</entry>
201ea1d6981Smrg  </row>
202ea1d6981Smrg  <row>
203ea1d6981Smrg    <entry><emphasis>
204ea1d6981SmrgLC_Partial</emphasis>
205ea1d6981Smrg</entry>
206ea1d6981Smrg    <entry>Indicates a partial component.</entry>
207ea1d6981Smrg  </row>
208ea1d6981Smrg</tbody>
209ea1d6981Smrg</tgroup>
210ea1d6981Smrg</informaltable>
211ea1d6981Smrg
212ea1d6981Smrg<para>
213ea1d6981SmrgThe interpretation of the most significant byte of the hints field is dependent
214ea1d6981Smrgon the type of component. The hints defined for each kind of component are
215ea1d6981Smrglisted in the section below that describes that kind of component.
216ea1d6981Smrg</para>
217ea1d6981Smrg
218ea1d6981Smrg
219ea1d6981Smrg</sect1>
220ea1d6981Smrg<sect1 id='Keyboard_Components'>
221ea1d6981Smrg<title>Keyboard Components</title>
222ea1d6981Smrg
223ea1d6981Smrg<para>
224ea1d6981SmrgThe five types of components stored in the server database of keyboard
225ea1d6981Smrgcomponents correspond to the <emphasis>
226ea1d6981Smrgsymbols</emphasis>
227ea1d6981Smrg, <emphasis>
228ea1d6981Smrggeometry</emphasis>
229ea1d6981Smrg, <emphasis>
230ea1d6981Smrgkeycodes</emphasis>
231ea1d6981Smrg, <emphasis>
232ea1d6981Smrgcompat</emphasis>
233ea1d6981Smrg and <emphasis>
234ea1d6981Smrgtypes</emphasis>
235ea1d6981Smrg symbolic names associated with a keyboard.
236ea1d6981Smrg</para>
237ea1d6981Smrg
238ea1d6981Smrg</sect1>
239ea1d6981Smrg<sect1 id='The_Keycodes_Component'>
240ea1d6981Smrg<title>The Keycodes Component</title>
241ea1d6981Smrg
242ea1d6981Smrg<para>
243ea1d6981SmrgThe <emphasis>
244ea1d6981Smrgkeycodes</emphasis>
245ea1d6981Smrg component of a keyboard mapping specifies the range and interpretation of the
246ea1d6981Smrgraw keycodes reported by the device. It sets the <emphasis>
247ea1d6981Smrgkeycodes</emphasis>
248ea1d6981Smrg symbolic name, the minimum and maximum legal keycodes for the keyboard, and
249ea1d6981Smrgthe symbolic name for each key. The keycodes component might also contain
250ea1d6981Smrgaliases for some keys, symbolic names for some indicators, and a description of
251ea1d6981Smrgwhich indicators are physically present.
252ea1d6981Smrg</para>
253ea1d6981Smrg
254ea1d6981Smrg
255ea1d6981Smrg<para>
256ea1d6981SmrgThe special keycodes component named "computed" indicates that XKB should
257ea1d6981Smrgassign unused keycodes to any unknown keys referenced by name by any of the
258ea1d6981Smrgother components. The computed keycodes component is useful primarily when
259ea1d6981Smrgbrowsing keymaps because it makes it possible to use the symbols and geometry
260ea1d6981Smrgcomponents without having to find a set of keycodes that includes keycode
261ea1d6981Smrgdefinitions for all of the keys listed in the two components.
262ea1d6981Smrg</para>
263ea1d6981Smrg
264ea1d6981Smrg
265ea1d6981Smrg<para>
266ea1d6981SmrgXKB defines no hints that are specific to the keycodes component.
267ea1d6981Smrg</para>
268ea1d6981Smrg
269ea1d6981Smrg
270ea1d6981Smrg<sect2 id='The_Types_Component'>
271ea1d6981Smrg<title>The Types Component</title>
272ea1d6981Smrg
273ea1d6981Smrg<para>
274ea1d6981SmrgThe <emphasis>
275ea1d6981Smrgtypes</emphasis>
276ea1d6981Smrg component of a keyboard mapping specifies the key types that can be associated
277ea1d6981Smrgwith the various keyboard keys. It affects the <emphasis>
278ea1d6981Smrgtypes</emphasis>
279ea1d6981Smrg symbolic name and the list of types associated with the keyboard (see
280ea1d6981Smrg<link linkend='Key_Types'>Key Types</link>). The types component
281ea1d6981Smrgof a keyboard mapping can also optionally contain real modifier bindings and
282ea1d6981Smrgsymbolic names for one or more virtual modifiers.
283ea1d6981Smrg</para>
284ea1d6981Smrg
285ea1d6981Smrg
286ea1d6981Smrg<para>
287ea1d6981SmrgThe special types component named "canonical" always contains the types and
288ea1d6981Smrgdefinitions listed in <link linkend="canonical_key_types">Canonical Key Types</link> of this document.
289ea1d6981Smrg</para>
290ea1d6981Smrg
291ea1d6981Smrg
292ea1d6981Smrg<para>
293ea1d6981SmrgXKB defines no hints that are specific to the types component.
294ea1d6981Smrg</para>
295ea1d6981Smrg
296ea1d6981Smrg
297ea1d6981Smrg</sect2>
298ea1d6981Smrg<sect2 id='The_Compatibility_Map_Component'>
299ea1d6981Smrg<title>The Compatibility Map Component</title>
300ea1d6981Smrg
301ea1d6981Smrg<para>
302ea1d6981SmrgThe <emphasis>
303ea1d6981Smrgcompatibility map</emphasis>
304ea1d6981Smrg component of a keyboard mapping primarily specifies the rules used to assign
305ea1d6981Smrgactions to keysyms. It affects the <emphasis>
306ea1d6981Smrgcompat</emphasis>
307ea1d6981Smrg symbolic name, the symbol compatibility map and the group compatibility map.
308ea1d6981SmrgThe compat component might also specify maps for some indicators and the real
309ea1d6981Smrgmodifier bindings and symbolic names of some virtual modifiers.
310ea1d6981Smrg</para>
311ea1d6981Smrg
312ea1d6981Smrg
313ea1d6981Smrg<para>
314ea1d6981SmrgXKB defines no hints that are specific to the compatibility map component.
315ea1d6981Smrg</para>
316ea1d6981Smrg
317ea1d6981Smrg
318ea1d6981Smrg</sect2>
319ea1d6981Smrg<sect2 id='The_Symbols_Component'>
320ea1d6981Smrg<title>The Symbols Component</title>
321ea1d6981Smrg
322ea1d6981Smrg<para>
323ea1d6981SmrgThe <emphasis>
324ea1d6981Smrgsymbols</emphasis>
325ea1d6981Smrg component of a keyboard mapping specifies primarily the symbols bound to each
326ea1d6981Smrgkeyboard key. It affects the <emphasis>
327ea1d6981Smrgsymbols</emphasis>
328ea1d6981Smrg symbolic name, a key symbol mapping for each key, they keyboard modifier
329ea1d6981Smrgmapping, and the symbolic names for the keyboard symbol groups. Optionally, the
330ea1d6981Smrg<emphasis>
331ea1d6981Smrgsymbols</emphasis>
332ea1d6981Smrg component can contain explicit actions and behaviors for some keys, or the
333ea1d6981Smrgreal modifier bindings and symbolic names for some virtual modifiers.
334ea1d6981Smrg</para>
335ea1d6981Smrg
336ea1d6981Smrg
337ea1d6981Smrg<para>
338ea1d6981SmrgXKB defines the following additional hints for the symbols component:
339ea1d6981Smrg</para>
340ea1d6981Smrg
341ea1d6981Smrg<informaltable frame='topbot'>
342ea1d6981Smrg<?dbfo keep-together="always" ?>
343ea1d6981Smrg<tgroup cols='2' align='left' colsep='0' rowsep='0'>
344ea1d6981Smrg<colspec colname='c1' colwidth='1.0*'/>
345ea1d6981Smrg<colspec colname='c2' colwidth='3.0*'/>
346ea1d6981Smrg<thead>
347ea1d6981Smrg  <row rowsep='1'>
348ea1d6981Smrg    <entry>Flag</entry>
349ea1d6981Smrg    <entry>Meaning</entry>
350ea1d6981Smrg  </row>
351ea1d6981Smrg</thead>
352ea1d6981Smrg<tbody>
353ea1d6981Smrg  <row>
354ea1d6981Smrg    <entry><emphasis>
355ea1d6981SmrgLC_AlphanumericKeys</emphasis>
356ea1d6981Smrg</entry>
357ea1d6981Smrg    <entry>Indicates a symbol component that contains bindings primarily for an
358ea1d6981Smrgalphanumeric section of the keyboard.</entry>
359ea1d6981Smrg  </row>
360ea1d6981Smrg  <row>
361ea1d6981Smrg    <entry><emphasis>
362ea1d6981SmrgLC_ModifierKeys</emphasis>
363ea1d6981Smrg</entry>
364ea1d6981Smrg    <entry>Indicates a symbol component that contains bindings primarily for
365ea1d6981Smrgmodifier keys.</entry>
366ea1d6981Smrg  </row>
367ea1d6981Smrg  <row>
368ea1d6981Smrg    <entry><emphasis>
369ea1d6981SmrgLC_KeypadKeys</emphasis>
370ea1d6981Smrg</entry>
371ea1d6981Smrg    <entry>Indicates a symbol component that contains bindings primarily for
372ea1d6981Smrgnumeric keypad keys.</entry>
373ea1d6981Smrg  </row>
374ea1d6981Smrg  <row>
375ea1d6981Smrg    <entry>LC_FunctionKeys</entry>
376ea1d6981Smrg    <entry>Indicates a symbol component that contains bindings primarily for
377ea1d6981Smrgfunction keys.</entry>
378ea1d6981Smrg  </row>
379ea1d6981Smrg  <row>
380ea1d6981Smrg    <entry>LC_AlternateGroup</entry>
381ea1d6981Smrg    <entry>Indicates a symbol component that contains bindings for an alternate
382ea1d6981Smrgkeyboard group.</entry>
383ea1d6981Smrg  </row>
384ea1d6981Smrg</tbody>
385ea1d6981Smrg</tgroup>
386ea1d6981Smrg</informaltable>
387ea1d6981Smrg
388ea1d6981Smrg<para>
389ea1d6981SmrgThese hints only apply to partial symbols components; full symbols components
390ea1d6981Smrgare assumed to specify all of the pieces listed above.
391ea1d6981Smrg</para>
392ea1d6981Smrg
393ea1d6981Smrg<note><para>The alphanumeric, modifier, keypad or function keys hints should
394ea1d6981Smrgdescribe the primary intent of the component designer and should not simply an
395ea1d6981Smrgexhaustive list of the kinds of keys that are affected. For example, national
396ea1d6981Smrgkeyboard layouts affect primarily alphanumeric keys, but many affect a few
397ea1d6981Smrgmodifier keys too; such mappings should set only <emphasis>
398ea1d6981SmrgLC_AlphanumericKeys</emphasis>
399ea1d6981Smrg hint. In general, symbol components should set only one of those four flags
400ea1d6981Smrg(though <emphasis>
401ea1d6981SmrgLC_AlternateGroup</emphasis>
402ea1d6981Smrg may be combined with any of the other flags).</para></note>
403ea1d6981Smrg
404ea1d6981Smrg</sect2>
405ea1d6981Smrg<sect2 id='The_Geometry_Component'>
406ea1d6981Smrg<title>The Geometry Component</title>
407ea1d6981Smrg
408ea1d6981Smrg<para>
409ea1d6981SmrgThe <emphasis>
410ea1d6981Smrggeometry</emphasis>
411ea1d6981Smrg component of a keyboard mapping specifies primarily the geometry of the
412ea1d6981Smrgkeyboard. It contains the geometry symbolic name and the keyboard geometry
413ea1d6981Smrgdescription. The geometry component might also contain aliases for some keys or
414ea1d6981Smrgsymbolic names for some indicators and might affect the set of indicators that
415ea1d6981Smrgare physically present. Key aliases defined in the geometry component of a
416ea1d6981Smrgkeyboard mapping override those defined in the keycodes component.
417ea1d6981Smrg</para>
418ea1d6981Smrg
419ea1d6981Smrg
420ea1d6981Smrg<para>
421ea1d6981SmrgXKB defines no hints that are specific to the geometry component.
422ea1d6981Smrg</para>
423ea1d6981Smrg
424ea1d6981Smrg
425ea1d6981Smrg</sect2>
426ea1d6981Smrg</sect1>
427ea1d6981Smrg<sect1 id='Complete_Keymaps'>
428ea1d6981Smrg<title>Complete Keymaps</title>
429ea1d6981Smrg
430ea1d6981Smrg<para>
431ea1d6981SmrgThe X server also reports a set of fully specified keymaps. The keymaps
432ea1d6981Smrgspecified in this list are usually assembled from the components stored in the
433ea1d6981Smrgrest of the database and typically represent the most commonly used keymaps for
434ea1d6981Smrga particular system.
435ea1d6981Smrg</para>
436ea1d6981Smrg
437ea1d6981Smrg
438ea1d6981Smrg<para>
439ea1d6981SmrgXKB defines no hints that are specific to complete keymaps.
440ea1d6981Smrg</para>
441ea1d6981Smrg</sect1>
442ea1d6981Smrg</chapter>
443