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.
30 #include "X11/extensions/XKBcommon.h"
31 #include "XKBcommonint.h"
32 #include <X11/extensions/XKB.h>
35 _XkbFreeGeomLeafElems(Bool freeAll, int first, int count,
36 unsigned short *num_inout, unsigned short *sz_inout,
37 char **elems, unsigned int elem_sz)
39 if (freeAll || !(*elems)) {
40 *num_inout = *sz_inout = 0;
48 if ((first >= (*num_inout)) || (first < 0) || (count < 1))
51 if (first + count >= (*num_inout))
52 /* truncating the array is easy */
56 int extra = ((*num_inout) - first + count) * elem_sz;
59 memmove(&ptr[first * elem_sz], &ptr[(first + count) * elem_sz],
62 (*num_inout) -= count;
66 typedef void (*ContentsClearFunc)(char *priv);
69 _XkbFreeGeomNonLeafElems(Bool freeAll, int first, int count,
70 unsigned short *num_inout, unsigned short *sz_inout,
71 char **elems, unsigned int elem_sz,
72 ContentsClearFunc freeFunc)
81 else if ((first >= (*num_inout)) || (first < 0) || (count < 1))
83 else if (first + count > (*num_inout))
84 count = (*num_inout) - first;
91 ptr += first * elem_sz;
92 for (i = 0; i < count; i++) {
99 *num_inout = *sz_inout = 0;
105 else if (first + count >= (*num_inout))
108 i = ((*num_inout) - first + count) * elem_sz;
110 memmove(&ptr[first * elem_sz], &ptr[(first + count) * elem_sz], i);
111 (*num_inout) -= count;
116 _XkbClearProperty(char *prop_in)
118 XkbPropertyPtr prop = (XkbPropertyPtr)prop_in;
121 _XkbFree(prop->name);
125 _XkbFree(prop->value);
131 XkbcFreeGeomProperties(XkbGeometryPtr geom, int first, int count, Bool freeAll)
133 _XkbFreeGeomNonLeafElems(freeAll, first, count,
134 &geom->num_properties, &geom->sz_properties,
135 (char **)&geom->properties,
136 sizeof(XkbPropertyRec),
141 XkbcFreeGeomKeyAliases(XkbGeometryPtr geom, int first, int count, Bool freeAll)
143 _XkbFreeGeomLeafElems(freeAll, first, count,
144 &geom->num_key_aliases, &geom->sz_key_aliases,
145 (char **)&geom->key_aliases,
146 sizeof(XkbKeyAliasRec));
150 _XkbClearColor(char *color_in)
152 XkbColorPtr color = (XkbColorPtr)color_in;
155 _XkbFree(color->spec);
159 XkbcFreeGeomColors(XkbGeometryPtr geom, int first, int count, Bool freeAll)
161 _XkbFreeGeomNonLeafElems(freeAll, first, count,
162 &geom->num_colors, &geom->sz_colors,
163 (char **)&geom->colors, sizeof(XkbColorRec),
168 XkbcFreeGeomPoints(XkbOutlinePtr outline, int first, int count, Bool freeAll)
170 _XkbFreeGeomLeafElems(freeAll, first, count,
171 &outline->num_points, &outline->sz_points,
172 (char **)&outline->points, sizeof(XkbPointRec));
176 _XkbClearOutline(char *outline_in)
178 XkbOutlinePtr outline = (XkbOutlinePtr)outline_in;
181 XkbcFreeGeomPoints(outline, 0, outline->num_points, True);
185 XkbcFreeGeomOutlines(XkbShapePtr shape, int first, int count, Bool freeAll)
187 _XkbFreeGeomNonLeafElems(freeAll, first, count,
188 &shape->num_outlines, &shape->sz_outlines,
189 (char **)&shape->outlines, sizeof(XkbOutlineRec),
194 _XkbClearShape(char *shape_in)
196 XkbShapePtr shape = (XkbShapePtr)shape_in;
199 XkbcFreeGeomOutlines(shape, 0, shape->num_outlines, True);
203 XkbcFreeGeomShapes(XkbGeometryPtr geom, int first, int count, Bool freeAll)
205 _XkbFreeGeomNonLeafElems(freeAll, first, count,
206 &geom->num_shapes, &geom->sz_shapes,
207 (char **)&geom->shapes, sizeof(XkbShapeRec),
212 XkbcFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count,
215 _XkbFreeGeomLeafElems(freeAll, first, count,
216 &row->num_keys, &row->sz_keys,
217 (char **)&row->keys, sizeof(XkbOverlayKeyRec));
222 _XkbClearOverlayRow(char *row_in)
224 XkbOverlayRowPtr row = (XkbOverlayRowPtr)row_in;
227 XkbcFreeGeomOverlayKeys(row, 0, row->num_keys, True);
231 XkbcFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count,
234 _XkbFreeGeomNonLeafElems(freeAll, first, count,
235 &overlay->num_rows, &overlay->sz_rows,
236 (char **)&overlay->rows,
237 sizeof(XkbOverlayRowRec),
238 _XkbClearOverlayRow);
243 _XkbClearOverlay(char *overlay_in)
245 XkbOverlayPtr overlay = (XkbOverlayPtr)overlay_in;
248 XkbcFreeGeomOverlayRows(overlay, 0, overlay->num_rows, True);
252 XkbcFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll)
254 _XkbFreeGeomNonLeafElems(freeAll, first, count,
255 §ion->num_overlays, §ion->sz_overlays,
256 (char **)§ion->overlays,
257 sizeof(XkbOverlayRec),
263 XkbcFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll)
265 _XkbFreeGeomLeafElems(freeAll, first, count,
266 &row->num_keys, &row->sz_keys,
267 (char **)&row->keys, sizeof(XkbKeyRec));
272 _XkbClearRow(char *row_in)
274 XkbRowPtr row = (XkbRowPtr)row_in;
277 XkbcFreeGeomKeys(row, 0, row->num_keys, True);
281 XkbcFreeGeomRows(XkbSectionPtr section, int first, int count, Bool freeAll)
283 _XkbFreeGeomNonLeafElems(freeAll, first, count,
284 §ion->num_rows, §ion->sz_rows,
285 (char **)§ion->rows, sizeof(XkbRowRec),
291 _XkbClearSection(char *section_in)
293 XkbSectionPtr section = (XkbSectionPtr)section_in;
296 XkbcFreeGeomRows(section, 0, section->num_rows, True);
297 if (section->doodads) {
298 XkbcFreeGeomDoodads(section->doodads, section->num_doodads, True);
299 section->doodads = NULL;
304 XkbcFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll)
306 _XkbFreeGeomNonLeafElems(freeAll, first, count,
307 &geom->num_sections, &geom->sz_sections,
308 (char **)&geom->sections, sizeof(XkbSectionRec),
314 _XkbClearDoodad(char *doodad_in)
316 XkbDoodadPtr doodad = (XkbDoodadPtr)doodad_in;
318 switch (doodad->any.type) {
320 if (doodad->text.text) {
321 _XkbFree(doodad->text.text);
322 doodad->text.text = NULL;
324 if (doodad->text.font) {
325 _XkbFree(doodad->text.font);
326 doodad->text.font = NULL;
331 if (doodad->logo.logo_name) {
332 _XkbFree(doodad->logo.logo_name);
333 doodad->logo.logo_name = NULL;
340 XkbcFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll)
346 for (i = 0, doodad = doodads; i < nDoodads; i++, doodad++)
347 _XkbClearDoodad((char *)doodad);
354 XkbcFreeGeometry(XkbGeometryPtr geom, unsigned which, Bool freeMap)
360 which = XkbGeomAllMask;
362 if ((which & XkbGeomPropertiesMask) && geom->properties)
363 XkbcFreeGeomProperties(geom, 0, geom->num_properties, True);
365 if ((which & XkbGeomColorsMask) && geom->colors)
366 XkbcFreeGeomColors(geom, 0, geom->num_colors, True);
368 if ((which & XkbGeomShapesMask) && geom->shapes)
369 XkbcFreeGeomShapes(geom, 0, geom->num_shapes, True);
371 if ((which & XkbGeomSectionsMask) && geom->sections)
372 XkbcFreeGeomSections(geom, 0, geom->num_sections, True);
374 if ((which & XkbGeomDoodadsMask) && geom->doodads) {
375 XkbcFreeGeomDoodads(geom->doodads, geom->num_doodads, True);
376 geom->doodads = NULL;
377 geom->num_doodads = geom->sz_doodads = 0;
380 if ((which & XkbGeomKeyAliasesMask) && geom->key_aliases)
381 XkbcFreeGeomKeyAliases(geom, 0, geom->num_key_aliases, True);
384 if (geom->label_font) {
385 _XkbFree(geom->label_font);
386 geom->label_font = NULL;
393 _XkbGeomAlloc(char **old, unsigned short *num, unsigned short *total,
394 int num_new, size_t sz_elem)
402 if ((*num) + num_new <= (*total))
405 *total = (*num) + num_new;
408 *old = (char *)_XkbRealloc(*old, (*total) * sz_elem);
410 *old = (char *)_XkbCalloc(*total, sz_elem);
418 bzero(&tmp[sz_elem * (*num)], num_new * sz_elem);
424 #define _XkbAllocProps(g, n) _XkbGeomAlloc((char **)&(g)->properties, \
425 &(g)->num_properties, \
426 &(g)->sz_properties, \
427 (n), sizeof(XkbPropertyRec))
428 #define _XkbAllocColors(g, n) _XkbGeomAlloc((char **)&(g)->colors, \
431 (n), sizeof(XkbColorRec))
432 #define _XkbAllocShapes(g, n) _XkbGeomAlloc((char **)&(g)->shapes, \
435 (n), sizeof(XkbShapeRec))
436 #define _XkbAllocSections(g, n) _XkbGeomAlloc((char **)&(g)->sections, \
437 &(g)->num_sections, \
439 (n), sizeof(XkbSectionRec))
440 #define _XkbAllocDoodads(g, n) _XkbGeomAlloc((char **)&(g)->doodads, \
443 (n), sizeof(XkbDoodadRec))
444 #define _XkbAllocKeyAliases(g, n) _XkbGeomAlloc((char **)&(g)->key_aliases, \
445 &(g)->num_key_aliases, \
446 &(g)->sz_key_aliases, \
447 (n), sizeof(XkbKeyAliasRec))
449 #define _XkbAllocOutlines(s, n) _XkbGeomAlloc((char **)&(s)->outlines, \
450 &(s)->num_outlines, \
452 (n), sizeof(XkbOutlineRec))
453 #define _XkbAllocRows(s, n) _XkbGeomAlloc((char **)&(s)->rows, \
456 (n), sizeof(XkbRowRec))
457 #define _XkbAllocPoints(o, n) _XkbGeomAlloc((char **)&(o)->points, \
460 (n), sizeof(XkbPointRec))
461 #define _XkbAllocKeys(r, n) _XkbGeomAlloc((char **)&(r)->keys, \
464 (n), sizeof(XkbKeyRec))
465 #define _XkbAllocOverlays(s, n) _XkbGeomAlloc((char **)&(s)->overlays, \
466 &(s)->num_overlays, \
468 (n), sizeof(XkbOverlayRec))
469 #define _XkbAllocOverlayRows(o, n) _XkbGeomAlloc((char **)&(o)->rows, \
472 (n), sizeof(XkbOverlayRowRec))
473 #define _XkbAllocOverlayKeys(r, n) _XkbGeomAlloc((char **)&(r)->keys, \
476 (n), sizeof(XkbOverlayKeyRec))
479 XkbcAllocGeomProps(XkbGeometryPtr geom, int nProps)
481 return _XkbAllocProps(geom, nProps);
485 XkbcAllocGeomColors(XkbGeometryPtr geom, int nColors)
487 return _XkbAllocColors(geom, nColors);
491 XkbcAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases)
493 return _XkbAllocKeyAliases(geom, nKeyAliases);
497 XkbcAllocGeomShapes(XkbGeometryPtr geom, int nShapes)
499 return _XkbAllocShapes(geom, nShapes);
503 XkbcAllocGeomSections(XkbGeometryPtr geom, int nSections)
505 return _XkbAllocSections(geom, nSections);
509 XkbcAllocGeomOverlays(XkbSectionPtr section, int nOverlays)
511 return _XkbAllocOverlays(section, nOverlays);
515 XkbcAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows)
517 return _XkbAllocOverlayRows(overlay, nRows);
521 XkbcAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys)
523 return _XkbAllocOverlayKeys(row, nKeys);
527 XkbcAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads)
529 return _XkbAllocDoodads(geom, nDoodads);
533 XkbcAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads)
535 return _XkbAllocDoodads(section, nDoodads);
539 XkbcAllocGeomOutlines(XkbShapePtr shape, int nOL)
541 return _XkbAllocOutlines(shape, nOL);
545 XkbcAllocGeomRows(XkbSectionPtr section, int nRows)
547 return _XkbAllocRows(section, nRows);
551 XkbcAllocGeomPoints(XkbOutlinePtr ol, int nPts)
553 return _XkbAllocPoints(ol, nPts);
557 XkbcAllocGeomKeys(XkbRowPtr row, int nKeys)
559 return _XkbAllocKeys(row, nKeys);
563 XkbcAllocGeometry(XkbcDescPtr xkb, XkbGeometrySizesPtr sizes)
569 xkb->geom = _XkbTypedCalloc(1, XkbGeometryRec);
575 if ((sizes->which & XkbGeomPropertiesMask) &&
576 ((rtrn = _XkbAllocProps(geom, sizes->num_properties)) != Success))
579 if ((sizes->which & XkbGeomColorsMask) &&
580 ((rtrn = _XkbAllocColors(geom, sizes->num_colors)) != Success))
583 if ((sizes->which & XkbGeomShapesMask) &&
584 ((rtrn = _XkbAllocShapes(geom, sizes->num_shapes)) != Success))
587 if ((sizes->which & XkbGeomSectionsMask) &&
588 ((rtrn = _XkbAllocSections(geom, sizes->num_sections)) != Success))
591 if ((sizes->which & XkbGeomDoodadsMask) &&
592 ((rtrn = _XkbAllocDoodads(geom, sizes->num_doodads)) != Success))
595 if ((sizes->which & XkbGeomKeyAliasesMask) &&
596 ((rtrn = _XkbAllocKeyAliases(geom, sizes->num_key_aliases)) != Success))
601 XkbcFreeGeometry(geom, XkbGeomAllMask, True);
607 XkbcAddGeomProperty(XkbGeometryPtr geom,char *name,char *value)
610 register XkbPropertyPtr prop;
612 if ((!geom)||(!name)||(!value))
614 for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
615 if ((prop->name)&&(strcmp(name,prop->name)==0)) {
617 _XkbFree(prop->value);
618 prop->value= (char *)_XkbAlloc(strlen(value)+1);
620 strcpy(prop->value,value);
624 if ((geom->num_properties>=geom->sz_properties)&&
625 (_XkbAllocProps(geom,1)!=Success)) {
628 prop= &geom->properties[geom->num_properties];
629 prop->name= (char *)_XkbAlloc(strlen(name)+1);
632 strcpy(prop->name,name);
633 prop->value= (char *)_XkbAlloc(strlen(value)+1);
635 _XkbFree(prop->name);
639 strcpy(prop->value,value);
640 geom->num_properties++;
645 XkbcAddGeomKeyAlias(XkbGeometryPtr geom,char *aliasStr,char *realStr)
648 register XkbKeyAliasPtr alias;
650 if ((!geom)||(!aliasStr)||(!realStr)||(!aliasStr[0])||(!realStr[0]))
652 for (i=0,alias=geom->key_aliases;i<geom->num_key_aliases;i++,alias++) {
653 if (strncmp(alias->alias,aliasStr,XkbKeyNameLength)==0) {
654 bzero(alias->real,XkbKeyNameLength);
655 strncpy(alias->real,realStr,XkbKeyNameLength);
659 if ((geom->num_key_aliases>=geom->sz_key_aliases)&&
660 (_XkbAllocKeyAliases(geom,1)!=Success)) {
663 alias= &geom->key_aliases[geom->num_key_aliases];
664 bzero(alias,sizeof(XkbKeyAliasRec));
665 strncpy(alias->alias,aliasStr,XkbKeyNameLength);
666 strncpy(alias->real,realStr,XkbKeyNameLength);
667 geom->num_key_aliases++;
672 XkbcAddGeomColor(XkbGeometryPtr geom,char *spec,unsigned int pixel)
675 register XkbColorPtr color;
677 if ((!geom)||(!spec))
679 for (i=0,color=geom->colors;i<geom->num_colors;i++,color++) {
680 if ((color->spec)&&(strcmp(color->spec,spec)==0)) {
685 if ((geom->num_colors>=geom->sz_colors)&&
686 (_XkbAllocColors(geom,1)!=Success)) {
689 color= &geom->colors[geom->num_colors];
691 color->spec= (char *)_XkbAlloc(strlen(spec)+1);
694 strcpy(color->spec,spec);
700 XkbcAddGeomOutline(XkbShapePtr shape,int sz_points)
702 XkbOutlinePtr outline;
704 if ((!shape)||(sz_points<0))
706 if ((shape->num_outlines>=shape->sz_outlines)&&
707 (_XkbAllocOutlines(shape,1)!=Success)) {
710 outline= &shape->outlines[shape->num_outlines];
711 bzero(outline,sizeof(XkbOutlineRec));
712 if ((sz_points>0)&&(_XkbAllocPoints(outline,sz_points)!=Success))
714 shape->num_outlines++;
719 XkbcAddGeomShape(XkbGeometryPtr geom,Atom name,int sz_outlines)
724 if ((!geom)||(!name)||(sz_outlines<0))
726 if (geom->num_shapes>0) {
727 for (shape=geom->shapes,i=0;i<geom->num_shapes;i++,shape++) {
728 if (name==shape->name)
732 if ((geom->num_shapes>=geom->sz_shapes)&&
733 (_XkbAllocShapes(geom,1)!=Success))
735 shape= &geom->shapes[geom->num_shapes];
736 bzero(shape,sizeof(XkbShapeRec));
737 if ((sz_outlines>0)&&(_XkbAllocOutlines(shape,sz_outlines)!=Success))
740 shape->primary= shape->approx= NULL;
746 XkbcAddGeomKey(XkbRowPtr row)
751 if ((row->num_keys>=row->sz_keys)&&(_XkbAllocKeys(row,1)!=Success))
753 key= &row->keys[row->num_keys++];
754 bzero(key,sizeof(XkbKeyRec));
759 XkbcAddGeomRow(XkbSectionPtr section,int sz_keys)
763 if ((!section)||(sz_keys<0))
765 if ((section->num_rows>=section->sz_rows)&&
766 (_XkbAllocRows(section,1)!=Success))
768 row= §ion->rows[section->num_rows];
769 bzero(row,sizeof(XkbRowRec));
770 if ((sz_keys>0)&&(_XkbAllocKeys(row,sz_keys)!=Success))
777 XkbcAddGeomSection( XkbGeometryPtr geom,
784 XkbSectionPtr section;
786 if ((!geom)||(name==None)||(sz_rows<0))
788 for (i=0,section=geom->sections;i<geom->num_sections;i++,section++) {
789 if (section->name!=name)
791 if (((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success))||
792 ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success))||
793 ((sz_over>0)&&(_XkbAllocOverlays(section,sz_over)!=Success)))
797 if ((geom->num_sections>=geom->sz_sections)&&
798 (_XkbAllocSections(geom,1)!=Success))
800 section= &geom->sections[geom->num_sections];
801 if ((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success))
803 if ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success)) {
805 _XkbFree(section->rows);
807 section->sz_rows= section->num_rows= 0;
812 geom->num_sections++;
817 XkbcAddGeomDoodad(XkbGeometryPtr geom,XkbSectionPtr section,Atom name)
819 XkbDoodadPtr old,doodad;
820 register int i,nDoodads;
822 if ((!geom)||(name==None))
824 if ((section!=NULL)&&(section->num_doodads>0)) {
825 old= section->doodads;
826 nDoodads= section->num_doodads;
830 nDoodads= geom->num_doodads;
832 for (i=0,doodad=old;i<nDoodads;i++,doodad++) {
833 if (doodad->any.name==name)
837 if ((section->num_doodads>=geom->sz_doodads)&&
838 (_XkbAllocDoodads(section,1)!=Success)) {
841 doodad= §ion->doodads[section->num_doodads++];
844 if ((geom->num_doodads>=geom->sz_doodads)&&
845 (_XkbAllocDoodads(geom,1)!=Success))
847 doodad= &geom->doodads[geom->num_doodads++];
849 bzero(doodad,sizeof(XkbDoodadRec));
850 doodad->any.name= name;
855 XkbcAddGeomOverlayKey( XkbOverlayPtr overlay,
856 XkbOverlayRowPtr row,
861 XkbOverlayKeyPtr key;
862 XkbSectionPtr section;
866 if ((!overlay)||(!row)||(!over)||(!under))
868 section= overlay->section_under;
869 if (row->row_under>=section->num_rows)
871 row_under= §ion->rows[row->row_under];
872 for (i=0,found=False;i<row_under->num_keys;i++) {
873 if (strncmp(under,row_under->keys[i].name.name,XkbKeyNameLength)==0) {
880 if ((row->num_keys>=row->sz_keys)&&(_XkbAllocOverlayKeys(row,1)!=Success))
882 key= &row->keys[row->num_keys];
883 strncpy(key->under.name,under,XkbKeyNameLength);
884 strncpy(key->over.name,over,XkbKeyNameLength);
890 XkbcAddGeomOverlayRow(XkbOverlayPtr overlay,int row_under,int sz_keys)
893 XkbOverlayRowPtr row;
895 if ((!overlay)||(sz_keys<0))
897 if (row_under>=overlay->section_under->num_rows)
899 for (i=0;i<overlay->num_rows;i++) {
900 if (overlay->rows[i].row_under==row_under) {
901 row= &overlay->rows[i];
902 if ((row->sz_keys<sz_keys)&&
903 (_XkbAllocOverlayKeys(row,sz_keys)!=Success)) {
906 return &overlay->rows[i];
909 if ((overlay->num_rows>=overlay->sz_rows)&&
910 (_XkbAllocOverlayRows(overlay,1)!=Success))
912 row= &overlay->rows[overlay->num_rows];
913 bzero(row,sizeof(XkbOverlayRowRec));
914 if ((sz_keys>0)&&(_XkbAllocOverlayKeys(row,sz_keys)!=Success))
916 row->row_under= row_under;
922 XkbcAddGeomOverlay(XkbSectionPtr section,Atom name,int sz_rows)
925 XkbOverlayPtr overlay;
927 if ((!section)||(name==None)||(sz_rows==0))
930 for (i=0,overlay=section->overlays;i<section->num_overlays;i++,overlay++) {
931 if (overlay->name==name) {
932 if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success))
937 if ((section->num_overlays>=section->sz_overlays)&&
938 (_XkbAllocOverlays(section,1)!=Success))
940 overlay= §ion->overlays[section->num_overlays];
941 if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success))
944 overlay->section_under= section;
945 section->num_overlays++;