1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3	  "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
4<chapter id='Keyboard_Geometry'>
5<title>Keyboard Geometry</title>
6
7<para>
8The Xkb description of a keyboard includes an optional keyboard geometry that
9describes the physical appearance of the keyboard. Keyboard geometry describes
10the shape, location, and color of all keyboard keys or other visible keyboard
11components such as indicators. The information contained in a keyboard geometry
12is sufficient to allow a client program to draw an accurate two-dimensional
13image of the keyboard.
14</para>
15
16
17<para>
18You can retrieve a keyboard geometry from an X server that supports Xkb, or you
19can allocate it from scratch and initialize it in a client program. The
20keyboard geometry need not have any correspondence with the physical keyboard
21that is connected to the X server.
22</para>
23
24
25<para>
26Geometry measurements are specified in mm/10 units. The origin (0,0) is in the
27top left corner of the keyboard image. A component’s own origin is also its
28upper left corner. In some cases a component needs to be drawn rotated. For
29example, a special keyboard may have a section of keys arranged in rows in a
30rectangular area, but the entire rectangle may not be in alignment with the
31rest of the keyboard, and instead, it is rotated from horizontal by 30°.
32Rotation for a geometry object is specified in 1/10° increments about its
33origin. An example of a keyboard with rotated sections is shown in <link linkend="figure13.1">Figure 13.1</link>.
34</para>
35
36<figure id='figure13.1'>
37  <title>Rotated Keyboard Sections</title>
38  <mediaobject>
39   <imageobject> <imagedata format="SVG" fileref="XKBlib-7.svg"/>
40   </imageobject>
41  </mediaobject>
42</figure>
43
44
45<!-- <H5 CLASS="Figure">
46Rotated Keyboard Sections</H5>
47-->
48
49<para>
50Some geometry components include a
51<structfield>priority</structfield>,
52which indicates the order in which overlapping objects should be drawn.
53Objects should be drawn in order from highest priority (0) to lowest (255).
54</para>
55
56
57<para id='XkbGeometryRec'>
58<indexterm significance="preferred" zone="XkbGeometryRec">
59<primary><structname>XkbGeometryRec</structname></primary></indexterm>
60The keyboard geometry’s top-level description is stored in a
61<structname>XkbGeometryRec</structname>
62structure. This structure contains three types of information:
63</para>
64
65<orderedlist>
66  <listitem>
67    <para>
68Lists of items, not used to draw the basic keyboard, but indexed by the
69geometry descriptions that comprise the entire keyboard geometry (colors,
70geometry properties, key aliases, shapes)
71    </para>
72  </listitem>
73  <listitem>
74    <para>
75A number of singleton items that describe the keyboard as a whole (keyboard
76name, width and height, a color for the keyboard as a whole, and a color for
77keyboard key labels)
78    </para>
79  </listitem>
80  <listitem>
81    <para>
82A list of the keyboard’s sections and nonkey doodads
83    </para>
84  </listitem>
85</orderedlist>
86
87<para>
88The top-level geometry is described in more detail in the following.
89</para>
90
91
92<para>
93The lists of items used by components of the keyboard geometry description is
94as follows:
95</para>
96
97<itemizedlist>
98<listitem>
99  <para>
100The top-level keyboard geometry description includes a list of up to
101<symbol>XkbGeomMaxColors</symbol>
102(32)
103<firstterm>color names</firstterm>.
104A color name is a string whose interpretation is not specified by Xkb. The
105<structname>XkbColorRec</structname>
106structure provides a field for this name as well as a pixel field. The pixel
107field is a convenient place for an application to store a pixel value or color
108definition, if it needs to. All other geometry data structures refer to colors
109using their indices in this global list.
110  </para>
111</listitem>
112<listitem>
113  <para>
114The top-level keyboard geometry description includes a list of
115<firstterm>geometry properties</firstterm>.
116A geometry property associates an arbitrary string with an equally arbitrary
117name. Geometry properties can be used to provide hints to programs that display
118images of keyboards, but they are not interpreted by Xkb. No other geometry
119structures refer to geometry properties. As an example of a possible use of
120<structfield>properties</structfield>,
121consider the pause/break key on most PC keyboards: the <quote>break</quote>
122symbol is
123usually on the front of the key and is often a different color. A program might
124set a property to:
125  </para>
126  <para>
127LBL_PAUS = "{Pause/top/black,Break/front/red}"
128  </para>
129  <para>
130and use the property information to draw the key with a front label as well as
131a top label.
132  </para>
133</listitem>
134<listitem>
135  <para>
136The top-level keyboard geometry description includes a list of
137<firstterm>key aliases</firstterm>
138(see <xref linkend="Symbolic_Names" />). Key aliases allow the keyboard layout designer to assign
139multiple key names to a single key.
140  </para>
141<note><para>Key aliases defined in the geometry component of a keyboard mapping
142override those defined in the keycodes component of the server database, which
143are stored in the
144<structname>XkbNamesRec</structname>
145
146(<structfield>xkb-&gt;names</structfield>).
147Therefore, consider the key aliases defined by the geometry before
148considering key aliases supplied by the keycodes.</para></note>
149</listitem>
150<listitem>
151  <para>
152The top-level keyboard geometry description includes a list of
153<structfield>shapes</structfield>;
154other keyboard components refer to shapes by their index in this list. A
155shape consists of an arbitrary name of type Atom and one or more closed-polygon
156<structfield>outlines</structfield>.
157All points in an outline are specified relative to the origin of its
158enclosing shape, that is, whichever shape that contains this outline in its
159list of outlines. One outline is the primary outline. The primary outline is by
160default the first outline, or it can be optionally specified by the
161<structfield>primary</structfield>
162field in the
163<structname>XkbShapeRec</structname>
164structure. A keyboard display application can generate a simpler but still
165accurate keyboard image by displaying only the primary outlines for each shape.
166Nonrectangular keys must include a rectangular
167<firstterm>approximation</firstterm>
168as one of the outlines associated with the shape. The approximation is not
169normally displayed but can be used by very simple keyboard display applications
170to generate a recognizable but degraded image of the keyboard.
171  </para>
172</listitem>
173</itemizedlist>
174
175<para>
176The
177<structname>XkbGeometryRec</structname>
178top-level geometry description contains the following information that
179pertains to the keyboard as a whole:
180</para>
181
182<itemizedlist>
183<listitem>
184  <para>
185A
186<firstterm>keyboard symbolic name</firstterm>
187of type Atom to help users identify the keyboard.
188  </para>
189</listitem>
190<listitem>
191  <para>
192The
193<structfield>width</structfield>
194and
195<structfield>height</structfield>
196of the keyboard, in mm/10. For nonrectangular keyboards, the width and height
197describe the smallest bounding box that encloses the outline of the keyboard.
198  </para>
199</listitem>
200<listitem>
201  <para>
202The
203<firstterm>base color</firstterm>
204of the keyboard is the predominant color on the keyboard and is used as the
205default color for any components whose color is not explicitly specified.
206  </para>
207</listitem>
208<listitem>
209  <para>
210The
211<firstterm>label color</firstterm>
212is the color used to draw the labels on most of the keyboard keys.
213  </para>
214</listitem>
215<listitem>
216  <para>
217The
218<firstterm>label font</firstterm>
219is a string that describes the font used to draw labels on most keys; label
220fonts are arbitrary strings, because Xkb does not specify the format or name
221space for font names.
222  </para>
223</listitem>
224</itemizedlist>
225
226<para>
227The keyboard is subdivided into named
228<structfield>sections</structfield>
229of related keys and doodads. The sections and doodads on the keyboard are
230listed in the
231<structname>XkbGeometryRec</structname>
232top-level keyboard geometry description. A section is composed of keys that
233are physically together and logically related. <link linkend="figure13.2">Figure 13.2</link> shows a keyboard
234that is divided into four sections. A
235<structfield>doodad</structfield>
236describes some visible aspect of the keyboard that is not a key and is not a
237section.
238</para>
239
240<figure id='figure13.2'>
241  <title>Keyboard with Four Sections</title>
242  <mediaobject>
243   <imageobject> <imagedata format="SVG" fileref="XKBlib-8.svg"/>
244   </imageobject>
245  </mediaobject>
246</figure>
247
248<!--
249<H5 CLASS="Figure">
250Keyboard with Four Sections</H5>
251-->
252
253<sect1 id='Shapes_and_Outlines'>
254<title>Shapes and Outlines</title>
255
256<para>
257A
258<structfield>shape</structfield>,
259used to draw keyboard components and stored in a
260<structname>XkbShapeRec</structname>
261structure, has:
262</para>
263
264<itemizedlist>
265<listitem>
266  <para>
267An arbitrary name of type Atom.
268  </para>
269</listitem>
270<listitem>
271  <para>
272Bounds (two x and y coordinates) that describe the corners of a rectangle
273containing the shape’s top surface outline.
274  </para>
275</listitem>
276<listitem>
277  <para>
278A list of one or more outlines (described below).
279  </para>
280</listitem>
281<listitem>
282  <para>
283Optional pointers to a primary and an approximation outline (described below).
284If either of these pointers is
285<symbol>NULL</symbol>,
286the default primary/approximation outline is the first one in the list of
287outlines for the shape.
288  </para>
289</listitem>
290</itemizedlist>
291
292<para>
293An
294<firstterm>outline</firstterm>,
295stored in a
296<structname>XkbOutlineRec</structname>
297structure, is a list of one or more points that describes a single
298closed-polygon, as follows:
299</para>
300
301<itemizedlist>
302<listitem>
303  <para>
304A list with a single point describes a rectangle with one corner at the origin
305of the shape (0,0) and the opposite corner at the specified point.
306  </para>
307</listitem>
308<listitem>
309  <para>
310A list of two points describes a rectangle with one corner at the position
311specified by the first point and the opposite corner at the position specified
312by the second point.
313  </para>
314</listitem>
315<listitem>
316  <para>
317A list of three or more points describes an arbitrary polygon. If necessary,
318the polygon is automatically closed by connecting the last point in the list
319with the first.
320  </para>
321</listitem>
322<listitem>
323  <para>
324A nonzero value for the
325<structfield>corner_radius</structfield>
326field specifies that the corners of the polygon should be drawn as circles
327with the specified radius.
328  </para>
329</listitem>
330</itemizedlist>
331
332<para>
333All points in an outline are specified relative to the origin of the enclosing
334shape. Points in an outline may have negative values for the X and Y coordinate.
335</para>
336
337
338<para>
339One outline is the primary outline; a keyboard display application can generate
340a simple but still accurate keyboard image by displaying only the primary
341outlines for each shape. The default primary outline is the first in a
342shape’s list of outlines. If the
343<structfield>primary</structfield>
344field of the
345<structname>XkbShapeRec</structname>
346structure is not
347<symbol>NULL</symbol>,
348it points to the primary outline. A rectangular
349<firstterm>approximation</firstterm>
350must be included for nonrectangular keys as one of the outlines associated
351with the shape; the approximation is not normally displayed but can be used by
352very simple keyboard display applications to generate a recognizable but
353degraded image of the keyboard.
354</para>
355
356</sect1>
357<sect1 id='Sections'>
358<title>Sections</title>
359
360<para>
361As previously noted, a keyboard is subdivided into
362<structfield>sections</structfield>
363of related keys. Each section has its own coordinate system — if a section
364is rotated, the coordinates of any components within the section are
365interpreted relative to the edges that were on the top and left before
366rotation. The components that make up a section, stored in a
367<structname>XkbSectionRec</structname>,
368include:
369</para>
370
371<itemizedlist>
372<listitem>
373  <para>
374An arbitrary name of type Atom.
375  </para>
376</listitem>
377<listitem>
378  <para>
379A priority, to indicate drawing order. 0 is the highest priority, 255 the
380lowest.
381  </para>
382</listitem>
383<listitem>
384  <para>
385Origin of the section, relative to the origin of the keyboard.
386  </para>
387</listitem>
388<listitem>
389  <para>
390The width and height and the angle of rotation.
391  </para>
392</listitem>
393<listitem>
394  <para>
395A list of
396<structfield>rows</structfield>.
397A row is a list of horizontally or vertically adjacent keys. Horizontal rows
398parallel the (prerotation) top of the section, and vertical rows parallel the
399(prerotation) left of the section. All keys in a horizontal row share a common
400top coordinate; all keys in a vertical row share a left coordinate. <link linkend="figure13.3">Figure 13.3</link>
401shows the alpha section from the keyboard shown in <link linkend="figure13.2">Figure 13.2</link>, divided into
402rows. Rows and keys are defined below.
403  </para>
404</listitem>
405</itemizedlist>
406
407<figure id='figure13.3'>
408  <title>Rows in a Section</title>
409  <mediaobject>
410    <imageobject> <imagedata format="SVG" fileref="XKBlib-9.svg"/>
411    </imageobject>
412  </mediaobject>
413</figure>
414
415
416
417<!--
418<H5 CLASS="Figure">
419Rows in a Section</H5>
420-->
421<itemizedlist>
422<listitem>
423  <para>
424An optional list of
425<structfield>doodads</structfield>;
426any type of doodad can be enclosed within a section. Position and angle of
427rotation are relative to the origin and angle of rotation of the sections that
428contain them. Priority for doodads in a section is relative to the other
429components of the section, not to the keyboard as a whole.
430  </para>
431</listitem>
432<listitem>
433  <para>
434An optional
435<firstterm>overlay</firstterm>
436with a name of type Atom and a list of overlay rows (described below).
437  </para>
438</listitem>
439<listitem>
440  <para>
441Bounds (two x and y coordinates) that describe the corners of a rectangle
442containing the entire section.
443  </para>
444</listitem>
445</itemizedlist>
446</sect1>
447<sect1 id='Rows_and_Keys'>
448<title>Rows and Keys</title>
449
450<para>
451A row description
452(<structname>XkbRowRec</structname>)
453consists of the coordinates of its origin relative to its enclosing section,
454a flag indicating whether the row is horizontal or vertical, and a list of keys
455in the row.
456</para>
457
458
459<para>
460A key description
461(<structname>XkbKeyRec</structname>)
462consists of a key name, a shape, a key color, and a gap. The key name should
463correspond to one of the keys named in the keyboard names description, the
464shape specifies the appearance of the key, and the key color specifies the
465color of the key (not the label on the key; the label color is stored in the
466<structname>XkbGeometryRec</structname>).
467Keys are normally drawn immediately adjacent to one another from left to
468right (or top to bottom) within a row. The gap field specifies the distance
469between a key and its predecessor.
470</para>
471
472
473</sect1>
474<sect1 id='Doodads'>
475<title>Doodads</title>
476
477<para>
478Doodads can be global to the keyboard or part of a section. Doodads have
479symbolic names of arbitrary length. The only doodad name whose interpretation
480is specified by Xkb is <quote>Edges</quote>, which, if present, describes the
481outline of the entire keyboard.
482</para>
483
484
485<para>
486Each doodad’s origin is stored in fields named
487<structfield>left</structfield>
488and
489<structfield>top</structfield>,
490which are the coordinates of the doodad’s origin relative to its enclosing
491object, whether it be a section or the top-level keyboard. The priority for
492doodads that are listed in the top-level geometry is relative to the other
493doodads listed in the top-level geometry and the sections listed in the
494top-level geometry. The priority for doodads listed in a section are relative
495to the other components of the section. Each doodad is stored in a structure
496with a
497<structfield>type</structfield>
498field, which specifies the type of doodad.
499</para>
500
501<para>
502Xkb supports five types of doodads:
503</para>
504
505<itemizedlist>
506<listitem>
507  <para>
508An
509<firstterm>indicator doodad</firstterm>
510describes one of the physical keyboard indicators. Indicator doodads specify
511the shape of the indicator, the indicator color when it is lit
512(<emphasis>on_color</emphasis>)
513and the indicator color when it is dark
514(<emphasis>off_color</emphasis>).
515
516  </para>
517</listitem>
518<listitem>
519  <para>
520An
521<firstterm>outline doodad</firstterm>
522describes some aspect of the keyboard to be drawn as one or more hollow,
523closed polygons. Outline doodads specify the shape, color, and angle of
524rotation about the doodad origin at which they should be drawn.
525  </para>
526</listitem>
527<listitem>
528  <para>
529A
530<firstterm>solid doodad</firstterm>
531describes some aspect of the keyboard to be drawn as one or more filled
532polygons. Solid doodads specify the shape, color, and angle of rotation about
533the doodad origin at which they should be drawn.
534  </para>
535</listitem>
536<listitem>
537  <para>
538A
539<firstterm>text doodad</firstterm>
540describes a text label somewhere on the keyboard. Text doodads specify the
541label string, the font and color to use when drawing the label, and the angle
542of rotation of the doodad about its origin.
543  </para>
544</listitem>
545<listitem>
546  <para>
547A
548<firstterm>logo doodad</firstterm>
549is a catch-all, which describes some other visible element of the keyboard. A
550logo doodad is essentially an outline doodad with an additional symbolic name
551that describes the element to be drawn. If a keyboard display program
552recognizes the symbolic name, it can draw something appropriate within the
553bounding region of the shape specified in the doodad. If the symbolic name does
554not describe a recognizable image, it should draw an outline using the
555specified shape, outline, and angle of rotation. The Xkb extension does not
556specify the interpretation of logo names.
557  </para>
558</listitem>
559</itemizedlist>
560
561<para>
562The structures these doodads are stored in and the values of the
563<structfield>type</structfield>
564fields are shown in <link linkend="table13.1">Table 13.1</link>.
565</para>
566
567<table id='table13.1' frame='topbot'>
568<title>Doodad Types</title>
569<?dbfo keep-together="always" ?>
570<tgroup cols='3' align='left' colsep='0' rowsep='0'>
571<colspec colname='c1' colwidth='1.0*'/>
572<colspec colname='c2' colwidth='1.0*'/>
573<colspec colname='c3' colwidth='1.0*'/>
574<thead>
575<row rowsep='1'>
576  <entry>Doodad</entry>
577  <entry>Structure</entry>
578  <entry>Type</entry>
579  </row>
580</thead>
581<tbody>
582  <row>
583    <entry>
584<emphasis>indicator doodad</emphasis>
585</entry>
586    <entry>
587<structname>XkbIndicatorDoodadRec</structname>
588</entry>
589    <entry>
590<symbol>XkbIndicatorDoodad</symbol>
591</entry>
592  </row>
593  <row>
594    <entry>
595<emphasis>outline doodad</emphasis>
596</entry>
597    <entry>
598<structname>XkbShapeDoodadRec</structname>
599</entry>
600    <entry>
601<symbol>XkbOutlineDoodad</symbol>
602</entry>
603  </row>
604  <row>
605    <entry>
606<emphasis>solid doodad</emphasis>
607</entry>
608    <entry>
609<structname>XkbShapeDoodadRec</structname>
610</entry>
611    <entry>
612<symbol>XkbSolidDoodad</symbol>
613</entry>
614  </row>
615  <row>
616    <entry>
617<emphasis>text doodad</emphasis>
618</entry>
619    <entry>
620<structname>XkbTextDoodadRec</structname>
621</entry>
622    <entry>
623<symbol>XkbTextDoodad</symbol>
624</entry>
625  </row>
626  <row>
627    <entry>
628<emphasis>logo doodad</emphasis>
629</entry>
630    <entry>
631<structname>XkbLogoDoodadRec</structname>
632</entry>
633    <entry>
634<symbol>XkbLogoDoodad</symbol>
635</entry>
636  </row>
637</tbody>
638</tgroup>
639</table>
640
641</sect1>
642<sect1 id='Overlay_Rows_and_Overlay_Keys'>
643<title>Overlay Rows and Overlay Keys</title>
644
645<para>
646An
647<firstterm>overlay row</firstterm>
648
649(<structname>XkbOverlayRowRec</structname>)
650contains a pointer to the row it overlays and a list of
651<firstterm>overlay keys</firstterm>.
652</para>
653
654
655<para>
656Each overlay key definition
657(<structname>XkbOverlayKeyRec</structname>)
658indicates a key that can yield multiple keycodes and consists of a field
659named
660<structfield>under</structfield>,
661which specifies the primary name of the key and a field named
662<structfield>over</structfield>,
663which specifies the name for the key when the overlay keycode is selected.
664The key specified in
665<structfield>under</structfield>
666must be a member of the section that contains the overlay key definition,
667while the key specified in over must not be.
668</para>
669
670
671</sect1>
672<sect1 id='Drawing_a_Keyboard_Representation'>
673<title>Drawing a Keyboard Representation</title>
674
675<para>
676To draw a representation of the keyboard, draw in the following order:
677
678<programlisting>
679     Draw the top-level keyboard as a rectangle, using its width and height.
680     For each component (section or doodad) of the top-level geometry, in priority order:
681        If component is a section
682           For each row, in the order it appears in the section
683              Draw keys in the order they appear in the row
684           Draw doodads within the section in priority order.
685        Else draw doodad
686</programlisting></para>
687
688</sect1>
689<sect1 id='Geometry_Data_Structures'>
690<title>Geometry Data Structures</title>
691
692<para>
693In the following figures, a solid arrow denotes a pointer to an array of
694structures or a singleton structure. A dotted arrow denotes an index or a
695pointer into the array.
696</para>
697
698<!--
699<MAP NAME="XKBlib-10">
700</MAP>
701-->
702<figure id='figure13.4'>
703  <title>Xkb Geometry Data Structures</title>
704  <mediaobject>
705   <imageobject> <imagedata format="SVG" fileref="XKBlib-10.svg"/>
706   </imageobject>
707  </mediaobject>
708</figure>
709
710<!--
711<H5 CLASS="Figure">
712Xkb Geometry Data Structures</H5>
713<P CLASS="SmallBody">
714&nbsp;</P>
715<MAP NAME="XKBlib-11">
716</MAP>
717-->
718<figure id='figure13.5'>
719  <title>Xkb Geometry Data Structures (Doodads)</title>
720  <mediaobject>
721   <imageobject> <imagedata format="SVG" fileref="XKBlib-11.svg"/>
722   </imageobject>
723  </mediaobject>
724</figure>
725
726<!--
727<H5 CLASS="Figure">
728Xkb Geometry Data Structures (Doodads)</H5>
729-->
730
731<!--
732<MAP NAME="XKBlib-12">
733</MAP>
734-->
735<figure id='figure13.6'>
736  <title>Xkb Geometry Data Structures (Overlays)</title>
737  <mediaobject>
738   <imageobject> <imagedata format="SVG" fileref="XKBlib-12.svg"/>
739   </imageobject>
740  </mediaobject>
741</figure>
742
743<!--
744<H5 CLASS="Figure">
745Xkb Geometry Data Structures (Overlays)</H5>
746-->
747<para><programlisting>
748typedef struct _XkbGeometry {    /* top-level keyboard geometry structure */
749    Atom              name;            /* keyboard name */
750    unsigned short    width_mm;        /* keyboard width in <superscript>mm</superscript>/<subscript>10</subscript> */
751    unsigned short    height_mm;       /* keyboard height in <superscript>mm</superscript>/<subscript>10</subscript> */
752    char *            label_font;      /* font for key labels */
753    XkbColorPtr       label_color;     /* color for key labels
754                                          - pointer into colors array */
755    XkbColorPtr       base_color;      /* color for basic keyboard
756                                          - pointer into colors array */
757    unsigned short    sz_properties;   /* size of properties array */
758    unsigned short    sz_colors;       /* size of colors array */
759    unsigned short    sz_shapes;       /* size of shapes array */
760    unsigned short    sz_sections;     /* size of sections array */
761    unsigned short    sz_doodads;      /* size of doodads array */
762    unsigned short    sz_key_aliases;  /* size of key aliases array */
763    unsigned short    num_properties;  /* number of properties in the
764                                           properties array */
765    unsigned short    num_colors;      /* number of colors in the
766                                           colors array */
767    unsigned short    num_shapes;      /* number of shapes in the
768                                           shapes array */
769    unsigned short    num_sections;    /* number of sections in the
770                                           sections array */
771    unsigned short    num_doodads;     /* number of doodads in the
772                                           doodads array */
773    unsigned short    num_key_aliases; /* number of key aliases in the
774                                           key_aliases array */
775    XkbPropertyPtr    properties;      /* properties array */
776    XkbColorPtr       colors;          /* colors array */
777    XkbShapePtr       shapes;          /* shapes array */
778    XkbSectionPtr     sections;        /* sections array */
779    XkbDoodadPtr      doodads;         /* doodads array */
780    XkbKeyAliasPtr    key_aliases;     /* key aliases array */
781} <structname>XkbGeometryRec</structname>, *XkbGeometryPtr;
782</programlisting></para>
783
784<para>
785The
786<structfield>doodads</structfield>
787array is only for doodads not contained in any of the
788<structfield>sections</structfield>
789that has its own
790<structfield>doodads</structfield>.
791The key aliases contained in the
792<structfield>key_aliases</structfield>
793array take precedence over any defined in the keycodes component of the
794keyboard description.
795</para>
796
797<para><programlisting>
798typedef struct _XkbProperty {
799    char *      name;                   /* property name */
800    char *      value;                  /* property value */
801} <structname>XkbPropertyRec</structname>, *XkbPropertyPtr;
802</programlisting></para>
803
804<para><programlisting>
805typedef struct _XkbColor {
806    unsigned int      pixel;            /* color */
807    char *            spec;             /* color name */
808} <structname>XkbColorRec</structname>, *XkbColorPtr;
809</programlisting></para>
810
811<para><programlisting>
812typedef struct _XkbKeyAliasRec {
813    char      real[XkbKeyNameLength];   /* real name of the key */
814    char      alias[XkbKeyNameLength];  /* alias for the key */
815} <structname>XkbKeyAliasRec</structname>, *XkbKeyAliasPtr;
816</programlisting></para>
817
818<para><programlisting>
819typedef struct _XkbPoint {              /* x, y coordinates */
820    short      x;
821    short      y;
822} <structname>XkbPointRec</structname>, *XkbPointPtr;
823</programlisting></para>
824
825<para><programlisting>
826typedef struct _XkbOutline {
827    unsigned short      num_points;     /* number of points in the outline */
828    unsigned short      sz_points;      /* size of the points array */
829    unsigned short      corner_radius;  /* draw corners as circles
830                                           with this radius */
831    XkbPointPtr         points;         /* array of points defining
832                                           the outline */
833} <structname>XkbOutlineRec</structname>, *XkbOutlinePtr;
834</programlisting></para>
835
836<para><programlisting>
837typedef struct _XkbBounds {
838    short      x1, y1;       /* upper left corner of the bounds, in <superscript>mm</superscript>/<subscript>10</subscript> */
839    short      x2, y2;       /* lower right corner of the bounds, in <superscript>mm</superscript>/<subscript>10</subscript> */
840} <structname>XkbBoundsRec</structname>, *XkbBoundsPtr;
841</programlisting></para>
842
843<para><programlisting>
844typedef struct _XkbShape {
845    Atom              name;             /* shape’s name */
846    unsigned short    num_outlines;     /* number of outlines for the shape */
847    unsigned short    sz_outlines;      /* size of the outlines array */
848    XkbOutlinePtr     outlines;         /* array of outlines for the shape */
849    XkbOutlinePtr     approx;           /* pointer into the array to the
850                                           approximating outline */
851    XkbOutlinePtr     primary;          /* pointer into the array to the
852                                           primary outline */
853    XkbBoundsRec      bounds;           /* bounding box for the shape;
854                                           encompasses all outlines */
855} <structname>XkbShapeRec</structname>, *XkbShapePtr;
856</programlisting></para>
857
858<para>
859If
860<structfield>approx</structfield>
861and/or
862<structfield>primary</structfield>
863is
864<symbol>NULL</symbol>,
865the default value is used. The default primary outline is the first element
866in the outlines array, as is the default approximating outline.
867</para>
868
869<para><programlisting>
870typedef struct _XkbKey {           /* key in a row */
871    XkbKeyNameRec    name;         /* key name */
872    short            gap;          /* gap in <superscript>mm</superscript>/<subscript>10</subscript> from previous key in row */
873    unsigned char    shape_ndx;    /* index of shape for key */
874    unsigned char    color_ndx;    /* index of color for key body */
875} <structname>XkbKeyRec</structname>, *XkbKeyPtr;
876</programlisting></para>
877
878<para><programlisting>
879typedef struct _XkbRow {           /* row in a section */
880    short               top;       /* top coordinate of row origin,
881                                      relative to section’s origin */
882    short               left;      /* left coordinate of row origin,
883                                      relative to section’s origin */
884    unsigned short      num_keys;  /* number of keys in the keys array */
885    unsigned short      sz_keys;   /* size of the keys array */
886    int                 vertical;  /* <symbol>True</symbol> &rArr;vertical row,
887                                      <symbol>False</symbol> &rArr;horizontal row */
888    XkbKeyPtr           keys;      /* array of keys in the row */
889    XkbBoundsRec        bounds;    /* bounding box for the row */
890} <structname>XkbRowRec</structname>, *XkbRowPtr;
891</programlisting></para>
892
893<para>
894<structfield>top</structfield>
895and
896<structfield>left</structfield>
897are in
898<superscript>mm</superscript>/<subscript>10</subscript>.
899</para>
900
901<para><programlisting>
902typedef struct _XkbOverlayRec {
903    Atom              name;           /* overlay name */
904    XkbSectionPtr     section_under;  /* the section under this overlay */
905    unsigned short    num_rows;       /* number of rows in the rows array */
906    unsigned short    sz_rows;        /* size of the rows array */
907    XkbOverlayRowPtr  rows;           /* array of rows in the overlay */
908    XkbBoundsPtr      bounds;         /* bounding box for the overlay */
909} <structname>XkbOverlayRec</structname>, *XkbOverlayPtr;
910</programlisting></para>
911
912<para><programlisting>
913typedef struct _XkbOverlayRow {
914    unsigned short      row_under;    /* index into the row under this
915                                         overlay row */
916    unsigned short      num_keys;     /* number of keys in the keys array */
917    unsigned short      sz_keys;      /* size of the keys array */
918    XkbOverlayKeyPtr    keys;         /* array of keys in the overlay row */
919} <structname>XkbOverlayRowRec</structname>, *XkbOverlayRowPtr;
920</programlisting></para>
921
922<para>
923<structfield>row_under</structfield>
924is an index into the array of
925<structfield>rows</structfield>
926in the section under this overlay. The section under this overlay row is the
927one pointed to by
928<structfield>section_under</structfield>
929in this overlay row’s
930<structname>XkbOverlayRec</structname>.
931</para>
932
933<para><programlisting>
934typedef struct _XkbOverlayKey {
935    XkbKeyNameRec      over;      /* name of this overlay key */
936    XkbKeyNameRec      under;     /* name of the key under this overlay key */
937} <structname>XkbOverlayKeyRec</structname>, *XkbOverlayKeyPtr;
938</programlisting></para>
939
940<para><programlisting>
941typedef struct _XkbSection {
942    Atom            name;          /* section name */
943    unsigned char   priority;      /* drawing priority, 0&rArr;highest, 255&rArr;lowest */
944    short           top;           /* top coordinate of section origin */
945    short           left;          /* left coordinate of row origin */
946    unsigned short  width;         /* section width, in <superscript>mm</superscript>/<subscript>10</subscript> */
947    unsigned short  height;        /* section height, in <superscript>mm</superscript>/<subscript>10</subscript> */
948    short           angle;         /* angle of section rotation,
949                                      counterclockwise */
950    unsigned short  num_rows;      /* number of rows in the rows array */
951    unsigned short  num_doodads;   /* number of doodads in the doodads array */
952    unsigned short  num_overlays;  /* number of overlays in the overlays array */
953    unsigned short  sz_rows;       /* size of the rows array */
954    unsigned short  sz_doodads;    /* size of the doodads array */
955    unsigned short  sz_overlays;   /* size of the overlays array */
956    XkbRowPtr       rows;          /* section rows array */
957    XkbDoodadPtr    doodads;       /* section doodads array */
958    XkbBoundsRec    bounds;        /* bounding box for the section,
959                                      before rotation */
960    XkbOverlayPtr   overlays;      /* section overlays array */
961} <structname>XkbSectionRec</structname>, *XkbSectionPtr;
962</programlisting></para>
963
964<para>
965<structfield>top</structfield>
966and
967<structfield>left</structfield>
968are the origin of the section, relative to the origin of the keyboard, in
969<superscript>mm</superscript>/<subscript>10</subscript>.
970<structfield>angle</structfield>
971is in
972<superscript>1</superscript>/<subscript>10</subscript>
973degrees.
974</para>
975
976<sect2 id='DoodadRec_Structures'>
977<title>DoodadRec Structures</title>
978
979<para>
980The doodad arrays in the
981<structname>XkbGeometryRec</structname>
982and the
983<structname>XkbSectionRec</structname>
984may contain any of the doodad structures and types shown in
985<link linkend="table13.1">Table 13.1</link>.
986</para>
987
988
989<para>
990The doodad structures form a union:
991</para>
992
993<para><programlisting>
994typedef union _XkbDoodad {
995      XkbAnyDoodadRec        any;
996      XkbShapeDoodadRec      shape;
997      XkbTextDoodadRec       text;
998      XkbIndicatorDoodadRec  indicator;
999      XkbLogoDoodadRec       logo;
1000} <structname>XkbDoodadRec</structname>, *XkbDoodadPtr;
1001</programlisting></para>
1002
1003<para>
1004The
1005<structfield>top</structfield>
1006and
1007<structfield>left</structfield>
1008coordinates of each doodad are the coordinates of the origin of the doodad
1009relative to the keyboard’s origin if the doodad is in the
1010<structname>XkbGeometryRec</structname>
1011doodad array, and with respect to the section’s origin if the doodad is in a
1012<structname>XkbSectionRec</structname>
1013doodad array. The
1014<structfield>color_ndx</structfield>
1015or
1016<structfield>on_color_ndx</structfield>
1017and
1018<structfield>off_color_ndx</structfield>
1019fields are color indices into the
1020<structname>XkbGeometryRec</structname>’s
1021color array and are the colors to draw the doodads with. Similarly, the
1022<structfield>shape_ndx</structfield>
1023fields are indices into the
1024<structname>XkbGeometryRec</structname>’s
1025shape array.
1026</para>
1027
1028<para><programlisting>
1029typedef struct _XkbShapeDoodad {
1030    Atom             name;         /* doodad name */
1031    unsigned char    type;         /* <symbol>XkbOutlineDoodad</symbol>
1032                                      or <symbol>XkbSolidDoodad</symbol> */
1033    unsigned char    priority;     /* drawing priority,
1034                                       0&rArr;highest, 255&rArr;lowest */
1035    short            top;          /* top coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
1036    short            left;         /* left coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
1037    short            angle;        /* angle of rotation, clockwise,
1038                                      in <superscript>1</superscript>/<subscript>10</subscript> degrees */
1039    unsigned short   color_ndx;    /* doodad color */
1040    unsigned short   shape_ndx;    /* doodad shape */
1041} <structname>XkbShapeDoodadRec</structname>, *XkbShapeDoodadPtr;
1042</programlisting></para>
1043
1044<para><programlisting>
1045typedef struct _XkbTextDoodad {
1046    Atom             name;         /* doodad name */
1047    unsigned char    type;         /* <symbol>XkbTextDoodad</symbol> */
1048    unsigned char    priority;     /* drawing priority,
1049                                     0&rArr;highest, 255&rArr;lowest */
1050    short            top;          /* top coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
1051    short            left;         /* left coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
1052    short            angle;        /* angle of rotation, clockwise,
1053                                      in <superscript>1</superscript>/<subscript>10</subscript> degrees */
1054    short            width;        /* width in <superscript>mm</superscript>/<subscript>10</subscript> */
1055    short            height;       /* height in <superscript>mm</superscript>/<subscript>10</subscript> */
1056    unsigned short   color_ndx;    /* doodad color */
1057    char *           text;         /* doodad text */
1058    char *           font;         /* arbitrary font name for doodad text */
1059} <structname>XkbTextDoodadRec</structname>, *XkbTextDoodadPtr;
1060</programlisting></para>
1061
1062<para><programlisting>
1063typedef struct _XkbIndicatorDoodad {
1064    Atom             name;         /* doodad name */
1065    unsigned char    type;         /* <symbol>XkbIndicatorDoodad</symbol> */
1066    unsigned char    priority;     /* drawing priority, 0&rArr;highest, 255&rArr;lowest */
1067    short            top;          /* top coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
1068    short            left;         /* left coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
1069    short            angle;        /* angle of rotation, clockwise,
1070                                      in <superscript>1</superscript>/<subscript>10</subscript> degrees */
1071    unsigned short   shape_ndx;    /* doodad shape */
1072    unsigned short   on_color_ndx; /* color for doodad if indicator is on */
1073    unsigned short   off_color_ndx;/* color for doodad if indicator is off */
1074} <structname>XkbIndicatorDoodadRec</structname>, *XkbIndicatorDoodadPtr;
1075</programlisting></para>
1076
1077<para><programlisting>
1078typedef struct _XkbLogoDoodad {
1079    Atom             name;         /* doodad name */
1080    unsigned char    type;         /* <symbol>XkbLogoDoodad</symbol> */
1081    unsigned char    priority;     /* drawing priority, 0&rArr;highest, 255&rArr;lowest */
1082    short            top;          /* top coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
1083    short            left;         /* left coordinate, in <superscript>mm</superscript>/<subscript>10</subscript> */
1084    short            angle;        /* angle of rotation, clockwise,
1085                                      in <superscript>1</superscript>/<subscript>10</subscript> degrees */
1086    unsigned short   color_ndx;    /* doodad color */
1087    unsigned short   shape_ndx;    /* doodad shape */
1088    char *           logo_name;    /* text for logo */
1089} <structname>XkbLogoDoodadRec</structname>, *XkbLogoDoodadPtr
1090</programlisting></para>
1091
1092</sect2>
1093</sect1>
1094<sect1 id='Getting_Keyboard_Geometry_From_the_Server'>
1095<title>Getting Keyboard Geometry From the Server</title>
1096
1097<para>
1098You can load a keyboard geometry as part of the keyboard description returned
1099by
1100<function>XkbGetKeyboard</function>.
1101However, if a keyboard description has been previously loaded, you can
1102instead obtain the geometry by calling the
1103<function>XkbGetGeometry</function>.
1104In this case, the geometry returned is the one associated with the keyboard
1105whose device ID is contained in the keyboard description.
1106</para>
1107
1108<para>
1109To load a keyboard geometry if you already have the keyboard description, use
1110<function>XkbGetGeometry</function>.
1111</para>
1112
1113<indexterm significance="preferred" zone="XkbGetGeometry"><primary><function>XkbGetGeometry</function></primary></indexterm>
1114<funcsynopsis id="XkbGetGeometry">
1115  <funcprototype>
1116    <funcdef>Status <function>XkbGetGeometry</function></funcdef>
1117<!-- (
1118<parameter>dpy</parameter>,
1119<parameter>xkb</parameter>
1120) -->
1121
1122    <paramdef>Display *<parameter>dpy</parameter></paramdef>
1123    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
1124  </funcprototype>
1125</funcsynopsis>
1126<variablelist>
1127  <varlistentry>
1128    <term>
1129      <parameter>dpy</parameter>
1130    </term>
1131    <listitem>
1132      <para>
1133        connection to the X server
1134      </para>
1135    </listitem>
1136  </varlistentry>
1137  <varlistentry>
1138    <term>
1139      <parameter>xkb</parameter>
1140    </term>
1141    <listitem>
1142      <para>
1143        keyboard description that contains the ID for the keyboard and into
1144        which the geometry should be loaded
1145      </para>
1146    </listitem>
1147  </varlistentry>
1148</variablelist>
1149
1150<para>
1151<function>XkbGetGeometry</function>
1152can return
1153<errorname>BadValue</errorname>,
1154<errorname>BadImplementation</errorname>,
1155<errorname>BadName</errorname>,
1156<errorname>BadAlloc</errorname>,
1157or
1158<errorname>BadLength</errorname>
1159errors or
1160<symbol>Success</symbol>
1161if it succeeds.
1162</para>
1163
1164<para>
1165It is also possible to load a keyboard geometry by name. The X server maintains
1166a database of keyboard components (see <xref linkend="Server_Database_of_Keyboard_Components" />). To load a keyboard geometry
1167description from this database by name, use
1168<function>XkbGetNamedGeometry</function>.
1169</para>
1170
1171<indexterm significance="preferred" zone="XkbGetNamedGeometry"><primary><function>XkbGetNamedGeometry</function></primary></indexterm>
1172<funcsynopsis id="XkbGetNamedGeometry">
1173  <funcprototype>
1174    <funcdef>Status <function>XkbGetNamedGeometry</function></funcdef>
1175<!-- (
1176<parameter>dpy</parameter>,
1177<parameter>xkb</parameter>,
1178<parameter>name</parameter>
1179) -->
1180
1181    <paramdef>Display *<parameter>dpy</parameter></paramdef>
1182    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
1183    <paramdef>Atom <parameter>name</parameter></paramdef>
1184  </funcprototype>
1185</funcsynopsis>
1186<variablelist>
1187  <varlistentry>
1188    <term>
1189      <parameter>dpy</parameter>
1190    </term>
1191    <listitem>
1192      <para>
1193        connection to the X server
1194      </para>
1195    </listitem>
1196  </varlistentry>
1197  <varlistentry>
1198    <term>
1199      <parameter>xkb</parameter>
1200    </term>
1201    <listitem>
1202      <para>
1203        keyboard description into which the geometry should be loaded
1204      </para>
1205    </listitem>
1206  </varlistentry>
1207  <varlistentry>
1208    <term>
1209      <parameter>name</parameter>
1210    </term>
1211    <listitem>
1212      <para>
1213        name of the geometry to be loaded
1214      </para>
1215    </listitem>
1216  </varlistentry>
1217</variablelist>
1218
1219<para>
1220<function>XkbGetNamedGeometry</function>
1221can return
1222<errorname>BadName</errorname>
1223if the
1224<parameter>name</parameter>
1225cannot be found.
1226</para>
1227
1228</sect1>
1229<sect1 id='Using_Keyboard_Geometry'>
1230<title>Using Keyboard Geometry</title>
1231
1232<para>
1233Xkb provides a number of convenience functions to help use a keyboard geometry.
1234These include functions to return the bounding box of a shape’s top surface
1235and to update the bounding box of a shape row or section.
1236</para>
1237
1238<para>
1239A shape is made up of a number of outlines. Each outline is a polygon made up
1240of a number of points. The bounding box of a shape is a rectangle that contains
1241all the outlines of that shape.
1242</para>
1243
1244<figure id='figure13.7'>
1245  <title>Key Surface, Shape Outlines, and Bounding Box</title>
1246  <mediaobject>
1247   <imageobject> <imagedata format="SVG" fileref="XKBlib-13.svg"/>
1248   </imageobject>
1249   </mediaobject>
1250</figure>
1251
1252
1253<!--
1254<H5 CLASS="Figure">
1255Key Surface, Shape Outlines, and Bounding Box</H5>
1256-->
1257
1258<para>
1259To determine the bounding box of the top surface of a shape, use
1260<function>XkbComputeShapeTop</function>.
1261</para>
1262
1263<indexterm significance="preferred" zone="XkbComputeShapeTop"><primary><function>XkbComputeShapeTop</function></primary></indexterm>
1264<funcsynopsis id="XkbComputeShapeTop">
1265  <funcprototype>
1266    <funcdef>Bool <function>XkbComputeShapeTop</function></funcdef>
1267<!-- (
1268<parameter>shape</parameter>,
1269<parameter>bounds_rtrn</parameter>
1270) -->
1271
1272    <paramdef>XkbShapePtr <parameter>shape</parameter></paramdef>
1273    <paramdef>XkbBoundsPtr <parameter>bounds_rtrn</parameter></paramdef>
1274  </funcprototype>
1275</funcsynopsis>
1276<variablelist>
1277  <varlistentry>
1278    <term>
1279      <parameter>shape</parameter>
1280    </term>
1281    <listitem>
1282      <para>
1283        shape to be examined
1284      </para>
1285    </listitem>
1286  </varlistentry>
1287  <varlistentry>
1288    <term>
1289      <parameter>bounds_rtrn</parameter>
1290    </term>
1291    <listitem>
1292      <para>
1293        backfilled with the bounding box for the shape
1294      </para>
1295    </listitem>
1296  </varlistentry>
1297</variablelist>
1298
1299<para>
1300<function>XkbComputeShapeTop</function>
1301returns a
1302<structname>BoundsRec</structname>
1303that contains two x and y coordinates. These coordinates describe the corners
1304of a rectangle that contains the outline that describes the top surface of the
1305shape. The top surface is defined to be the approximating outline if the
1306<structfield>approx</structfield>
1307field of
1308<parameter>shape</parameter>
1309is not
1310<symbol>NULL</symbol>.
1311If
1312<structfield>approx</structfield>
1313is
1314<symbol>NULL</symbol>,
1315the top surface is defined as the last outline in the
1316<parameter>shape</parameter>’s
1317array of outlines.
1318<function>XkbComputeShapeTop</function>
1319returns
1320<symbol>False</symbol>
1321if
1322<parameter>shape</parameter>
1323is
1324<symbol>NULL</symbol>
1325or if there are no outlines for the shape; otherwise, it returns
1326<symbol>True</symbol>.
1327</para>
1328
1329
1330<para>
1331A
1332<structname>ShapeRec</structname>
1333contains a
1334<structname>BoundsRec</structname>
1335that describes the bounds of the shape. If you add or delete an outline to or
1336from a shape, the bounding box must be updated. To update the bounding box of a
1337shape, use <function>XkbComputeShapeBounds</function>.
1338</para>
1339
1340
1341<indexterm significance="preferred" zone="XkbComputeShapeBounds"><primary><function>XkbComputeShapeBounds</function></primary></indexterm>
1342<funcsynopsis id="XkbComputeShapeBounds">
1343  <funcprototype>
1344    <funcdef>Bool <function>XkbComputeShapeBounds</function></funcdef>
1345<!-- (
1346<parameter>shape</parameter>
1347) -->
1348
1349    <paramdef>XkbShapePtr <parameter>shape</parameter></paramdef>
1350  </funcprototype>
1351</funcsynopsis>
1352<variablelist>
1353  <varlistentry>
1354    <term>
1355      <parameter>shape</parameter>
1356    </term>
1357    <listitem>
1358      <para>
1359        shape to be examined
1360      </para>
1361    </listitem>
1362  </varlistentry>
1363</variablelist>
1364
1365<para>
1366<function>XkbComputeShapeBounds</function>
1367updates the
1368<structname>BoundsRec</structname>
1369contained in the
1370<parameter>shape</parameter>
1371by examining all the outlines of the shape and setting the
1372<structname>BoundsRec</structname>
1373to the minimum x and minimum y, and maximum x and maximum y values found in
1374those outlines.
1375<function>XkbComputeShapeBounds</function>
1376returns
1377<symbol>False</symbol>
1378if
1379<parameter>shape</parameter>
1380is
1381<symbol>NULL</symbol>
1382or if there are no outlines for the shape; otherwise, it returns
1383<symbol>True</symbol>.
1384</para>
1385
1386<para>
1387If you add or delete a key to or from a row, or if you update the shape of one
1388of the keys in that row, you may need to update the bounding box of that row.
1389To update the bounding box of a row, use <function>XkbComputeRowBounds</function>.
1390</para>
1391
1392<indexterm significance="preferred" zone="XkbComputeRowBounds"><primary><function>XkbComputeRowBounds</function></primary></indexterm>
1393<funcsynopsis id="XkbComputeRowBounds">
1394  <funcprototype>
1395    <funcdef>Bool <function>XkbComputeRowBounds</function></funcdef>
1396<!-- (
1397<parameter>geom</parameter>,
1398<parameter>section</parameter>,
1399<parameter>row</parameter>
1400) -->
1401
1402    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
1403    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
1404    <paramdef>XkbRowPtr <parameter>row</parameter></paramdef>
1405  </funcprototype>
1406</funcsynopsis>
1407<variablelist>
1408  <varlistentry>
1409    <term>
1410      <parameter>geom</parameter>
1411    </term>
1412    <listitem>
1413      <para>
1414        geometry that contains the <parameter>section</parameter>
1415      </para>
1416    </listitem>
1417  </varlistentry>
1418  <varlistentry>
1419    <term>
1420      <parameter>section</parameter>
1421    </term>
1422    <listitem>
1423      <para>
1424        section that contains the row
1425      </para>
1426    </listitem>
1427  </varlistentry>
1428  <varlistentry>
1429    <term>
1430      <parameter>row</parameter>
1431    </term>
1432    <listitem>
1433      <para>
1434        row to be examined and updated
1435      </para>
1436    </listitem>
1437  </varlistentry>
1438</variablelist>
1439
1440<para>
1441<function>XkbComputeRowBounds</function>
1442checks the bounds of all keys in the
1443<parameter>row</parameter>
1444and updates the bounding box of the row if necessary.
1445<function>XkbComputeRowBounds</function>
1446returns
1447<symbol>False</symbol>
1448if any of the arguments is
1449<symbol>NULL</symbol>;
1450otherwise, it returns
1451<symbol>True</symbol>.
1452</para>
1453
1454<para>
1455If you add or delete a row to or from a section, or if you change the geometry
1456of any of the rows in that section, you may need to update the bounding box for
1457that section. To update the bounding box of a section, use
1458<function>XkbComputeSectionBounds</function>.
1459</para>
1460
1461<indexterm significance="preferred" zone="XkbComputeSectionBounds"><primary><function>XkbComputeSectionBounds</function></primary></indexterm>
1462<funcsynopsis id="XkbComputeSectionBounds">
1463  <funcprototype>
1464    <funcdef>Bool <function>XkbComputeSectionBounds</function></funcdef>
1465<!-- (
1466<parameter>geom</parameter>,
1467<parameter>section</parameter>
1468) -->
1469
1470    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
1471    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
1472  </funcprototype>
1473</funcsynopsis>
1474<variablelist>
1475  <varlistentry>
1476    <term>
1477      <parameter>geom</parameter>
1478    </term>
1479    <listitem>
1480      <para>
1481        geometry that contains the <parameter>section</parameter>
1482      </para>
1483    </listitem>
1484  </varlistentry>
1485  <varlistentry>
1486    <term>
1487      <parameter>section</parameter>
1488    </term>
1489    <listitem>
1490      <para>
1491        section to be examined and updated
1492      </para>
1493    </listitem>
1494  </varlistentry>
1495</variablelist>
1496
1497<para>
1498<function>XkbComputeSectionBounds</function>
1499examines all the rows of the
1500<parameter>section</parameter>
1501and updates the bounding box of that section so that it contains all rows.
1502<function>XkbComputeSectionBounds</function>
1503returns
1504<symbol>False</symbol>
1505if any of the arguments is
1506<symbol>NULL</symbol>;
1507otherwise, it returns
1508<symbol>True</symbol>.
1509</para>
1510
1511<para>
1512Keys that can generate multiple keycodes may be associated with multiple names.
1513Such keys have a primary name and an alternate name. To find the alternate name
1514by using the primary name for a key that is part of an overlay, use
1515<function>XkbFindOverlayForKey</function>.
1516</para>
1517
1518<indexterm significance="preferred" zone="XkbFindOverlayForKey"><primary><function>XkbFindOverlayForKey</function></primary></indexterm>
1519<funcsynopsis id="XkbFindOverlayForKey">
1520  <funcprototype>
1521    <funcdef>char *<function>XkbFindOverlayForKey</function></funcdef>
1522<!-- (
1523<parameter>geom</parameter>,
1524<parameter>section</parameter>,
1525<parameter>under</parameter>
1526) -->
1527
1528    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
1529    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
1530    <paramdef>char *<parameter>under</parameter></paramdef>
1531  </funcprototype>
1532</funcsynopsis>
1533<variablelist>
1534  <varlistentry>
1535    <term>
1536      <parameter>geom</parameter>
1537    </term>
1538    <listitem>
1539      <para>
1540        geometry that contains the <parameter>section</parameter>
1541      </para>
1542    </listitem>
1543  </varlistentry>
1544  <varlistentry>
1545    <term>
1546      <parameter>section</parameter>
1547    </term>
1548    <listitem>
1549      <para>
1550        section to be searched for matching keys
1551      </para>
1552    </listitem>
1553  </varlistentry>
1554  <varlistentry>
1555    <term>
1556      <parameter>under</parameter>
1557    </term>
1558    <listitem>
1559      <para>
1560        .primary name of the key to be considered
1561      </para>
1562    </listitem>
1563  </varlistentry>
1564</variablelist>
1565
1566<para>
1567<function>XkbFindOverlayForKey</function>
1568uses the primary name of the key,
1569<parameter>under</parameter>,
1570to look up the alternate name, which it returns.
1571</para>
1572
1573
1574</sect1>
1575<sect1 id='Adding_Elements_to_a_Keyboard_Geometry'>
1576<title>Adding Elements to a Keyboard Geometry</title>
1577
1578<para>
1579Xkb provides functions to add a single new element to the top-level keyboard
1580geometry. In each case the
1581<structfield>num_<replaceable>*</replaceable></structfield>
1582fields of the corresponding structure is incremented by 1. These functions do
1583not change
1584<structfield>sz_<replaceable>*</replaceable></structfield>
1585unless there is no more room in the array. Some of these functions fill in the
1586values of the element’s structure from the arguments. For other functions,
1587you must explicitly write code to fill the structure’s elements.
1588</para>
1589
1590
1591<para>
1592The top-level geometry description includes a list of
1593<firstterm>geometry properties</firstterm>.
1594A geometry property associates an arbitrary string with an equally arbitrary
1595name. Programs that display images of keyboards can use geometry properties as
1596hints, but they are not interpreted by Xkb. No other geometry structures refer
1597to geometry properties.
1598</para>
1599
1600
1601<para>
1602To add one property to an existing keyboard geometry description, use
1603<function>XkbAddGeomProperty</function>.
1604</para>
1605
1606<indexterm significance="preferred" zone="XkbAddGeomProperty"><primary><function>XkbAddGeomProperty</function></primary></indexterm>
1607<funcsynopsis id="XkbAddGeomProperty">
1608  <funcprototype>
1609    <funcdef>XkbPropertyPtr <function>XkbAddGeomProperty</function></funcdef>
1610<!-- (
1611<parameter>geom</parameter>,
1612<parameter>name</parameter>,
1613<parameter>value</parameter>
1614) -->
1615
1616    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
1617    <paramdef>char *<parameter>name</parameter></paramdef>
1618    <paramdef>char *<parameter>value</parameter></paramdef>
1619  </funcprototype>
1620</funcsynopsis>
1621<variablelist>
1622  <varlistentry>
1623    <term>
1624      <parameter>geom</parameter>
1625    </term>
1626    <listitem>
1627      <para>
1628        geometry to be updated
1629      </para>
1630    </listitem>
1631  </varlistentry>
1632  <varlistentry>
1633    <term>
1634      <parameter>name</parameter>
1635    </term>
1636    <listitem>
1637      <para>
1638        name of the new property
1639      </para>
1640    </listitem>
1641  </varlistentry>
1642  <varlistentry>
1643    <term>
1644      <parameter>value</parameter>
1645    </term>
1646    <listitem>
1647      <para>
1648        value for the new property
1649      </para>
1650    </listitem>
1651  </varlistentry>
1652</variablelist>
1653
1654<para>
1655<function>XkbAddGeomProperty</function>
1656adds one property with the specified
1657<parameter>name</parameter>
1658and
1659<parameter>value</parameter>
1660to the keyboard geometry specified by geom.
1661<function>XkbAddGeomProperty</function>
1662returns
1663<symbol>NULL</symbol>
1664if any of the parameters is empty or if it was not able to allocate space for
1665the property. To allocate space for an arbitrary number of properties, use the
1666XkbAllocGeomProps function.
1667</para>
1668
1669
1670<para>
1671To add one key alias to an existing keyboard geometry description, use
1672<function>XkbAddGeomKeyAlias</function>.
1673</para>
1674
1675
1676<indexterm significance="preferred" zone="XkbAddGeomKeyAlias"><primary><function>XkbAddGeomKeyAlias</function></primary></indexterm>
1677<funcsynopsis id="XkbAddGeomKeyAlias">
1678  <funcprototype>
1679    <funcdef>XkbKeyAliasPtr <function>XkbAddGeomKeyAlias</function></funcdef>
1680<!-- (
1681<parameter>geom</parameter>,
1682<parameter>alias, real</parameter>
1683) -->
1684
1685    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
1686    <paramdef>char *<parameter>alias</parameter></paramdef>
1687    <paramdef>char *<parameter>real</parameter></paramdef>
1688  </funcprototype>
1689</funcsynopsis>
1690<variablelist>
1691  <varlistentry>
1692    <term>
1693      <parameter>geom</parameter>
1694    </term>
1695    <listitem>
1696      <para>
1697        geometry to be updated
1698      </para>
1699    </listitem>
1700  </varlistentry>
1701  <varlistentry>
1702    <term>
1703      <parameter>alias</parameter>
1704    </term>
1705    <listitem>
1706      <para>
1707        alias to be added
1708      </para>
1709    </listitem>
1710  </varlistentry>
1711  <varlistentry>
1712    <term>
1713      <parameter>real</parameter>
1714    </term>
1715    <listitem>
1716      <para>
1717        real name to be bound to the new alias
1718      </para>
1719    </listitem>
1720  </varlistentry>
1721</variablelist>
1722
1723<para>
1724<function>XkbAddGeomKeyAlias</function>
1725adds one key alias with the value alias to the geometry geom, and associates
1726it with the key whose real name is real.
1727<function>XkbAddGeomKeyAlias</function>
1728returns
1729<symbol>NULL</symbol>
1730if any of the parameters is empty or if it was not able to allocate space for
1731the alias. To allocate space for an arbitrary number of aliases, use the
1732XkbAllocGeomKeyAliases function.
1733</para>
1734
1735
1736<para>
1737To add one color name to an existing keyboard geometry description, use
1738<function>XkbAddGeomColor</function>.
1739</para>
1740
1741
1742<indexterm significance="preferred" zone="XkbAddGeomColor"><primary><function>XkbAddGeomColor</function></primary></indexterm>
1743<funcsynopsis id="XkbAddGeomColor">
1744  <funcprototype>
1745    <funcdef>XkbColorPtr <function>XkbAddGeomColor</function></funcdef>
1746<!-- (
1747<parameter>geom</parameter>,
1748<parameter>spec</parameter>,
1749<parameter>pixel</parameter>
1750) -->
1751
1752    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
1753    <paramdef>char *<parameter>spec</parameter></paramdef>
1754    <paramdef>unsigned int <parameter>pixel</parameter></paramdef>
1755  </funcprototype>
1756</funcsynopsis>
1757<variablelist>
1758  <varlistentry>
1759    <term>
1760      <parameter>geom</parameter>
1761    </term>
1762    <listitem>
1763      <para>
1764        geometry to be updated
1765      </para>
1766    </listitem>
1767  </varlistentry>
1768  <varlistentry>
1769    <term>
1770      <parameter>spec</parameter>
1771    </term>
1772    <listitem>
1773      <para>
1774        color to be added
1775      </para>
1776    </listitem>
1777  </varlistentry>
1778  <varlistentry>
1779    <term>
1780      <parameter>pixel</parameter>
1781    </term>
1782    <listitem>
1783      <para>
1784        color to be added
1785      </para>
1786    </listitem>
1787  </varlistentry>
1788</variablelist>
1789
1790<para>
1791<function>XkbAddGeomColor</function>
1792adds the specified color
1793<structfield>name</structfield>
1794and
1795<parameter>pixel</parameter>
1796to the specified geometry
1797<parameter>geom</parameter>.
1798The top-level geometry description includes a list of up to
1799<emphasis>MaxColors</emphasis>
1800(32)
1801<emphasis>color names</emphasis>.
1802A color
1803<structfield>name</structfield>
1804is a string whose interpretation is not specified by Xkb and neither is the
1805<parameter>pixel</parameter>
1806value’s interpretation. All other geometry data structures refer to colors
1807using their indices in this global list or pointers to colors in this list.
1808<function>XkbAddGeomColor</function>
1809returns
1810<symbol>NULL</symbol>
1811if any of the parameters is empty or if it was not able to allocate space for
1812the color. To allocate space for an arbitrary number of colors to a geometry,
1813use the
1814<function>XkbAllocGeomColors</function>
1815function.
1816</para>
1817
1818<para>
1819To add one outline to an existing shape, use
1820<function>XkbAddGeomOutline</function>.
1821</para>
1822
1823<indexterm significance="preferred" zone="XkbAddGeomOutline"><primary><function>XkbAddGeomOutline</function></primary></indexterm>
1824<funcsynopsis id="XkbAddGeomOutline">
1825  <funcprototype>
1826    <funcdef>XkbOutlinePtr <function>XkbAddGeomOutline</function></funcdef>
1827<!-- (
1828<parameter>shape</parameter>,
1829<parameter>sz_points</parameter>
1830) -->
1831
1832    <paramdef>XkbShapePtr <parameter>shape</parameter></paramdef>
1833    <paramdef>int <parameter>sz_points</parameter></paramdef>
1834  </funcprototype>
1835</funcsynopsis>
1836<variablelist>
1837  <varlistentry>
1838    <term>
1839      <parameter>shape</parameter>
1840    </term>
1841    <listitem>
1842      <para>
1843        shape to be updated
1844      </para>
1845    </listitem>
1846  </varlistentry>
1847  <varlistentry>
1848    <term>
1849      <parameter>sz_points</parameter>
1850    </term>
1851    <listitem>
1852      <para>
1853        number of points to be reserved
1854      </para>
1855    </listitem>
1856  </varlistentry>
1857</variablelist>
1858
1859<para>
1860An outline consists of an arbitrary number of points.
1861<function>XkbAddGeomOutline</function>
1862adds an outline to the specified
1863<parameter>shape</parameter>
1864by reserving
1865<parameter>sz_points</parameter>
1866points for it. The new outline is allocated and zeroed.
1867<function>XkbAddGeomOutline</function>
1868returns
1869<symbol>NULL</symbol>
1870if any of the parameters is empty or if it was not able to allocate space. To
1871allocate space for an arbitrary number of outlines to a shape, use
1872XkbAllocGeomOutlines.
1873</para>
1874
1875
1876<para>
1877To add a shape to a keyboard geometry, use
1878<function>XkbAddGeomShape</function>.
1879</para>
1880
1881
1882<indexterm significance="preferred" zone="XkbAddGeomShape"><primary><function>XkbAddGeomShape</function></primary></indexterm>
1883<funcsynopsis id="XkbAddGeomShape">
1884  <funcprototype>
1885    <funcdef>XkbShapePtr <function>XkbAddGeomShape</function></funcdef>
1886<!-- (
1887<parameter>geom</parameter>,
1888<parameter>name</parameter>,
1889<parameter>sz_outlines</parameter>
1890) -->
1891
1892    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
1893    <paramdef>Atom <parameter>name</parameter></paramdef>
1894    <paramdef>int <parameter>sz_outlines</parameter></paramdef>
1895  </funcprototype>
1896</funcsynopsis>
1897<variablelist>
1898  <varlistentry>
1899    <term>
1900      <parameter>geom</parameter>
1901    </term>
1902    <listitem>
1903      <para>
1904        geometry to be updated
1905      </para>
1906    </listitem>
1907  </varlistentry>
1908  <varlistentry>
1909    <term>
1910      <parameter>name</parameter>
1911    </term>
1912    <listitem>
1913      <para>
1914        name of the new shape
1915      </para>
1916    </listitem>
1917  </varlistentry>
1918  <varlistentry>
1919    <term>
1920      <parameter>sz_outlines</parameter>
1921    </term>
1922    <listitem>
1923      <para>
1924        number of outlines to be reserved
1925      </para>
1926    </listitem>
1927  </varlistentry>
1928</variablelist>
1929
1930<para>
1931A geometry contains an arbitrary number of shapes, each of which is made up of
1932an arbitrary number of outlines.
1933<function>XkbAddGeomShape</function>
1934adds a shape to a geometry
1935<parameter>geom</parameter>
1936by allocating space for
1937<parameter>sz_outlines</parameter>
1938outlines for it and giving it the name specified by name. If a shape with name
1939<parameter>name</parameter>
1940already exists in the geometry, a pointer to the existing shape is returned.
1941<function>XkbAddGeomShape</function>
1942returns
1943<symbol>NULL</symbol>
1944if any of the parameters is empty or if it was not able to allocate space. To
1945allocate space for an arbitrary number of geometry shapes, use
1946<function>XkbAllocGeomShapes</function>.
1947</para>
1948
1949
1950<para>
1951To add one key at the end of an existing row of keys, use
1952<function>XkbAddGeomKey</function>.
1953</para>
1954
1955
1956<indexterm significance="preferred" zone="XkbAddGeomKey"><primary><function>XkbAddGeomKey</function></primary></indexterm>
1957<funcsynopsis id="XkbAddGeomKey">
1958  <funcprototype>
1959    <funcdef>XkbKeyPtr <function>XkbAddGeomKey</function></funcdef>
1960<!-- (
1961<parameter>row</parameter>
1962) -->
1963
1964    <paramdef>XkbRowPtr <parameter>row</parameter></paramdef>
1965  </funcprototype>
1966</funcsynopsis>
1967<variablelist>
1968  <varlistentry>
1969    <term>
1970      <parameter>row</parameter>
1971    </term>
1972    <listitem>
1973      <para>
1974        row to be updated
1975      </para>
1976    </listitem>
1977  </varlistentry>
1978</variablelist>
1979
1980<para>
1981Keys are grouped into rows.
1982<function>XkbAddGeomKey</function>
1983adds one key to the end of the specified
1984<parameter>row</parameter>.
1985The key is allocated and zeroed.
1986<function>XkbAddGeomKey</function>
1987returns
1988<symbol>NULL</symbol>
1989if
1990<parameter>row</parameter>
1991is empty or if it was not able to allocate space for the key. To allocate
1992space for an arbitrary number of keys to a row, use XkbAllocGeomKeys.
1993</para>
1994
1995
1996<para>
1997To add one section to an existing keyboard geometry, use
1998<function>XkbAddGeomSection</function>.
1999</para>
2000
2001
2002<indexterm significance="preferred" zone="XkbAddGeomSection"><primary><function>XkbAddGeomSection</function></primary></indexterm>
2003<funcsynopsis id="XkbAddGeomSection">
2004  <funcprototype>
2005    <funcdef>XkbSectionPtr <function>XkbAddGeomSection</function></funcdef>
2006<!-- (
2007<parameter>geom</parameter>,
2008<parameter>name</parameter>,
2009<parameter>sz_rows</parameter>,
2010<parameter>sz_doodads</parameter>,
2011<parameter>sz_overlays</parameter>
2012) -->
2013
2014    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
2015    <paramdef>Atom <parameter>name</parameter></paramdef>
2016    <paramdef>int <parameter>sz_rows</parameter></paramdef>
2017    <paramdef>int <parameter>sz_doodads</parameter></paramdef>
2018    <paramdef>int <parameter>sz_overlays</parameter></paramdef>
2019  </funcprototype>
2020</funcsynopsis>
2021<variablelist>
2022  <varlistentry>
2023    <term>
2024      <parameter>geom</parameter>
2025    </term>
2026    <listitem>
2027      <para>
2028        geometry to be updated
2029      </para>
2030    </listitem>
2031  </varlistentry>
2032  <varlistentry>
2033    <term>
2034      <parameter>name</parameter>
2035    </term>
2036    <listitem>
2037      <para>
2038        name of the new section
2039      </para>
2040    </listitem>
2041  </varlistentry>
2042  <varlistentry>
2043    <term>
2044      <parameter>sz_rows</parameter>
2045    </term>
2046    <listitem>
2047      <para>
2048        number of rows to reserve in the section
2049      </para>
2050    </listitem>
2051  </varlistentry>
2052  <varlistentry>
2053    <term>
2054      <parameter>sz_doodads</parameter>
2055    </term>
2056    <listitem>
2057      <para>
2058        number of doodads to reserve in the section
2059      </para>
2060    </listitem>
2061  </varlistentry>
2062  <varlistentry>
2063    <term>
2064      <parameter>sz_overlays</parameter>
2065    </term>
2066    <listitem>
2067      <para>
2068        number of overlays to reserve in the section
2069      </para>
2070    </listitem>
2071  </varlistentry>
2072</variablelist>
2073
2074<para>
2075A keyboard geometry contains an arbitrary number of sections.
2076<function>XkbAddGeomSection</function>
2077adds one section to an existing keyboard geometry
2078<parameter>geom</parameter>.
2079The new section contains space for the number of rows, doodads, and overlays
2080specified by
2081<parameter>sz_rows</parameter>,
2082<parameter>sz_doodads</parameter>,
2083and
2084<parameter>sz_overlays</parameter>.
2085The new section is allocated and zeroed and given the name specified by
2086<parameter>name</parameter>.
2087If a section with name
2088<parameter>name</parameter>
2089already exists in the geometry, a pointer to the existing section is
2090returned.
2091<function>XkbAddGeomSection</function>
2092returns
2093<symbol>NULL</symbol>
2094if any of the parameters is empty or if it was not able to allocate space for
2095the section. To allocate space for an arbitrary number of sections to a
2096geometry, use XkbAllocGeomSections.
2097</para>
2098
2099
2100<para>
2101To add a row to a section, use
2102<function>XkbAddGeomRow</function>.
2103</para>
2104
2105
2106<indexterm significance="preferred" zone="XkbAddGeomRow"><primary><function>XkbAddGeomRow</function></primary></indexterm>
2107<funcsynopsis id="XkbAddGeomRow">
2108  <funcprototype>
2109    <funcdef>XkbRowPtr <function>XkbAddGeomRow</function></funcdef>
2110<!-- (
2111<parameter>section</parameter>,
2112<parameter>sz_keys</parameter>
2113) -->
2114
2115    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
2116    <paramdef>int <parameter>sz_keys</parameter></paramdef>
2117  </funcprototype>
2118</funcsynopsis>
2119<variablelist>
2120  <varlistentry>
2121    <term>
2122      <parameter>section</parameter>
2123    </term>
2124    <listitem>
2125      <para>
2126        section to be updated
2127      </para>
2128    </listitem>
2129  </varlistentry>
2130  <varlistentry>
2131    <term>
2132      <parameter>sz_keys</parameter>
2133    </term>
2134    <listitem>
2135      <para>
2136        number of keys to be reserved
2137      </para>
2138    </listitem>
2139  </varlistentry>
2140</variablelist>
2141
2142<para>
2143One of the components of a keyboard geometry section is one or more rows of
2144keys.
2145<function>XkbAddGeomRow</function>
2146adds one row to the specified
2147<parameter>section</parameter>.
2148The newly created row contains space for the number of keys specified in
2149<parameter>sz_keys</parameter>.
2150They are allocated and zeroed, but otherwise uninitialized.
2151<function>XkbAddGeomRow</function>
2152returns
2153<symbol>NULL</symbol>
2154if any of the parameters is empty or if it was not able to allocate space for
2155the row. To allocate space for an arbitrary number of rows to a section, use
2156the XkbAllocGeomRows function.
2157</para>
2158
2159
2160<para>
2161To add one doodad to a section of a keyboard geometry or to the top-level
2162geometry, use
2163<function>XkbAddGeomDoodad</function>.
2164</para>
2165
2166
2167<indexterm significance="preferred" zone="XkbAddGeomDoodad"><primary><function>XkbAddGeomDoodad</function></primary></indexterm>
2168<funcsynopsis id="XkbAddGeomDoodad">
2169  <funcprototype>
2170    <funcdef>XkbDoodadPtr <function>XkbAddGeomDoodad</function></funcdef>
2171<!-- (
2172<parameter>geom</parameter>,
2173<parameter>section</parameter>,
2174<parameter>name</parameter>
2175) -->
2176
2177    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
2178    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
2179    <paramdef>Atom <parameter>name</parameter></paramdef>
2180  </funcprototype>
2181</funcsynopsis>
2182<variablelist>
2183  <varlistentry>
2184    <term>
2185      <parameter>geom</parameter>
2186    </term>
2187    <listitem>
2188      <para>
2189        geometry to which the doodad is added
2190      </para>
2191    </listitem>
2192  </varlistentry>
2193  <varlistentry>
2194    <term>
2195      <parameter>section</parameter>
2196    </term>
2197    <listitem>
2198      <para>
2199        section, if any, to which the doodad is added
2200      </para>
2201    </listitem>
2202  </varlistentry>
2203  <varlistentry>
2204    <term>
2205      <parameter>name</parameter>
2206    </term>
2207    <listitem>
2208      <para>
2209        name of the new doodad
2210      </para>
2211    </listitem>
2212  </varlistentry>
2213</variablelist>
2214
2215<para>
2216A
2217<structfield>doodad</structfield>
2218describes some visible aspect of the keyboard that is not a key and is not a
2219section.
2220<function>XkbAddGeomDoodad</function>
2221adds a doodad with name specified by name to the geometry
2222<parameter>geom</parameter>
2223if section is
2224<symbol>NULL</symbol>
2225or to the section of the geometry specified by section if
2226<parameter>section</parameter>
2227is not
2228<symbol>NULL</symbol>.
2229<function>XkbAddGeomDoodad</function>
2230returns
2231<symbol>NULL</symbol>
2232if any of the parameters is empty or if it was not able to allocate space for
2233the doodad. If there is already a doodad with the name
2234<parameter>name</parameter>
2235in the doodad array for the geometry (if
2236<parameter>section</parameter>
2237is
2238<symbol>NULL</symbol>)
2239or the section (if
2240<parameter>section</parameter>
2241is non-
2242<symbol>NULL</symbol>),
2243a pointer to that doodad is returned. To allocate space for an arbitrary
2244number of doodads to a section, use the XkbAllocGeomSectionDoodads function. To
2245allocate space for an arbitrary number of doodads to a keyboard geometry, use
2246the XkbAllocGeomDoodads function.
2247</para>
2248
2249
2250<para>
2251To add one overlay to a section, use
2252<function>XkbAddGeomOverlay</function>.
2253</para>
2254
2255
2256<indexterm significance="preferred" zone="XkbAddGeomOverlay"><primary><function>XkbAddGeomOverlay</function></primary></indexterm>
2257<funcsynopsis id="XkbAddGeomOverlay">
2258  <funcprototype>
2259    <funcdef>XkbOverlayPtr <function>XkbAddGeomOverlay</function></funcdef>
2260<!-- (
2261<parameter>section</parameter>,
2262<parameter>name</parameter>,
2263<parameter>sz_rows</parameter>
2264) -->
2265
2266    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
2267    <paramdef>Atom <parameter>name</parameter></paramdef>
2268    <paramdef>int <parameter>sz_rows</parameter></paramdef>
2269  </funcprototype>
2270</funcsynopsis>
2271<variablelist>
2272  <varlistentry>
2273    <term>
2274      <parameter>section</parameter>
2275    </term>
2276    <listitem>
2277      <para>
2278        section to which an overlay will be added
2279      </para>
2280    </listitem>
2281  </varlistentry>
2282  <varlistentry>
2283    <term>
2284      <parameter>name</parameter>
2285    </term>
2286    <listitem>
2287      <para>
2288        name of the overlay
2289      </para>
2290    </listitem>
2291  </varlistentry>
2292  <varlistentry>
2293    <term>
2294      <parameter>sz_rows</parameter>
2295    </term>
2296    <listitem>
2297      <para>
2298        number of rows to reserve in the overlay
2299      </para>
2300    </listitem>
2301  </varlistentry>
2302</variablelist>
2303
2304<para>
2305<function>XkbAddGeomOverlay</function>
2306adds an overlay with the specified name to the specified
2307<parameter>section</parameter>.
2308The new overlay is created with space allocated for sz_rows rows. If an
2309overlay with name
2310<parameter>name</parameter>
2311already exists in the section, a pointer to the existing overlay is
2312returned.
2313<function>XkbAddGeomOverlay</function>
2314returns
2315<symbol>NULL</symbol>
2316if any of the parameters is empty or if it was not able to allocate space for
2317the overlay. To allocate space for an arbitrary number of overlays to a
2318section, use the XkbAllocGeomOverlay function.
2319</para>
2320
2321
2322<para>
2323To add a row to an existing overlay, use
2324<function>XkbAddGeomOverlayRow</function>.
2325</para>
2326
2327
2328<indexterm significance="preferred" zone="XkbAddGeomOverlayRow"><primary><function>XkbAddGeomOverlayRow</function></primary></indexterm>
2329<funcsynopsis id="XkbAddGeomOverlayRow">
2330  <funcprototype>
2331    <funcdef>XkbOverlayRowPtr <function>XkbAddGeomOverlayRow</function></funcdef>
2332<!-- (
2333<parameter>overlay</parameter>,
2334<parameter>row_under, sz_keys</parameter>
2335) -->
2336
2337    <paramdef>XkbOverlayPtr <parameter>overlay</parameter></paramdef>
2338    <paramdef>XkbRowPtr <parameter>row_under</parameter></paramdef>
2339    <paramdef>int <parameter>sz_keys</parameter></paramdef>
2340  </funcprototype>
2341</funcsynopsis>
2342<variablelist>
2343  <varlistentry>
2344    <term>
2345      <parameter>overlay</parameter>
2346    </term>
2347    <listitem>
2348      <para>
2349        overlay to be updated
2350      </para>
2351    </listitem>
2352  </varlistentry>
2353  <varlistentry>
2354    <term>
2355      <parameter>row_under</parameter>
2356    </term>
2357    <listitem>
2358      <para>
2359        row to be overlaid in the section <parameter>overlay</parameter>
2360         overlays
2361      </para>
2362    </listitem>
2363  </varlistentry>
2364  <varlistentry>
2365    <term>
2366      <parameter>sz_keys</parameter>
2367    </term>
2368    <listitem>
2369      <para>
2370        number of keys to reserve in the row
2371      </para>
2372    </listitem>
2373  </varlistentry>
2374</variablelist>
2375
2376<para>
2377<function>XkbAddGeomOverlayRow</function>
2378adds one row to the
2379<parameter>overlay</parameter>.
2380The new row contains space for
2381<parameter>sz_keys</parameter>
2382keys. If
2383<parameter>row_under</parameter>
2384specifies a row that doesn’t exist on the underlying section,
2385<function>XkbAddGeomOverlayRow</function>
2386returns
2387<symbol>NULL</symbol>
2388and doesn’t change the overlay.
2389<function>XkbAddGeomOverlayRow</function>
2390returns
2391<symbol>NULL</symbol>
2392if any of the parameters is empty or if it was not able to allocate space for
2393the overlay.
2394</para>
2395
2396
2397<para>
2398To add a key to an existing overlay row, use
2399<function>XkbAddGeomOverlayKey</function>.
2400</para>
2401
2402
2403<indexterm significance="preferred" zone="XkbAddGeomOverlayKey"><primary><function>XkbAddGeomOverlayKey</function></primary></indexterm>
2404<funcsynopsis id="XkbAddGeomOverlayKey">
2405  <funcprototype>
2406    <funcdef>XkbOverlayKeyPtr <function>XkbAddGeomOverlayKey</function></funcdef>
2407<!-- (
2408<parameter>overlay</parameter>,
2409<parameter>row, under</parameter>
2410) -->
2411
2412    <paramdef>XkbOverlayPtr <parameter>overlay</parameter></paramdef>
2413    <paramdef>XkbRowPtr <parameter>row</parameter></paramdef>
2414    <paramdef>char *<parameter>under</parameter></paramdef>
2415  </funcprototype>
2416</funcsynopsis>
2417<variablelist>
2418  <varlistentry>
2419    <term>
2420      <parameter>overlay</parameter>
2421    </term>
2422    <listitem>
2423      <para>
2424        overlay to be updated
2425      </para>
2426    </listitem>
2427  </varlistentry>
2428  <varlistentry>
2429    <term>
2430      <parameter>row</parameter>
2431    </term>
2432    <listitem>
2433      <para>
2434        row in overlay to be updated
2435      </para>
2436    </listitem>
2437  </varlistentry>
2438  <varlistentry>
2439    <term>
2440      <parameter>under</parameter>
2441    </term>
2442    <listitem>
2443      <para>
2444        primary name of the key to be considered
2445      </para>
2446    </listitem>
2447  </varlistentry>
2448</variablelist>
2449
2450<para>
2451<function>XkbAddGeomOverlayKey</function>
2452adds one key to the
2453<parameter>row</parameter>
2454in the
2455<parameter>overlay</parameter>.
2456If there is no key named
2457<parameter>under</parameter>
2458in the row of the underlying section,
2459<function>XkbAddGeomOverlayKey</function>
2460returns
2461<symbol>NULL</symbol>.
2462</para>
2463
2464
2465</sect1>
2466<sect1 id='Allocating_and_Freeing_Geometry_Components'>
2467<title>Allocating and Freeing Geometry Components</title>
2468
2469<para>
2470Xkb provides a number of functions to allocate and free subcomponents of a
2471keyboard geometry. Use these functions to create or modify keyboard geometries.
2472Note that these functions merely allocate space for the new element(s), and it
2473is up to you to fill in the values explicitly in your code. These allocation
2474functions increase
2475<structfield>sz_<replaceable>*</replaceable></structfield>
2476but never touch
2477<structfield>num_<replaceable>*</replaceable></structfield>
2478(unless there is an allocation failure, in which case they reset both
2479<structfield>sz_<replaceable>*</replaceable></structfield>
2480and
2481<structfield>num_<replaceable>*</replaceable></structfield>
2482to zero). These functions return
2483<symbol>Success</symbol>
2484if they succeed,
2485<errorname>BadAlloc</errorname>
2486if they are not able to allocate space, or
2487<errorname>BadValue</errorname>
2488if a parameter is not as expected.
2489</para>
2490
2491
2492<para>
2493To allocate space for an arbitrary number of outlines to a shape, use
2494XkbAllocGeomOutlines.
2495</para>
2496
2497<indexterm significance="preferred" zone="XkbAllocGeomOutlines"><primary><function>XkbAllocGeomOutlines</function></primary></indexterm>
2498<funcsynopsis id="XkbAllocGeomOutlines">
2499  <funcprototype>
2500    <funcdef>Status <function>XkbAllocGeomOutlines</function></funcdef>
2501<!-- (
2502<parameter>shape</parameter>,
2503<parameter>num_needed</parameter>
2504) -->
2505
2506    <paramdef>XkbShapePtr <parameter>shape</parameter></paramdef>
2507    <paramdef>int <parameter>num_needed</parameter></paramdef>
2508  </funcprototype>
2509</funcsynopsis>
2510<variablelist>
2511  <varlistentry>
2512    <term>
2513      <parameter>shape</parameter>
2514    </term>
2515    <listitem>
2516      <para>
2517        shape for which outlines should be allocated
2518      </para>
2519    </listitem>
2520  </varlistentry>
2521  <varlistentry>
2522    <term>
2523      <parameter>num_needed</parameter>
2524    </term>
2525    <listitem>
2526      <para>
2527        number of new outlines required
2528      </para>
2529    </listitem>
2530  </varlistentry>
2531</variablelist>
2532
2533<para>
2534<function>XkbAllocGeomOutlines</function>
2535allocates space for
2536<parameter>num_needed</parameter>
2537outlines in the specified
2538<parameter>shape</parameter>.
2539The outlines are not initialized.
2540</para>
2541
2542
2543<para>
2544To free geometry outlines, use
2545<function>XkbFreeGeomOutlines</function>.
2546</para>
2547
2548
2549<indexterm significance="preferred" zone="XkbFreeGeomOutlines"><primary><function>XkbFreeGeomOutlines</function></primary></indexterm>
2550<funcsynopsis id="XkbFreeGeomOutlines">
2551  <funcprototype>
2552    <funcdef>void <function>XkbFreeGeomOutlines</function></funcdef>
2553<!-- (
2554<parameter>shape</parameter>,
2555<parameter>first</parameter>,
2556<parameter>count</parameter>,
2557<parameter>free_all</parameter>
2558) -->
2559
2560    <paramdef>XkbShapePtr <parameter>shape</parameter></paramdef>
2561    <paramdef>int <parameter>first</parameter></paramdef>
2562    <paramdef>int <parameter>count</parameter></paramdef>
2563    <paramdef>Bool <parameter>free_all</parameter></paramdef>
2564  </funcprototype>
2565</funcsynopsis>
2566<variablelist>
2567  <varlistentry>
2568    <term>
2569      <parameter>shape</parameter>
2570    </term>
2571    <listitem>
2572      <para>
2573        shape in which outlines should be freed
2574      </para>
2575    </listitem>
2576  </varlistentry>
2577  <varlistentry>
2578    <term>
2579      <parameter>first</parameter>
2580    </term>
2581    <listitem>
2582      <para>
2583        first outline to be freed
2584      </para>
2585    </listitem>
2586  </varlistentry>
2587  <varlistentry>
2588    <term>
2589      <parameter>count</parameter>
2590    </term>
2591    <listitem>
2592      <para>
2593        number of outlines to be freed
2594      </para>
2595    </listitem>
2596  </varlistentry>
2597  <varlistentry>
2598    <term>
2599      <parameter>free_all</parameter>
2600    </term>
2601    <listitem>
2602      <para>
2603        <symbol>True</symbol> &rArr; all outlines are freed
2604      </para>
2605    </listitem>
2606  </varlistentry>
2607</variablelist>
2608
2609<para>
2610If free_all is
2611<symbol>True</symbol>,
2612all outlines are freed regardless of the value of first or count. Otherwise,
2613count outlines are freed beginning with the one specified by first.
2614</para>
2615
2616
2617<para>
2618To allocate space for an arbitrary number of keys to a row, use
2619XkbAllocGeomKeys.
2620</para>
2621
2622
2623<indexterm significance="preferred" zone="XkbAllocGeomKeys"><primary><function>XkbAllocGeomKeys</function></primary></indexterm>
2624<funcsynopsis id="XkbAllocGeomKeys">
2625  <funcprototype>
2626    <funcdef>Status <function>XkbAllocGeomKeys</function></funcdef>
2627<!-- (
2628<parameter>row</parameter>,
2629<parameter>num_needed</parameter>
2630) -->
2631
2632    <paramdef>XkbRowPtr <parameter>row</parameter></paramdef>
2633    <paramdef>int <parameter>num_needed</parameter></paramdef>
2634  </funcprototype>
2635</funcsynopsis>
2636<variablelist>
2637  <varlistentry>
2638    <term>
2639      <parameter>row</parameter>
2640    </term>
2641    <listitem>
2642      <para>
2643        row to which keys should be allocated
2644      </para>
2645    </listitem>
2646  </varlistentry>
2647  <varlistentry>
2648    <term>
2649      <parameter>num_needed</parameter>
2650    </term>
2651    <listitem>
2652      <para>
2653        number of new keys required
2654      </para>
2655    </listitem>
2656  </varlistentry>
2657</variablelist>
2658
2659<para>
2660<function>XkbAllocGeomKeys</function>
2661allocates num_needed keys and adds them to the row. No initialization of the
2662keys is done.
2663</para>
2664
2665
2666<para>
2667To free geometry keys, use
2668<function>XkbFreeGeomKeys</function>.
2669</para>
2670
2671
2672<indexterm significance="preferred" zone="XkbFreeGeomKeys"><primary><function>XkbFreeGeomKeys</function></primary></indexterm>
2673<funcsynopsis id="XkbFreeGeomKeys">
2674  <funcprototype>
2675    <funcdef>void <function>XkbFreeGeomKeys</function></funcdef>
2676<!-- (
2677<parameter>row</parameter>,
2678<parameter>first</parameter>,
2679<parameter>count</parameter>,
2680<parameter>free_all</parameter>
2681) -->
2682
2683    <paramdef>XkbRowPtr <parameter>row</parameter></paramdef>
2684    <paramdef>int <parameter>first</parameter></paramdef>
2685    <paramdef>int <parameter>count</parameter></paramdef>
2686    <paramdef>Bool <parameter>free_all</parameter></paramdef>
2687  </funcprototype>
2688</funcsynopsis>
2689<variablelist>
2690  <varlistentry>
2691    <term>
2692      <parameter>row</parameter>
2693    </term>
2694    <listitem>
2695      <para>
2696        row in which keys should be freed
2697      </para>
2698    </listitem>
2699  </varlistentry>
2700  <varlistentry>
2701    <term>
2702      <parameter>first</parameter>
2703    </term>
2704    <listitem>
2705      <para>
2706        first key to be freed
2707      </para>
2708    </listitem>
2709  </varlistentry>
2710  <varlistentry>
2711    <term>
2712      <parameter>count</parameter>
2713    </term>
2714    <listitem>
2715      <para>
2716        number of keys to be freed
2717      </para>
2718    </listitem>
2719  </varlistentry>
2720  <varlistentry>
2721    <term>
2722      <parameter>free_all</parameter>
2723    </term>
2724    <listitem>
2725      <para>
2726        <symbol>True</symbol> &rArr; all keys are freed
2727      </para>
2728    </listitem>
2729  </varlistentry>
2730</variablelist>
2731
2732<para>
2733If free_all is
2734<symbol>True</symbol>,
2735all keys are freed regardless of the value of first or count. Otherwise,
2736count keys are freed beginning with the one specified by first.
2737</para>
2738
2739
2740<para>
2741To allocate geometry properties, use
2742<function>XkbAllocGeomProps</function>.
2743</para>
2744
2745
2746<indexterm significance="preferred" zone="XkbAllocGeomProps"><primary><function>XkbAllocGeomProps</function></primary></indexterm>
2747<funcsynopsis id="XkbAllocGeomProps">
2748  <funcprototype>
2749    <funcdef>Status <function>XkbAllocGeomProps</function></funcdef>
2750<!-- (
2751<parameter>geom</parameter>,
2752<parameter>num_needed</parameter>
2753) -->
2754
2755    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
2756    <paramdef>int <parameter>num_needed</parameter></paramdef>
2757  </funcprototype>
2758</funcsynopsis>
2759<variablelist>
2760  <varlistentry>
2761    <term>
2762      <parameter>geom</parameter>
2763    </term>
2764    <listitem>
2765      <para>
2766        geometry for which properties should be allocated
2767      </para>
2768    </listitem>
2769  </varlistentry>
2770  <varlistentry>
2771    <term>
2772      <parameter>num_needed</parameter>
2773    </term>
2774    <listitem>
2775      <para>
2776        number of new properties required
2777      </para>
2778    </listitem>
2779  </varlistentry>
2780</variablelist>
2781
2782<para>
2783<function>XkbAllocGeomProps</function>
2784allocates space for num_needed properties and adds them to the specified
2785geometry
2786<parameter>geom</parameter>.
2787No initialization of the properties is done. A geometry property associates
2788an arbitrary string with an equally arbitrary name. Geometry properties can be
2789used to provide hints to programs that display images of keyboards, but they
2790are not interpreted by Xkb. No other geometry structures refer to geometry
2791properties.
2792</para>
2793
2794
2795<para>
2796To free geometry properties, use
2797<function>XkbFreeGeomProperties</function>.
2798</para>
2799
2800
2801<indexterm significance="preferred" zone="XkbFreeGeomProperties"><primary><function>XkbFreeGeomProperties</function></primary></indexterm>
2802<funcsynopsis id="XkbFreeGeomProperties">
2803  <funcprototype>
2804    <funcdef>void <function>XkbFreeGeomProperties</function></funcdef>
2805<!-- (
2806<parameter>geom</parameter>,
2807<parameter>first</parameter>,
2808<parameter>count</parameter>,
2809<parameter>free_all</parameter>
2810) -->
2811
2812    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
2813    <paramdef>int <parameter>first</parameter></paramdef>
2814    <paramdef>int <parameter>count</parameter></paramdef>
2815    <paramdef>Bool <parameter>free_all</parameter></paramdef>
2816  </funcprototype>
2817</funcsynopsis>
2818<variablelist>
2819  <varlistentry>
2820    <term>
2821      <parameter>geom</parameter>
2822    </term>
2823    <listitem>
2824      <para>
2825        geometry in which properties should be freed
2826      </para>
2827    </listitem>
2828  </varlistentry>
2829  <varlistentry>
2830    <term>
2831      <parameter>first</parameter>
2832    </term>
2833    <listitem>
2834      <para>
2835        first property to be freed
2836      </para>
2837    </listitem>
2838  </varlistentry>
2839  <varlistentry>
2840    <term>
2841      <parameter>count</parameter>
2842    </term>
2843    <listitem>
2844      <para>
2845        number of properties to be freed
2846      </para>
2847    </listitem>
2848  </varlistentry>
2849  <varlistentry>
2850    <term>
2851      <parameter>free_all</parameter>
2852    </term>
2853    <listitem>
2854      <para>
2855        <symbol>True</symbol> &rArr; all properties are freed
2856      </para>
2857    </listitem>
2858  </varlistentry>
2859</variablelist>
2860
2861<para>
2862If free_all is
2863<symbol>True</symbol>,
2864all properties are freed regardless of the value of first or count.
2865Otherwise, count properties are freed beginning with the one specified by first.
2866</para>
2867
2868
2869<para>
2870To allocate geometry key aliases, use
2871<function>XkbAllocGeomKeyAliases</function>.
2872</para>
2873
2874
2875<indexterm significance="preferred" zone="XkbAllocGeomKeyAliases"><primary><function>XkbAllocGeomKeyAliases</function></primary></indexterm>
2876<funcsynopsis id="XkbAllocGeomKeyAliases">
2877  <funcprototype>
2878    <funcdef>Status <function>XkbAllocGeomKeyAliases</function></funcdef>
2879<!-- (
2880<parameter>geom</parameter>,
2881<parameter>num_needed</parameter>
2882) -->
2883
2884    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
2885    <paramdef>int <parameter>num_needed</parameter></paramdef>
2886  </funcprototype>
2887</funcsynopsis>
2888<variablelist>
2889  <varlistentry>
2890    <term>
2891      <parameter>geom</parameter>
2892    </term>
2893    <listitem>
2894      <para>
2895        geometry for which key aliases should be allocated
2896      </para>
2897    </listitem>
2898  </varlistentry>
2899  <varlistentry>
2900    <term>
2901      <parameter>num_needed</parameter>
2902    </term>
2903    <listitem>
2904      <para>
2905        number of new key aliases required
2906      </para>
2907    </listitem>
2908  </varlistentry>
2909</variablelist>
2910
2911<para>
2912<function>XkbAllocGeomKeyAliases</function>
2913allocates space for num_needed key aliases and adds them to the specified
2914geometry
2915<parameter>geom</parameter>.
2916A key alias is a pair of strings that associates an alternate name for a key
2917with the real name for that key.
2918</para>
2919
2920
2921<para>
2922To free geometry key aliases, use
2923<function>XkbFreeGeomKeyAliases</function>.
2924</para>
2925
2926
2927<indexterm significance="preferred" zone="XkbFreeGeomKeyAliases"><primary><function>XkbFreeGeomKeyAliases</function></primary></indexterm>
2928<funcsynopsis id="XkbFreeGeomKeyAliases">
2929  <funcprototype>
2930    <funcdef>void <function>XkbFreeGeomKeyAliases</function></funcdef>
2931<!-- (
2932<parameter>geom</parameter>,
2933<parameter>first</parameter>,
2934<parameter>count</parameter>,
2935<parameter>free_all</parameter>
2936) -->
2937
2938    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
2939    <paramdef>int <parameter>first</parameter></paramdef>
2940    <paramdef>int <parameter>count</parameter></paramdef>
2941    <paramdef>Bool <parameter>free_all</parameter></paramdef>
2942  </funcprototype>
2943</funcsynopsis>
2944<variablelist>
2945  <varlistentry>
2946    <term>
2947      <parameter>geom</parameter>
2948    </term>
2949    <listitem>
2950      <para>
2951        geometry in which key aliases should be freed
2952      </para>
2953    </listitem>
2954  </varlistentry>
2955  <varlistentry>
2956    <term>
2957      <parameter>first</parameter>
2958    </term>
2959    <listitem>
2960      <para>
2961        first key alias to be freed
2962      </para>
2963    </listitem>
2964  </varlistentry>
2965  <varlistentry>
2966    <term>
2967      <parameter>count</parameter>
2968    </term>
2969    <listitem>
2970      <para>
2971        number of key aliases to be freed
2972      </para>
2973    </listitem>
2974  </varlistentry>
2975  <varlistentry>
2976    <term>
2977      <parameter>free_all</parameter>
2978    </term>
2979    <listitem>
2980      <para>
2981        <symbol>True</symbol> &rArr; all key aliases are freed
2982      </para>
2983    </listitem>
2984  </varlistentry>
2985</variablelist>
2986
2987<para>
2988If free_all is
2989<symbol>True</symbol>,
2990all aliases in the top level of the specified geometry
2991<parameter>geom</parameter>
2992are freed regardless of the value of first or count. Otherwise, count aliases
2993in
2994<parameter>geom</parameter>
2995are freed beginning with the one specified by first.
2996</para>
2997
2998
2999<para>
3000To allocate geometry colors, use
3001<function>XkbAllocGeomColors</function>.
3002</para>
3003
3004
3005<indexterm significance="preferred" zone="XkbAllocGeomColors"><primary><function>XkbAllocGeomColors</function></primary></indexterm>
3006<funcsynopsis id="XkbAllocGeomColors">
3007  <funcprototype>
3008    <funcdef>Status <function>XkbAllocGeomColors</function></funcdef>
3009<!-- (
3010<parameter>geom</parameter>,
3011<parameter>num_needed</parameter>
3012) -->
3013
3014    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
3015    <paramdef>int <parameter>num_needed</parameter></paramdef>
3016  </funcprototype>
3017</funcsynopsis>
3018<variablelist>
3019  <varlistentry>
3020    <term>
3021      <parameter>geom</parameter>
3022    </term>
3023    <listitem>
3024      <para>
3025        geometry for which colors should be allocated
3026      </para>
3027    </listitem>
3028  </varlistentry>
3029  <varlistentry>
3030    <term>
3031      <parameter>num_needed</parameter>
3032    </term>
3033    <listitem>
3034      <para>
3035        number of new colors required.
3036      </para>
3037    </listitem>
3038  </varlistentry>
3039</variablelist>
3040
3041<para>
3042<function>XkbAllocGeomColors</function>
3043allocates space for num_needed colors and adds them to the specified geometry
3044<parameter>geom</parameter>.
3045A color name is a string whose interpretation is not specified by Xkb. All
3046other geometry data structures refer to colors using their indices in this
3047global list or pointers to colors in this list.
3048</para>
3049
3050
3051<para>
3052To free geometry colors, use
3053<function>XkbFreeGeomColors</function>.
3054</para>
3055
3056
3057<indexterm significance="preferred" zone="XkbFreeGeomColors"><primary><function>XkbFreeGeomColors</function></primary></indexterm>
3058<funcsynopsis id="XkbFreeGeomColors">
3059  <funcprototype>
3060    <funcdef>void <function>XkbFreeGeomColors</function></funcdef>
3061<!-- (
3062<parameter>geom</parameter>,
3063<parameter>first</parameter>,
3064<parameter>count</parameter>,
3065<parameter>free_all</parameter>
3066) -->
3067
3068    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
3069    <paramdef>int <parameter>first</parameter></paramdef>
3070    <paramdef>int <parameter>count</parameter></paramdef>
3071    <paramdef>Bool <parameter>free_all</parameter></paramdef>
3072  </funcprototype>
3073</funcsynopsis>
3074<variablelist>
3075  <varlistentry>
3076    <term>
3077      <parameter>geom</parameter>
3078    </term>
3079    <listitem>
3080      <para>
3081        geometry in which colors should be freed
3082      </para>
3083    </listitem>
3084  </varlistentry>
3085  <varlistentry>
3086    <term>
3087      <parameter>first</parameter>
3088    </term>
3089    <listitem>
3090      <para>
3091        first color to be freed
3092      </para>
3093    </listitem>
3094  </varlistentry>
3095  <varlistentry>
3096    <term>
3097      <parameter>count</parameter>
3098    </term>
3099    <listitem>
3100      <para>
3101        number of colors to be freed
3102      </para>
3103    </listitem>
3104  </varlistentry>
3105  <varlistentry>
3106    <term>
3107      <parameter>free_all</parameter>
3108    </term>
3109    <listitem>
3110      <para>
3111        <symbol>True</symbol> &rArr; all colors are freed
3112      </para>
3113    </listitem>
3114  </varlistentry>
3115</variablelist>
3116
3117<para>
3118If free_all is
3119<symbol>True</symbol>,
3120all colors are freed regardless of the value of first or count. Otherwise,
3121count colors are freed beginning with the one specified by first.
3122</para>
3123
3124
3125<para>
3126To allocate points in an outline, use
3127<function>XkbAllocGeomPoints</function>.
3128</para>
3129
3130
3131<indexterm significance="preferred" zone="XkbAllocGeomPoints"><primary><function>XkbAllocGeomPoints</function></primary></indexterm>
3132<funcsynopsis id="XkbAllocGeomPoints">
3133  <funcprototype>
3134    <funcdef>Status <function>XkbAllocGeomPoints</function></funcdef>
3135<!-- (
3136<parameter>outline</parameter>,
3137<parameter>num_needed</parameter>
3138) -->
3139
3140    <paramdef>XkbOutlinePtr <parameter>outline</parameter></paramdef>
3141    <paramdef>int <parameter>num_needed</parameter></paramdef>
3142  </funcprototype>
3143</funcsynopsis>
3144<variablelist>
3145  <varlistentry>
3146    <term>
3147      <parameter>outline</parameter>
3148    </term>
3149    <listitem>
3150      <para>
3151        outline for which points should be allocated
3152      </para>
3153    </listitem>
3154  </varlistentry>
3155  <varlistentry>
3156    <term>
3157      <parameter>num_needed</parameter>
3158    </term>
3159    <listitem>
3160      <para>
3161        number of new points required
3162      </para>
3163    </listitem>
3164  </varlistentry>
3165</variablelist>
3166
3167<para>
3168<function>XkbAllocGeomPoints</function>
3169allocates space for
3170<parameter>num_needed</parameter>
3171points in the specified
3172<parameter>outline</parameter>.
3173The points are not initialized.
3174</para>
3175
3176
3177<para>
3178To free points in a outline, use
3179<function>XkbFreeGeomPoints</function>.
3180</para>
3181
3182
3183<indexterm significance="preferred" zone="XkbFreeGeomPoints"><primary><function>XkbFreeGeomPoints</function></primary></indexterm>
3184<funcsynopsis id="XkbFreeGeomPoints">
3185  <funcprototype>
3186    <funcdef>void <function>XkbFreeGeomPoints</function></funcdef>
3187<!-- (
3188<parameter>outline</parameter>,
3189<parameter>first</parameter>,
3190<parameter>count</parameter>,
3191<parameter>free_all</parameter>
3192) -->
3193
3194    <paramdef>XkbOutlinePtr <parameter>outline</parameter></paramdef>
3195    <paramdef>int <parameter>first</parameter></paramdef>
3196    <paramdef>int <parameter>count</parameter></paramdef>
3197    <paramdef>Bool <parameter>free_all</parameter></paramdef>
3198  </funcprototype>
3199</funcsynopsis>
3200<variablelist>
3201  <varlistentry>
3202    <term>
3203      <parameter>outline</parameter>
3204    </term>
3205    <listitem>
3206      <para>
3207        outline in which points should be freed
3208      </para>
3209    </listitem>
3210  </varlistentry>
3211  <varlistentry>
3212    <term>
3213      <parameter>first</parameter>
3214    </term>
3215    <listitem>
3216      <para>
3217        first point to be freed.
3218      </para>
3219    </listitem>
3220  </varlistentry>
3221  <varlistentry>
3222    <term>
3223      <parameter>count</parameter>
3224    </term>
3225    <listitem>
3226      <para>
3227        number of points to be freed
3228      </para>
3229    </listitem>
3230  </varlistentry>
3231  <varlistentry>
3232    <term>
3233      <parameter>free_all</parameter>
3234    </term>
3235    <listitem>
3236      <para>
3237        <symbol>True</symbol> &rArr; all points are freed
3238      </para>
3239    </listitem>
3240  </varlistentry>
3241</variablelist>
3242
3243<para>
3244If free_all is
3245<symbol>True</symbol>,
3246all points are freed regardless of the value of first and count. Otherwise,
3247the number of points specified by count are freed, beginning with the point
3248specified by first in the specified outline.
3249</para>
3250
3251
3252<para>
3253To allocate space for an arbitrary number of geometry shapes, use
3254<function>XkbAllocGeomShapes</function>.
3255</para>
3256
3257
3258<indexterm significance="preferred" zone="XkbAllocGeomShapes"><primary><function>XkbAllocGeomShapes</function></primary></indexterm>
3259<funcsynopsis id="XkbAllocGeomShapes">
3260  <funcprototype>
3261    <funcdef>Status <function>XkbAllocGeomShapes</function></funcdef>
3262<!-- (
3263<parameter>geom</parameter>,
3264<parameter>num_needed</parameter>
3265) -->
3266
3267    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
3268    <paramdef>int <parameter>num_needed</parameter></paramdef>
3269  </funcprototype>
3270</funcsynopsis>
3271<variablelist>
3272  <varlistentry>
3273    <term>
3274      <parameter>geom</parameter>
3275    </term>
3276    <listitem>
3277      <para>
3278        geometry for which shapes should be allocated
3279      </para>
3280    </listitem>
3281  </varlistentry>
3282  <varlistentry>
3283    <term>
3284      <parameter>num_needed</parameter>
3285    </term>
3286    <listitem>
3287      <para>
3288        number of new shapes required
3289      </para>
3290    </listitem>
3291  </varlistentry>
3292</variablelist>
3293
3294<para>
3295<function>XkbAllocGeomShapes</function>
3296allocates space for
3297<parameter>num_needed</parameter>
3298shapes in the specified geometry
3299<parameter>geom</parameter>.
3300The shapes are not initialized.
3301</para>
3302
3303
3304<para>
3305To free geometry shapes, use
3306<function>XkbFreeGeomShapes</function>.
3307</para>
3308
3309
3310<indexterm significance="preferred" zone="XkbFreeGeomShapes"><primary><function>XkbFreeGeomShapes</function></primary></indexterm>
3311<funcsynopsis id="XkbFreeGeomShapes">
3312  <funcprototype>
3313    <funcdef>void <function>XkbFreeGeomShapes</function></funcdef>
3314<!-- (
3315<parameter>geom</parameter>,
3316<parameter>first</parameter>,
3317<parameter>count</parameter>,
3318<parameter>free_all</parameter>
3319) -->
3320
3321    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
3322    <paramdef>int <parameter>first</parameter></paramdef>
3323    <paramdef>int <parameter>count</parameter></paramdef>
3324    <paramdef>Bool <parameter>free_all</parameter></paramdef>
3325  </funcprototype>
3326</funcsynopsis>
3327<variablelist>
3328  <varlistentry>
3329    <term>
3330      <parameter>geom</parameter>
3331    </term>
3332    <listitem>
3333      <para>
3334        geometry in which shapes should be freed
3335      </para>
3336    </listitem>
3337  </varlistentry>
3338  <varlistentry>
3339    <term>
3340      <parameter>first</parameter>
3341    </term>
3342    <listitem>
3343      <para>
3344        first shape to be freed
3345      </para>
3346    </listitem>
3347  </varlistentry>
3348  <varlistentry>
3349    <term>
3350      <parameter>count</parameter>
3351    </term>
3352    <listitem>
3353      <para>
3354        number of shapes to be freed
3355      </para>
3356    </listitem>
3357  </varlistentry>
3358  <varlistentry>
3359    <term>
3360      <parameter>free_all</parameter>
3361    </term>
3362    <listitem>
3363      <para>
3364        <symbol>True</symbol> &rArr; all shapes are freed
3365      </para>
3366    </listitem>
3367  </varlistentry>
3368</variablelist>
3369
3370<para>
3371If free_all is
3372<symbol>True</symbol>,
3373all shapes in the geometry are freed regardless of the values of first and
3374count. Otherwise, count shapes are freed, beginning with the shape specified by
3375first.
3376</para>
3377
3378
3379<para>
3380To allocate geometry sections, use
3381<function>XkbAllocGeomSections</function>.
3382</para>
3383
3384
3385<indexterm significance="preferred" zone="XkbAllocGeomSections"><primary><function>XkbAllocGeomSections</function></primary></indexterm>
3386<funcsynopsis id="XkbAllocGeomSections">
3387  <funcprototype>
3388    <funcdef>Status <function>XkbAllocGeomSections</function></funcdef>
3389<!-- (
3390<parameter>geom</parameter>,
3391<parameter>num_needed</parameter>
3392) -->
3393
3394    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
3395    <paramdef>int <parameter>num_needed</parameter></paramdef>
3396  </funcprototype>
3397</funcsynopsis>
3398<variablelist>
3399  <varlistentry>
3400    <term>
3401      <parameter>geom</parameter>
3402    </term>
3403    <listitem>
3404      <para>
3405        geometry for which sections should be allocated
3406      </para>
3407    </listitem>
3408  </varlistentry>
3409  <varlistentry>
3410    <term>
3411      <parameter>num_needed</parameter>
3412    </term>
3413    <listitem>
3414      <para>
3415        number of new sections required
3416      </para>
3417    </listitem>
3418  </varlistentry>
3419</variablelist>
3420
3421<para>
3422<function>XkbAllocGeomSections</function>
3423allocates num_needed sections and adds them to the geometry geom. No
3424initialization of the sections is done.
3425</para>
3426
3427
3428<para>
3429To free geometry sections, use
3430<function>XkbFreeGeomSections</function>.
3431</para>
3432
3433
3434<indexterm significance="preferred" zone="XkbFreeGeomSections"><primary><function>XkbFreeGeomSections</function></primary></indexterm>
3435<funcsynopsis id="XkbFreeGeomSections">
3436  <funcprototype>
3437    <funcdef>void <function>XkbFreeGeomSections</function></funcdef>
3438<!-- (
3439<parameter>geom</parameter>,
3440<parameter>first</parameter>,
3441<parameter>count</parameter>,
3442<parameter>free_all</parameter>
3443) -->
3444
3445    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
3446    <paramdef>int <parameter>first</parameter></paramdef>
3447    <paramdef>int <parameter>count</parameter></paramdef>
3448    <paramdef>Bool <parameter>free_all</parameter></paramdef>
3449  </funcprototype>
3450</funcsynopsis>
3451<variablelist>
3452  <varlistentry>
3453    <term>
3454      <parameter>geom</parameter>
3455    </term>
3456    <listitem>
3457      <para>
3458        geometry in which sections should be freed
3459      </para>
3460    </listitem>
3461  </varlistentry>
3462  <varlistentry>
3463    <term>
3464      <parameter>first</parameter>
3465    </term>
3466    <listitem>
3467      <para>
3468        first section to be freed.
3469      </para>
3470    </listitem>
3471  </varlistentry>
3472  <varlistentry>
3473    <term>
3474      <parameter>count</parameter>
3475    </term>
3476    <listitem>
3477      <para>
3478        number of sections to be freed
3479      </para>
3480    </listitem>
3481  </varlistentry>
3482  <varlistentry>
3483    <term>
3484      <parameter>free_all</parameter>
3485    </term>
3486    <listitem>
3487      <para>
3488        <symbol>True</symbol> &rArr; all sections are freed
3489      </para>
3490    </listitem>
3491  </varlistentry>
3492</variablelist>
3493
3494<para>
3495If free_all is
3496<symbol>True</symbol>,
3497all sections are freed regardless of the value of first and count. Otherwise,
3498the number of sections specified by count are freed, beginning with the section
3499specified by first in the specified geometry.
3500</para>
3501
3502
3503<para>
3504To allocate rows in a section, use
3505<function>XkbAllocGeomRows</function>.
3506</para>
3507
3508
3509<indexterm significance="preferred" zone="XkbAllocGeomRows"><primary><function>XkbAllocGeomRows</function></primary></indexterm>
3510<funcsynopsis id="XkbAllocGeomRows">
3511  <funcprototype>
3512    <funcdef>Status <function>XkbAllocGeomRows</function></funcdef>
3513<!-- (
3514<parameter>section</parameter>,
3515<parameter>num_needed</parameter>
3516) -->
3517
3518    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
3519    <paramdef>int <parameter>num_needed</parameter></paramdef>
3520  </funcprototype>
3521</funcsynopsis>
3522<variablelist>
3523  <varlistentry>
3524    <term>
3525      <parameter>section</parameter>
3526    </term>
3527    <listitem>
3528      <para>
3529        section for which rows should be allocated
3530      </para>
3531    </listitem>
3532  </varlistentry>
3533  <varlistentry>
3534    <term>
3535      <parameter>num_needed</parameter>
3536    </term>
3537    <listitem>
3538      <para>
3539        number of new rows required
3540      </para>
3541    </listitem>
3542  </varlistentry>
3543</variablelist>
3544
3545<para>
3546<function>XkbAllocGeomRows</function>
3547allocates num_needed rows and adds them to the section. No initialization of
3548the rows is done.
3549</para>
3550
3551
3552<para>
3553To free rows in a section, use
3554<function>XkbFreeGeomRows</function>.
3555</para>
3556
3557
3558<indexterm significance="preferred" zone="XkbFreeGeomRows"><primary><function>XkbFreeGeomRows</function></primary></indexterm>
3559<funcsynopsis id="XkbFreeGeomRows">
3560  <funcprototype>
3561    <funcdef>void <function>XkbFreeGeomRows</function></funcdef>
3562<!-- (
3563<parameter>section</parameter>,
3564<parameter>first</parameter>,
3565<parameter>count</parameter>,
3566<parameter>free_all</parameter>
3567) -->
3568
3569    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
3570    <paramdef>int <parameter>first</parameter></paramdef>
3571    <paramdef>int <parameter>count</parameter></paramdef>
3572    <paramdef>Bool <parameter>free_all</parameter></paramdef>
3573  </funcprototype>
3574</funcsynopsis>
3575<variablelist>
3576  <varlistentry>
3577    <term>
3578      <parameter>section</parameter>
3579    </term>
3580    <listitem>
3581      <para>
3582        section in which rows should be freed
3583      </para>
3584    </listitem>
3585  </varlistentry>
3586  <varlistentry>
3587    <term>
3588      <parameter>first</parameter>
3589    </term>
3590    <listitem>
3591      <para>
3592        first row to be freed.
3593      </para>
3594    </listitem>
3595  </varlistentry>
3596  <varlistentry>
3597    <term>
3598      <parameter>count</parameter>
3599    </term>
3600    <listitem>
3601      <para>
3602        number of rows to be freed
3603      </para>
3604    </listitem>
3605  </varlistentry>
3606  <varlistentry>
3607    <term>
3608      <parameter>free_all</parameter>
3609    </term>
3610    <listitem>
3611      <para>
3612        <symbol>True</symbol> &rArr; all rows are freed
3613      </para>
3614    </listitem>
3615  </varlistentry>
3616</variablelist>
3617
3618<para>
3619If free_all is
3620<symbol>True</symbol>,
3621all rows are freed regardless of the value of first and count. Otherwise, the
3622number of rows specified by count are freed, beginning with the row specified
3623by first in the specified section.
3624</para>
3625
3626
3627<para>
3628To allocate overlays in a section, use
3629<function>XkbAllocGeomOverlays</function>.
3630</para>
3631
3632
3633<indexterm significance="preferred" zone="XkbAllocGeomOverlays"><primary><function>XkbAllocGeomOverlays</function></primary></indexterm>
3634<funcsynopsis id="XkbAllocGeomOverlays">
3635  <funcprototype>
3636    <funcdef>Status <function>XkbAllocGeomOverlays</function></funcdef>
3637<!-- (
3638<parameter>section</parameter>,
3639<parameter>num_needed</parameter>
3640) -->
3641
3642    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
3643    <paramdef>int <parameter>num_needed</parameter></paramdef>
3644  </funcprototype>
3645</funcsynopsis>
3646<variablelist>
3647  <varlistentry>
3648    <term>
3649      <parameter>section</parameter>
3650    </term>
3651    <listitem>
3652      <para>
3653        section for which overlays should be allocated
3654      </para>
3655    </listitem>
3656  </varlistentry>
3657  <varlistentry>
3658    <term>
3659      <parameter>num_needed</parameter>
3660    </term>
3661    <listitem>
3662      <para>
3663        number of new overlays required
3664      </para>
3665    </listitem>
3666  </varlistentry>
3667</variablelist>
3668
3669<para>
3670<function>XkbAllocGeomOverlays</function>
3671allocates num_needed overlays and adds them to the section. No initialization
3672of the overlays is done.
3673</para>
3674
3675
3676<para>
3677To free rows in an section, use
3678<function>XkbFreeGeomOverlays</function>.
3679</para>
3680
3681
3682<indexterm significance="preferred" zone="XkbFreeGeomOverlays"><primary><function>XkbFreeGeomOverlays</function></primary></indexterm>
3683<funcsynopsis id="XkbFreeGeomOverlays">
3684  <funcprototype>
3685    <funcdef>void <function>XkbFreeGeomOverlays</function></funcdef>
3686<!-- (
3687<parameter>section</parameter>,
3688<parameter>first</parameter>,
3689<parameter>count</parameter>,
3690<parameter>free_all</parameter>
3691) -->
3692
3693    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
3694    <paramdef>int <parameter>first</parameter></paramdef>
3695    <paramdef>int <parameter>count</parameter></paramdef>
3696    <paramdef>Bool <parameter>free_all</parameter></paramdef>
3697  </funcprototype>
3698</funcsynopsis>
3699<variablelist>
3700  <varlistentry>
3701    <term>
3702      <parameter>section</parameter>
3703    </term>
3704    <listitem>
3705      <para>
3706        section in which overlays should be freed
3707      </para>
3708    </listitem>
3709  </varlistentry>
3710  <varlistentry>
3711    <term>
3712      <parameter>first</parameter>
3713    </term>
3714    <listitem>
3715      <para>
3716        first overlay to be freed.
3717      </para>
3718    </listitem>
3719  </varlistentry>
3720  <varlistentry>
3721    <term>
3722      <parameter>count</parameter>
3723    </term>
3724    <listitem>
3725      <para>
3726        number of overlays to be freed
3727      </para>
3728    </listitem>
3729  </varlistentry>
3730  <varlistentry>
3731    <term>
3732      <parameter>free_all</parameter>
3733    </term>
3734    <listitem>
3735      <para>
3736        <symbol>True</symbol> &rArr; all overlays are freed
3737      </para>
3738    </listitem>
3739  </varlistentry>
3740</variablelist>
3741
3742<para>
3743If free_all is
3744<symbol>True</symbol>,
3745all overlays are freed regardless of the value of first and count. Otherwise,
3746the number of overlays specified by count are freed, beginning with the overlay
3747specified by first in the specified section.
3748</para>
3749
3750
3751<para>
3752To allocate rows in a overlay, use
3753<function>XkbAllocGeomOverlayRows</function>.
3754</para>
3755
3756
3757<indexterm significance="preferred" zone="XkbAllocGeomOverlayRows"><primary><function>XkbAllocGeomOverlayRows</function></primary></indexterm>
3758<funcsynopsis id="XkbAllocGeomOverlayRows">
3759  <funcprototype>
3760    <funcdef>Status <function>XkbAllocGeomOverlayRows</function></funcdef>
3761<!-- (
3762<parameter>overlay</parameter>,
3763<parameter>num_needed</parameter>
3764) -->
3765
3766    <paramdef>XkbOverlayPtr <parameter>overlay</parameter></paramdef>
3767    <paramdef>int <parameter>num_needed</parameter></paramdef>
3768  </funcprototype>
3769</funcsynopsis>
3770<variablelist>
3771  <varlistentry>
3772    <term>
3773      <parameter>overlay</parameter>
3774    </term>
3775    <listitem>
3776      <para>
3777        overlay for which rows should be allocated
3778      </para>
3779    </listitem>
3780  </varlistentry>
3781  <varlistentry>
3782    <term>
3783      <parameter>num_needed</parameter>
3784    </term>
3785    <listitem>
3786      <para>
3787        number of new rows required
3788      </para>
3789    </listitem>
3790  </varlistentry>
3791</variablelist>
3792
3793<para>
3794<function>XkbAllocGeomOverlayRows</function>
3795allocates num_needed rows and adds them to the overlay. No initialization of
3796the rows is done.
3797</para>
3798
3799
3800<para>
3801To free rows in an overlay, use
3802<function>XkbFreeGeomOverlayRows</function>.
3803</para>
3804
3805
3806<indexterm significance="preferred" zone="XkbFreeGeomOverlayRows"><primary><function>XkbFreeGeomOverlayRows</function></primary></indexterm>
3807<funcsynopsis id="XkbFreeGeomOverlayRows">
3808  <funcprototype>
3809    <funcdef>void <function>XkbFreeGeomOverlayRows</function></funcdef>
3810<!-- (
3811<parameter>overlay</parameter>,
3812<parameter>first</parameter>,
3813<parameter>count</parameter>,
3814<parameter>free_all</parameter>
3815) -->
3816
3817    <paramdef>XkbSectionPtr <parameter>overlay</parameter></paramdef>
3818    <paramdef>int <parameter>first</parameter></paramdef>
3819    <paramdef>int <parameter>count</parameter></paramdef>
3820    <paramdef>Bool <parameter>free_all</parameter></paramdef>
3821  </funcprototype>
3822</funcsynopsis>
3823<variablelist>
3824  <varlistentry>
3825    <term>
3826      <parameter>overlay</parameter>
3827    </term>
3828    <listitem>
3829      <para>
3830        section in which rows should be freed
3831      </para>
3832    </listitem>
3833  </varlistentry>
3834  <varlistentry>
3835    <term>
3836      <parameter>first</parameter>
3837    </term>
3838    <listitem>
3839      <para>
3840        first row to be freed.
3841      </para>
3842    </listitem>
3843  </varlistentry>
3844  <varlistentry>
3845    <term>
3846      <parameter>count</parameter>
3847    </term>
3848    <listitem>
3849      <para>
3850        number of rows to be freed
3851      </para>
3852    </listitem>
3853  </varlistentry>
3854  <varlistentry>
3855    <term>
3856      <parameter>free_all</parameter>
3857    </term>
3858    <listitem>
3859      <para>
3860        <symbol>True</symbol> &rArr; all rows are freed
3861      </para>
3862    </listitem>
3863  </varlistentry>
3864</variablelist>
3865
3866<para>
3867If free_all is
3868<symbol>True</symbol>,
3869all rows are freed regardless of the value of first and count. Otherwise, the
3870number of rows specified by count are freed, beginning with the row specified
3871by first in the specified overlay.
3872</para>
3873
3874
3875<para>
3876To allocate keys in an overlay row, use
3877<function>XkbAllocGeomOverlayKeys</function>.
3878</para>
3879
3880
3881<indexterm significance="preferred" zone="XkbAllocGeomOverlayKeys"><primary><function>XkbAllocGeomOverlayKeys</function></primary></indexterm>
3882<funcsynopsis id="XkbAllocGeomOverlayKeys">
3883  <funcprototype>
3884    <funcdef>Status <function>XkbAllocGeomOverlayKeys</function></funcdef>
3885<!-- (
3886<parameter>row</parameter>,
3887<parameter>num_needed</parameter>
3888) -->
3889
3890    <paramdef>XkbOverlayRowPtr <parameter>row</parameter></paramdef>
3891    <paramdef>int <parameter>num_needed</parameter></paramdef>
3892  </funcprototype>
3893</funcsynopsis>
3894<variablelist>
3895  <varlistentry>
3896    <term>
3897      <parameter>row</parameter>
3898    </term>
3899    <listitem>
3900      <para>
3901        row for which keys should be allocated
3902      </para>
3903    </listitem>
3904  </varlistentry>
3905  <varlistentry>
3906    <term>
3907      <parameter>num_needed</parameter>
3908    </term>
3909    <listitem>
3910      <para>
3911        number of new rows required
3912      </para>
3913    </listitem>
3914  </varlistentry>
3915</variablelist>
3916
3917<para>
3918<function>XkbAllocGeomOverlayKeys</function>
3919allocates num_needed keys and adds them to the row. No initialization of the
3920keys is done.
3921</para>
3922
3923
3924<para>
3925To free keys in an overlay row, use
3926<function>XkbFreeGeomOverlayKeys</function>.
3927</para>
3928
3929
3930<indexterm significance="preferred" zone="XkbFreeGeomOverlayKeys"><primary><function>XkbFreeGeomOverlayKeys</function></primary></indexterm>
3931<funcsynopsis id="XkbFreeGeomOverlayKeys">
3932  <funcprototype>
3933    <funcdef>void <function>XkbFreeGeomOverlayKeys</function></funcdef>
3934<!-- (
3935<parameter>row</parameter>,
3936<parameter>first</parameter>,
3937<parameter>count</parameter>,
3938<parameter>free_all</parameter>
3939) -->
3940
3941    <paramdef>XkbOverlayRowPtr <parameter>row</parameter></paramdef>
3942    <paramdef>int <parameter>first</parameter></paramdef>
3943    <paramdef>int <parameter>count</parameter></paramdef>
3944    <paramdef>Bool <parameter>free_all</parameter></paramdef>
3945  </funcprototype>
3946</funcsynopsis>
3947<variablelist>
3948  <varlistentry>
3949    <term>
3950      <parameter>row</parameter>
3951    </term>
3952    <listitem>
3953      <para>
3954        row in which keys should be freed
3955      </para>
3956    </listitem>
3957  </varlistentry>
3958  <varlistentry>
3959    <term>
3960      <parameter>first</parameter>
3961    </term>
3962    <listitem>
3963      <para>
3964        first key to be freed.
3965      </para>
3966    </listitem>
3967  </varlistentry>
3968  <varlistentry>
3969    <term>
3970      <parameter>count</parameter>
3971    </term>
3972    <listitem>
3973      <para>
3974        number of keys to be freed
3975      </para>
3976    </listitem>
3977  </varlistentry>
3978  <varlistentry>
3979    <term>
3980      <parameter>free_all</parameter>
3981    </term>
3982    <listitem>
3983      <para>
3984        <symbol>True</symbol> &rArr; all keys are freed
3985      </para>
3986    </listitem>
3987  </varlistentry>
3988</variablelist>
3989
3990<para>
3991If free_all is
3992<symbol>True</symbol>,
3993all keys are freed regardless of the value of first and count. Otherwise, the
3994number of keys specified by count are freed, beginning with the key specified
3995by first in the specified row.
3996</para>
3997
3998
3999<para>
4000To allocate doodads that are global to a keyboard geometry, use
4001<function>XkbAllocGeomDoodads</function>.
4002</para>
4003
4004
4005<indexterm significance="preferred" zone="XkbAllocGeomDoodads"><primary><function>XkbAllocGeomDoodads</function></primary></indexterm>
4006<funcsynopsis id="XkbAllocGeomDoodads">
4007  <funcprototype>
4008    <funcdef>Status <function>XkbAllocGeomDoodads</function></funcdef>
4009<!-- (
4010<parameter>geom</parameter>,
4011<parameter>num_needed</parameter>
4012) -->
4013
4014    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
4015    <paramdef>int <parameter>num_needed</parameter></paramdef>
4016  </funcprototype>
4017</funcsynopsis>
4018<variablelist>
4019  <varlistentry>
4020    <term>
4021      <parameter>geom</parameter>
4022    </term>
4023    <listitem>
4024      <para>
4025        geometry for which doodads should be allocated
4026      </para>
4027    </listitem>
4028  </varlistentry>
4029  <varlistentry>
4030    <term>
4031      <parameter>num_needed</parameter>
4032    </term>
4033    <listitem>
4034      <para>
4035        number of new doodads required
4036      </para>
4037    </listitem>
4038  </varlistentry>
4039</variablelist>
4040
4041<para>
4042<function>XkbAllocGeomDoodads</function>
4043allocates num_needed doodads and adds them to the specified geometry
4044<parameter>geom</parameter>.
4045No initialization of the doodads is done.
4046</para>
4047
4048
4049<para>
4050To allocate doodads that are specific to a section, use
4051<function>XkbAllocGeomSectionDoodads</function>.
4052</para>
4053
4054
4055<indexterm significance="preferred" zone="XkbAllocGeomSectionDoodads"><primary><function>XkbAllocGeomSectionDoodads</function></primary></indexterm>
4056<funcsynopsis id="XkbAllocGeomSectionDoodads">
4057  <funcprototype>
4058    <funcdef>Status <function>XkbAllocGeomSectionDoodads</function></funcdef>
4059<!-- (
4060<parameter>section</parameter>,
4061<parameter>num_needed</parameter>
4062) -->
4063
4064    <paramdef>XkbSectionPtr <parameter>section</parameter></paramdef>
4065    <paramdef>int <parameter>num_needed</parameter></paramdef>
4066  </funcprototype>
4067</funcsynopsis>
4068<variablelist>
4069  <varlistentry>
4070    <term>
4071      <parameter>section</parameter>
4072    </term>
4073    <listitem>
4074      <para>
4075        section for which doodads should be allocated
4076      </para>
4077    </listitem>
4078  </varlistentry>
4079  <varlistentry>
4080    <term>
4081      <parameter>num_needed</parameter>
4082    </term>
4083    <listitem>
4084      <para>
4085        number of new doodads required
4086      </para>
4087    </listitem>
4088  </varlistentry>
4089</variablelist>
4090
4091<para>
4092<function>XkbAllocGeomSectionDoodads</function>
4093allocates num_needed doodads and adds them to the specified
4094<parameter>section</parameter>.
4095No initialization of the doodads is done.
4096</para>
4097
4098
4099<para>
4100To free geometry doodads, use
4101<function>XkbFreeGeomDoodads</function>.
4102</para>
4103
4104
4105<indexterm significance="preferred" zone="XkbFreeGeomDoodads"><primary><function>XkbFreeGeomDoodads</function></primary></indexterm>
4106<funcsynopsis id="XkbFreeGeomDoodads">
4107  <funcprototype>
4108    <funcdef>void <function>XkbFreeGeomDoodads</function></funcdef>
4109<!-- (
4110<parameter>doodads</parameter>,
4111<parameter>count</parameter>,
4112<parameter>free_all</parameter>
4113) -->
4114
4115    <paramdef>XkbDoodadPtr <parameter>doodads</parameter></paramdef>
4116    <paramdef>int <parameter>count</parameter></paramdef>
4117    <paramdef>Bool <parameter>free_all</parameter></paramdef>
4118  </funcprototype>
4119</funcsynopsis>
4120<variablelist>
4121  <varlistentry>
4122    <term>
4123      <parameter>doodads</parameter>
4124    </term>
4125    <listitem>
4126      <para>
4127        doodads to be freed
4128      </para>
4129    </listitem>
4130  </varlistentry>
4131  <varlistentry>
4132    <term>
4133      <parameter>count</parameter>
4134    </term>
4135    <listitem>
4136      <para>
4137        number of doodads to be freed
4138      </para>
4139    </listitem>
4140  </varlistentry>
4141  <varlistentry>
4142    <term>
4143      <parameter>free_all</parameter>
4144    </term>
4145    <listitem>
4146      <para>
4147        <symbol>True</symbol> &rArr; all doodads are freed
4148      </para>
4149    </listitem>
4150  </varlistentry>
4151</variablelist>
4152
4153<para>
4154If
4155<parameter>free_all</parameter>
4156is
4157<symbol>True</symbol>,
4158all doodads in the array are freed, regardless of the value of count.
4159Otherwise, count doodads are freed.
4160</para>
4161
4162
4163<para>
4164To allocate an entire geometry, use
4165<function>XkbAllocGeometry</function>.
4166</para>
4167
4168
4169<indexterm significance="preferred" zone="XkbAllocGeometry"><primary><function>XkbAllocGeometry</function></primary></indexterm>
4170<funcsynopsis id="XkbAllocGeometry">
4171  <funcprototype>
4172    <funcdef>Status <function>XkbAllocGeometry</function></funcdef>
4173<!-- (
4174<parameter>xkb</parameter>,
4175<parameter>sizes</parameter>
4176) -->
4177
4178    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
4179    <paramdef>XkbGeometrySizesPtr <parameter>sizes</parameter></paramdef>
4180  </funcprototype>
4181</funcsynopsis>
4182<variablelist>
4183  <varlistentry>
4184    <term>
4185      <parameter>xkb</parameter>
4186    </term>
4187    <listitem>
4188      <para>
4189        keyboard description for which geometry is to be allocated
4190      </para>
4191    </listitem>
4192  </varlistentry>
4193  <varlistentry>
4194    <term>
4195      <parameter>sizes</parameter>
4196    </term>
4197    <listitem>
4198      <para>
4199        initial sizes for all geometry components
4200      </para>
4201    </listitem>
4202  </varlistentry>
4203</variablelist>
4204
4205<para>
4206<function>XkbAllocGeometry</function>
4207allocates a keyboard geometry and adds it to the keyboard description
4208specified by xkb. The keyboard description should be obtained via the
4209XkbGetKeyboard or XkbAllockeyboard functions. The sizes parameter specifies the
4210number of elements to be reserved for the subcomponents of the keyboard
4211geometry and can be zero or more. These subcomponents include the properties,
4212colors, shapes, sections, and doodads.
4213</para>
4214
4215
4216<para>
4217To free an entire geometry, use
4218<function>XkbFreeGeometry</function>.
4219</para>
4220
4221
4222<indexterm significance="preferred" zone="XkbFreeGeometry"><primary><function>XkbFreeGeometry</function></primary></indexterm>
4223<funcsynopsis id="XkbFreeGeometry">
4224  <funcprototype>
4225    <funcdef>void <function>XkbFreeGeometry</function></funcdef>
4226<!-- (
4227<parameter>geom</parameter>,
4228<parameter>which</parameter>,
4229<parameter>free_all</parameter>
4230) -->
4231
4232    <paramdef>XkbGeometryPtr <parameter>geom</parameter></paramdef>
4233    <paramdef>unsigned int <parameter>which</parameter></paramdef>
4234    <paramdef>Bool <parameter>free_all</parameter></paramdef>
4235  </funcprototype>
4236</funcsynopsis>
4237<variablelist>
4238  <varlistentry>
4239    <term>
4240      <parameter>geom</parameter>
4241    </term>
4242    <listitem>
4243      <para>
4244        geometry to be freed
4245      </para>
4246    </listitem>
4247  </varlistentry>
4248  <varlistentry>
4249    <term>
4250      <parameter>which</parameter>
4251    </term>
4252    <listitem>
4253      <para>
4254        mask of geometry components to be freed
4255      </para>
4256    </listitem>
4257  </varlistentry>
4258  <varlistentry>
4259    <term>
4260      <parameter>free_all</parameter>
4261    </term>
4262    <listitem>
4263      <para>
4264        <symbol>True</symbol> &rArr; the entire geometry is freed.
4265      </para>
4266    </listitem>
4267  </varlistentry>
4268</variablelist>
4269
4270<para>
4271The values of which and free_all determine how much of the specified geometry
4272is freed. The valid values for which are:
4273
4274<programlisting>
4275#define      XkbGeomPropertiesMask  (1&lt;&lt;0)
4276#define      XkbGeomColorsMask      (1&lt;&lt;1)
4277#define      XkbGeomShapesMask      (1&lt;&lt;2)
4278#define      XkbGeomSectionsMask    (1&lt;&lt;3)
4279#define      XkbGeomDoodadsMask     (1&lt;&lt;4)
4280#define      XkbGeomAllMask         (0x1f)
4281</programlisting></para>
4282
4283<para>
4284If free_all is
4285<symbol>True</symbol>,
4286the entire geometry is freed regardless of the value of which. Otherwise, the
4287portions of the geometry specified by which are freed.
4288</para>
4289
4290</sect1>
4291</chapter>
4292