2 Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
4 Permission to use, copy, modify, and distribute this
5 software and its documentation for any purpose and without
6 fee is hereby granted, provided that the above copyright
7 notice appear in all copies and that both that copyright
8 notice and this permission notice appear in supporting
9 documentation, and that the name of Silicon Graphics not be
10 used in advertising or publicity pertaining to distribution
11 of the software without specific prior written permission.
12 Silicon Graphics makes no representation about the suitability
13 of this software for any purpose. It is provided "as is"
14 without any express or implied warranty.
16 SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18 AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
19 GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
20 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
22 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
23 THE USE OR PERFORMANCE OF THIS SOFTWARE.
29 #include "X11/extensions/XKBcommon.h"
30 #include "XKBcommonint.h"
32 #include <X11/Xdefs.h>
33 #include <X11/extensions/XKB.h>
36 _XkbFreeGeomLeafElems(Bool freeAll, int first, int count,
37 unsigned short *num_inout, unsigned short *sz_inout,
38 char **elems, unsigned int elem_sz)
40 if (freeAll || !(*elems)) {
41 *num_inout = *sz_inout = 0;
49 if ((first >= (*num_inout)) || (first < 0) || (count < 1))
52 if (first + count >= (*num_inout))
53 /* truncating the array is easy */
57 int extra = ((*num_inout) - first + count) * elem_sz;
60 memmove(&ptr[first * elem_sz], &ptr[(first + count) * elem_sz],
63 (*num_inout) -= count;
67 typedef void (*ContentsClearFunc)(char *priv);
70 _XkbFreeGeomNonLeafElems(Bool freeAll, int first, int count,
71 unsigned short *num_inout, unsigned short *sz_inout,
72 char **elems, unsigned int elem_sz,
73 ContentsClearFunc freeFunc)
82 else if ((first >= (*num_inout)) || (first < 0) || (count < 1))
84 else if (first + count > (*num_inout))
85 count = (*num_inout) - first;
92 ptr += first * elem_sz;
93 for (i = 0; i < count; i++) {
100 *num_inout = *sz_inout = 0;
106 else if (first + count >= (*num_inout))
109 i = ((*num_inout) - first + count) * elem_sz;
111 memmove(&ptr[first * elem_sz], &ptr[(first + count) * elem_sz], i);
112 (*num_inout) -= count;
117 _XkbClearProperty(char *prop_in)
119 XkbPropertyPtr prop = (XkbPropertyPtr)prop_in;
122 _XkbFree(prop->name);
126 _XkbFree(prop->value);
132 XkbcFreeGeomProperties(XkbGeometryPtr geom, int first, int count, Bool freeAll)
134 _XkbFreeGeomNonLeafElems(freeAll, first, count,
135 &geom->num_properties, &geom->sz_properties,
136 (char **)&geom->properties,
137 sizeof(XkbPropertyRec),
142 XkbcFreeGeomKeyAliases(XkbGeometryPtr geom, int first, int count, Bool freeAll)
144 _XkbFreeGeomLeafElems(freeAll, first, count,
145 &geom->num_key_aliases, &geom->sz_key_aliases,
146 (char **)&geom->key_aliases,
147 sizeof(XkbKeyAliasRec));
151 _XkbClearColor(char *color_in)
153 XkbColorPtr color = (XkbColorPtr)color_in;
156 _XkbFree(color->spec);
160 XkbcFreeGeomColors(XkbGeometryPtr geom, int first, int count, Bool freeAll)
162 _XkbFreeGeomNonLeafElems(freeAll, first, count,
163 &geom->num_colors, &geom->sz_colors,
164 (char **)&geom->colors, sizeof(XkbColorRec),
169 XkbcFreeGeomPoints(XkbOutlinePtr outline, int first, int count, Bool freeAll)
171 _XkbFreeGeomLeafElems(freeAll, first, count,
172 &outline->num_points, &outline->sz_points,
173 (char **)&outline->points, sizeof(XkbPointRec));
177 _XkbClearOutline(char *outline_in)
179 XkbOutlinePtr outline = (XkbOutlinePtr)outline_in;
182 XkbcFreeGeomPoints(outline, 0, outline->num_points, True);
186 XkbcFreeGeomOutlines(XkbShapePtr shape, int first, int count, Bool freeAll)
188 _XkbFreeGeomNonLeafElems(freeAll, first, count,
189 &shape->num_outlines, &shape->sz_outlines,
190 (char **)&shape->outlines, sizeof(XkbOutlineRec),
195 _XkbClearShape(char *shape_in)
197 XkbShapePtr shape = (XkbShapePtr)shape_in;
200 XkbcFreeGeomOutlines(shape, 0, shape->num_outlines, True);
204 XkbcFreeGeomShapes(XkbGeometryPtr geom, int first, int count, Bool freeAll)
206 _XkbFreeGeomNonLeafElems(freeAll, first, count,
207 &geom->num_shapes, &geom->sz_shapes,
208 (char **)&geom->shapes, sizeof(XkbShapeRec),
213 XkbcFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count,
216 _XkbFreeGeomLeafElems(freeAll, first, count,
217 &row->num_keys, &row->sz_keys,
218 (char **)&row->keys, sizeof(XkbOverlayKeyRec));
223 _XkbClearOverlayRow(char *row_in)
225 XkbOverlayRowPtr row = (XkbOverlayRowPtr)row_in;
228 XkbcFreeGeomOverlayKeys(row, 0, row->num_keys, True);
232 XkbcFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count,
235 _XkbFreeGeomNonLeafElems(freeAll, first, count,
236 &overlay->num_rows, &overlay->sz_rows,
237 (char **)&overlay->rows,
238 sizeof(XkbOverlayRowRec),
239 _XkbClearOverlayRow);
244 _XkbClearOverlay(char *overlay_in)
246 XkbOverlayPtr overlay = (XkbOverlayPtr)overlay_in;
249 XkbcFreeGeomOverlayRows(overlay, 0, overlay->num_rows, True);
253 XkbcFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll)
255 _XkbFreeGeomNonLeafElems(freeAll, first, count,
256 §ion->num_overlays, §ion->sz_overlays,
257 (char **)§ion->overlays,
258 sizeof(XkbOverlayRec),
264 XkbcFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll)
266 _XkbFreeGeomLeafElems(freeAll, first, count,
267 &row->num_keys, &row->sz_keys,
268 (char **)&row->keys, sizeof(XkbKeyRec));
273 _XkbClearRow(char *row_in)
275 XkbRowPtr row = (XkbRowPtr)row_in;
278 XkbcFreeGeomKeys(row, 0, row->num_keys, True);
282 XkbcFreeGeomRows(XkbSectionPtr section, int first, int count, Bool freeAll)
284 _XkbFreeGeomNonLeafElems(freeAll, first, count,
285 §ion->num_rows, §ion->sz_rows,
286 (char **)§ion->rows, sizeof(XkbRowRec),
292 _XkbClearSection(char *section_in)
294 XkbSectionPtr section = (XkbSectionPtr)section_in;
297 XkbcFreeGeomRows(section, 0, section->num_rows, True);
298 if (section->doodads) {
299 XkbcFreeGeomDoodads(section->doodads, section->num_doodads, True);
300 section->doodads = NULL;
305 XkbcFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll)
307 _XkbFreeGeomNonLeafElems(freeAll, first, count,
308 &geom->num_sections, &geom->sz_sections,
309 (char **)&geom->sections, sizeof(XkbSectionRec),
315 _XkbClearDoodad(char *doodad_in)
317 XkbDoodadPtr doodad = (XkbDoodadPtr)doodad_in;
319 switch (doodad->any.type) {
321 if (doodad->text.text) {
322 _XkbFree(doodad->text.text);
323 doodad->text.text = NULL;
325 if (doodad->text.font) {
326 _XkbFree(doodad->text.font);
327 doodad->text.font = NULL;
332 if (doodad->logo.logo_name) {
333 _XkbFree(doodad->logo.logo_name);
334 doodad->logo.logo_name = NULL;
341 XkbcFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll)
347 for (i = 0, doodad = doodads; i < nDoodads; i++, doodad++)
348 _XkbClearDoodad((char *)doodad);
355 XkbcFreeGeometry(XkbGeometryPtr geom, unsigned which, Bool freeMap)
361 which = XkbGeomAllMask;
363 if ((which & XkbGeomPropertiesMask) && geom->properties)
364 XkbcFreeGeomProperties(geom, 0, geom->num_properties, True);
366 if ((which & XkbGeomColorsMask) && geom->colors)
367 XkbcFreeGeomColors(geom, 0, geom->num_colors, True);
369 if ((which & XkbGeomShapesMask) && geom->shapes)
370 XkbcFreeGeomShapes(geom, 0, geom->num_shapes, True);
372 if ((which & XkbGeomSectionsMask) && geom->sections)
373 XkbcFreeGeomSections(geom, 0, geom->num_sections, True);
375 if ((which & XkbGeomDoodadsMask) && geom->doodads) {
376 XkbcFreeGeomDoodads(geom->doodads, geom->num_doodads, True);
377 geom->doodads = NULL;
378 geom->num_doodads = geom->sz_doodads = 0;
381 if ((which & XkbGeomKeyAliasesMask) && geom->key_aliases)
382 XkbcFreeGeomKeyAliases(geom, 0, geom->num_key_aliases, True);
385 if (geom->label_font) {
386 _XkbFree(geom->label_font);
387 geom->label_font = NULL;
394 _XkbGeomAlloc(char **old, unsigned short *num, unsigned short *total,
395 int num_new, size_t sz_elem)
403 if ((*num) + num_new <= (*total))
406 *total = (*num) + num_new;
409 *old = (char *)_XkbRealloc(*old, (*total) * sz_elem);
411 *old = (char *)_XkbCalloc(*total, sz_elem);
419 bzero(&tmp[sz_elem * (*num)], num_new * sz_elem);
425 #define _XkbAllocProps(g, n) _XkbGeomAlloc((char **)&(g)->properties, \
426 &(g)->num_properties, \
427 &(g)->sz_properties, \
428 (n), sizeof(XkbPropertyRec))
429 #define _XkbAllocColors(g, n) _XkbGeomAlloc((char **)&(g)->colors, \
432 (n), sizeof(XkbColorRec))
433 #define _XkbAllocShapes(g, n) _XkbGeomAlloc((char **)&(g)->shapes, \
436 (n), sizeof(XkbShapeRec))
437 #define _XkbAllocSections(g, n) _XkbGeomAlloc((char **)&(g)->sections, \
438 &(g)->num_sections, \
440 (n), sizeof(XkbSectionRec))
441 #define _XkbAllocDoodads(g, n) _XkbGeomAlloc((char **)&(g)->doodads, \
444 (n), sizeof(XkbDoodadRec))
445 #define _XkbAllocKeyAliases(g, n) _XkbGeomAlloc((char **)&(g)->key_aliases, \
446 &(g)->num_key_aliases, \
447 &(g)->sz_key_aliases, \
448 (n), sizeof(XkbKeyAliasRec))
450 #define _XkbAllocOutlines(s, n) _XkbGeomAlloc((char **)&(s)->outlines, \
451 &(s)->num_outlines, \
453 (n), sizeof(XkbOutlineRec))
454 #define _XkbAllocRows(s, n) _XkbGeomAlloc((char **)&(s)->rows, \
457 (n), sizeof(XkbRowRec))
458 #define _XkbAllocPoints(o, n) _XkbGeomAlloc((char **)&(o)->points, \
461 (n), sizeof(XkbPointRec))
462 #define _XkbAllocKeys(r, n) _XkbGeomAlloc((char **)&(r)->keys, \
465 (n), sizeof(XkbKeyRec))
466 #define _XkbAllocOverlays(s, n) _XkbGeomAlloc((char **)&(s)->overlays, \
467 &(s)->num_overlays, \
469 (n), sizeof(XkbOverlayRec))
470 #define _XkbAllocOverlayRows(o, n) _XkbGeomAlloc((char **)&(o)->rows, \
473 (n), sizeof(XkbOverlayRowRec))
474 #define _XkbAllocOverlayKeys(r, n) _XkbGeomAlloc((char **)&(r)->keys, \
477 (n), sizeof(XkbOverlayKeyRec))
480 XkbcAllocGeomProps(XkbGeometryPtr geom, int nProps)
482 return _XkbAllocProps(geom, nProps);
486 XkbcAllocGeomColors(XkbGeometryPtr geom, int nColors)
488 return _XkbAllocColors(geom, nColors);
492 XkbcAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases)
494 return _XkbAllocKeyAliases(geom, nKeyAliases);
498 XkbcAllocGeomShapes(XkbGeometryPtr geom, int nShapes)
500 return _XkbAllocShapes(geom, nShapes);
504 XkbcAllocGeomSections(XkbGeometryPtr geom, int nSections)
506 return _XkbAllocSections(geom, nSections);
510 XkbcAllocGeomOverlays(XkbSectionPtr section, int nOverlays)
512 return _XkbAllocOverlays(section, nOverlays);
516 XkbcAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows)
518 return _XkbAllocOverlayRows(overlay, nRows);
522 XkbcAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys)
524 return _XkbAllocOverlayKeys(row, nKeys);
528 XkbcAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads)
530 return _XkbAllocDoodads(geom, nDoodads);
534 XkbcAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads)
536 return _XkbAllocDoodads(section, nDoodads);
540 XkbcAllocGeomOutlines(XkbShapePtr shape, int nOL)
542 return _XkbAllocOutlines(shape, nOL);
546 XkbcAllocGeomRows(XkbSectionPtr section, int nRows)
548 return _XkbAllocRows(section, nRows);
552 XkbcAllocGeomPoints(XkbOutlinePtr ol, int nPts)
554 return _XkbAllocPoints(ol, nPts);
558 XkbcAllocGeomKeys(XkbRowPtr row, int nKeys)
560 return _XkbAllocKeys(row, nKeys);
564 XkbcAllocGeometry(XkbcDescPtr xkb, XkbGeometrySizesPtr sizes)
570 xkb->geom = _XkbTypedCalloc(1, XkbGeometryRec);
576 if ((sizes->which & XkbGeomPropertiesMask) &&
577 ((rtrn = _XkbAllocProps(geom, sizes->num_properties)) != Success))
580 if ((sizes->which & XkbGeomColorsMask) &&
581 ((rtrn = _XkbAllocColors(geom, sizes->num_colors)) != Success))
584 if ((sizes->which & XkbGeomShapesMask) &&
585 ((rtrn = _XkbAllocShapes(geom, sizes->num_shapes)) != Success))
588 if ((sizes->which & XkbGeomSectionsMask) &&
589 ((rtrn = _XkbAllocSections(geom, sizes->num_sections)) != Success))
592 if ((sizes->which & XkbGeomDoodadsMask) &&
593 ((rtrn = _XkbAllocDoodads(geom, sizes->num_doodads)) != Success))
596 if ((sizes->which & XkbGeomKeyAliasesMask) &&
597 ((rtrn = _XkbAllocKeyAliases(geom, sizes->num_key_aliases)) != Success))
602 XkbcFreeGeometry(geom, XkbGeomAllMask, True);
608 XkbcAddGeomProperty(XkbGeometryPtr geom,char *name,char *value)
611 register XkbPropertyPtr prop;
613 if ((!geom)||(!name)||(!value))
615 for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
616 if ((prop->name)&&(strcmp(name,prop->name)==0)) {
618 _XkbFree(prop->value);
619 prop->value= (char *)_XkbAlloc(strlen(value)+1);
621 strcpy(prop->value,value);
625 if ((geom->num_properties>=geom->sz_properties)&&
626 (_XkbAllocProps(geom,1)!=Success)) {
629 prop= &geom->properties[geom->num_properties];
630 prop->name= (char *)_XkbAlloc(strlen(name)+1);
633 strcpy(prop->name,name);
634 prop->value= (char *)_XkbAlloc(strlen(value)+1);
636 _XkbFree(prop->name);
640 strcpy(prop->value,value);
641 geom->num_properties++;
646 XkbcAddGeomKeyAlias(XkbGeometryPtr geom,char *aliasStr,char *realStr)
649 register XkbKeyAliasPtr alias;
651 if ((!geom)||(!aliasStr)||(!realStr)||(!aliasStr[0])||(!realStr[0]))
653 for (i=0,alias=geom->key_aliases;i<geom->num_key_aliases;i++,alias++) {
654 if (strncmp(alias->alias,aliasStr,XkbKeyNameLength)==0) {
655 bzero(alias->real,XkbKeyNameLength);
656 strncpy(alias->real,realStr,XkbKeyNameLength);
660 if ((geom->num_key_aliases>=geom->sz_key_aliases)&&
661 (_XkbAllocKeyAliases(geom,1)!=Success)) {
664 alias= &geom->key_aliases[geom->num_key_aliases];
665 bzero(alias,sizeof(XkbKeyAliasRec));
666 strncpy(alias->alias,aliasStr,XkbKeyNameLength);
667 strncpy(alias->real,realStr,XkbKeyNameLength);
668 geom->num_key_aliases++;
673 XkbcAddGeomColor(XkbGeometryPtr geom,char *spec,unsigned int pixel)
676 register XkbColorPtr color;
678 if ((!geom)||(!spec))
680 for (i=0,color=geom->colors;i<geom->num_colors;i++,color++) {
681 if ((color->spec)&&(strcmp(color->spec,spec)==0)) {
686 if ((geom->num_colors>=geom->sz_colors)&&
687 (_XkbAllocColors(geom,1)!=Success)) {
690 color= &geom->colors[geom->num_colors];
692 color->spec= (char *)_XkbAlloc(strlen(spec)+1);
695 strcpy(color->spec,spec);
701 XkbcAddGeomOutline(XkbShapePtr shape,int sz_points)
703 XkbOutlinePtr outline;
705 if ((!shape)||(sz_points<0))
707 if ((shape->num_outlines>=shape->sz_outlines)&&
708 (_XkbAllocOutlines(shape,1)!=Success)) {
711 outline= &shape->outlines[shape->num_outlines];
712 bzero(outline,sizeof(XkbOutlineRec));
713 if ((sz_points>0)&&(_XkbAllocPoints(outline,sz_points)!=Success))
715 shape->num_outlines++;
720 XkbcAddGeomShape(XkbGeometryPtr geom,Atom name,int sz_outlines)
725 if ((!geom)||(!name)||(sz_outlines<0))
727 if (geom->num_shapes>0) {
728 for (shape=geom->shapes,i=0;i<geom->num_shapes;i++,shape++) {
729 if (name==shape->name)
733 if ((geom->num_shapes>=geom->sz_shapes)&&
734 (_XkbAllocShapes(geom,1)!=Success))
736 shape= &geom->shapes[geom->num_shapes];
737 bzero(shape,sizeof(XkbShapeRec));
738 if ((sz_outlines>0)&&(_XkbAllocOutlines(shape,sz_outlines)!=Success))
741 shape->primary= shape->approx= NULL;
747 XkbcAddGeomKey(XkbRowPtr row)
752 if ((row->num_keys>=row->sz_keys)&&(_XkbAllocKeys(row,1)!=Success))
754 key= &row->keys[row->num_keys++];
755 bzero(key,sizeof(XkbKeyRec));
760 XkbcAddGeomRow(XkbSectionPtr section,int sz_keys)
764 if ((!section)||(sz_keys<0))
766 if ((section->num_rows>=section->sz_rows)&&
767 (_XkbAllocRows(section,1)!=Success))
769 row= §ion->rows[section->num_rows];
770 bzero(row,sizeof(XkbRowRec));
771 if ((sz_keys>0)&&(_XkbAllocKeys(row,sz_keys)!=Success))
778 XkbcAddGeomSection( XkbGeometryPtr geom,
785 XkbSectionPtr section;
787 if ((!geom)||(name==None)||(sz_rows<0))
789 for (i=0,section=geom->sections;i<geom->num_sections;i++,section++) {
790 if (section->name!=name)
792 if (((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success))||
793 ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success))||
794 ((sz_over>0)&&(_XkbAllocOverlays(section,sz_over)!=Success)))
798 if ((geom->num_sections>=geom->sz_sections)&&
799 (_XkbAllocSections(geom,1)!=Success))
801 section= &geom->sections[geom->num_sections];
802 if ((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success))
804 if ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success)) {
806 _XkbFree(section->rows);
808 section->sz_rows= section->num_rows= 0;
813 geom->num_sections++;
818 XkbcAddGeomDoodad(XkbGeometryPtr geom,XkbSectionPtr section,Atom name)
820 XkbDoodadPtr old,doodad;
821 register int i,nDoodads;
823 if ((!geom)||(name==None))
825 if ((section!=NULL)&&(section->num_doodads>0)) {
826 old= section->doodads;
827 nDoodads= section->num_doodads;
831 nDoodads= geom->num_doodads;
833 for (i=0,doodad=old;i<nDoodads;i++,doodad++) {
834 if (doodad->any.name==name)
838 if ((section->num_doodads>=geom->sz_doodads)&&
839 (_XkbAllocDoodads(section,1)!=Success)) {
842 doodad= §ion->doodads[section->num_doodads++];
845 if ((geom->num_doodads>=geom->sz_doodads)&&
846 (_XkbAllocDoodads(geom,1)!=Success))
848 doodad= &geom->doodads[geom->num_doodads++];
850 bzero(doodad,sizeof(XkbDoodadRec));
851 doodad->any.name= name;
856 XkbcAddGeomOverlayKey( XkbOverlayPtr overlay,
857 XkbOverlayRowPtr row,
862 XkbOverlayKeyPtr key;
863 XkbSectionPtr section;
867 if ((!overlay)||(!row)||(!over)||(!under))
869 section= overlay->section_under;
870 if (row->row_under>=section->num_rows)
872 row_under= §ion->rows[row->row_under];
873 for (i=0,found=False;i<row_under->num_keys;i++) {
874 if (strncmp(under,row_under->keys[i].name.name,XkbKeyNameLength)==0) {
881 if ((row->num_keys>=row->sz_keys)&&(_XkbAllocOverlayKeys(row,1)!=Success))
883 key= &row->keys[row->num_keys];
884 strncpy(key->under.name,under,XkbKeyNameLength);
885 strncpy(key->over.name,over,XkbKeyNameLength);
891 XkbcAddGeomOverlayRow(XkbOverlayPtr overlay,int row_under,int sz_keys)
894 XkbOverlayRowPtr row;
896 if ((!overlay)||(sz_keys<0))
898 if (row_under>=overlay->section_under->num_rows)
900 for (i=0;i<overlay->num_rows;i++) {
901 if (overlay->rows[i].row_under==row_under) {
902 row= &overlay->rows[i];
903 if ((row->sz_keys<sz_keys)&&
904 (_XkbAllocOverlayKeys(row,sz_keys)!=Success)) {
907 return &overlay->rows[i];
910 if ((overlay->num_rows>=overlay->sz_rows)&&
911 (_XkbAllocOverlayRows(overlay,1)!=Success))
913 row= &overlay->rows[overlay->num_rows];
914 bzero(row,sizeof(XkbOverlayRowRec));
915 if ((sz_keys>0)&&(_XkbAllocOverlayKeys(row,sz_keys)!=Success))
917 row->row_under= row_under;
923 XkbcAddGeomOverlay(XkbSectionPtr section,Atom name,int sz_rows)
926 XkbOverlayPtr overlay;
928 if ((!section)||(name==None)||(sz_rows==0))
931 for (i=0,overlay=section->overlays;i<section->num_overlays;i++,overlay++) {
932 if (overlay->name==name) {
933 if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success))
938 if ((section->num_overlays>=section->sz_overlays)&&
939 (_XkbAllocOverlays(section,1)!=Success))
941 overlay= §ion->overlays[section->num_overlays];
942 if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success))
945 overlay->section_under= section;
946 section->num_overlays++;