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 struct xkb_property * prop = (struct xkb_property *)prop_in;
131 XkbcFreeGeomProperties(struct xkb_geometry * 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(struct xkb_property),
141 XkbcFreeGeomKeyAliases(struct xkb_geometry * 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(struct xkb_key_alias));
150 _XkbClearColor(char *color_in)
152 struct xkb_color * color = (struct xkb_color *)color_in;
159 XkbcFreeGeomColors(struct xkb_geometry * geom, int first, int count, Bool freeAll)
161 _XkbFreeGeomNonLeafElems(freeAll, first, count,
162 &geom->num_colors, &geom->sz_colors,
163 (char **)&geom->colors, sizeof(struct xkb_color),
168 XkbcFreeGeomPoints(struct xkb_outline * outline, int first, int count, Bool freeAll)
170 _XkbFreeGeomLeafElems(freeAll, first, count,
171 &outline->num_points, &outline->sz_points,
172 (char **)&outline->points, sizeof(struct xkb_point));
176 _XkbClearOutline(char *outline_in)
178 struct xkb_outline * outline = (struct xkb_outline *)outline_in;
181 XkbcFreeGeomPoints(outline, 0, outline->num_points, True);
185 XkbcFreeGeomOutlines(struct xkb_shape * shape, int first, int count, Bool freeAll)
187 _XkbFreeGeomNonLeafElems(freeAll, first, count,
188 &shape->num_outlines, &shape->sz_outlines,
189 (char **)&shape->outlines, sizeof(struct xkb_outline),
194 _XkbClearShape(char *shape_in)
196 struct xkb_shape * shape = (struct xkb_shape *)shape_in;
199 XkbcFreeGeomOutlines(shape, 0, shape->num_outlines, True);
203 XkbcFreeGeomShapes(struct xkb_geometry * geom, int first, int count, Bool freeAll)
205 _XkbFreeGeomNonLeafElems(freeAll, first, count,
206 &geom->num_shapes, &geom->sz_shapes,
207 (char **)&geom->shapes, sizeof(struct xkb_shape),
212 XkbcFreeGeomOverlayKeys(struct xkb_overlay_row * row, int first, int count,
215 _XkbFreeGeomLeafElems(freeAll, first, count,
216 &row->num_keys, &row->sz_keys,
217 (char **)&row->keys, sizeof(struct xkb_overlay_key));
222 _XkbClearOverlayRow(char *row_in)
224 struct xkb_overlay_row * row = (struct xkb_overlay_row *)row_in;
227 XkbcFreeGeomOverlayKeys(row, 0, row->num_keys, True);
231 XkbcFreeGeomOverlayRows(struct xkb_overlay * overlay, int first, int count,
234 _XkbFreeGeomNonLeafElems(freeAll, first, count,
235 &overlay->num_rows, &overlay->sz_rows,
236 (char **)&overlay->rows,
237 sizeof(struct xkb_overlay_row),
238 _XkbClearOverlayRow);
243 _XkbClearOverlay(char *overlay_in)
245 struct xkb_overlay * overlay = (struct xkb_overlay *)overlay_in;
248 XkbcFreeGeomOverlayRows(overlay, 0, overlay->num_rows, True);
252 XkbcFreeGeomOverlays(struct xkb_section * 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(struct xkb_overlay),
263 XkbcFreeGeomKeys(struct xkb_row * row, int first, int count, Bool freeAll)
265 _XkbFreeGeomLeafElems(freeAll, first, count,
266 &row->num_keys, &row->sz_keys,
267 (char **)&row->keys, sizeof(struct xkb_key));
272 _XkbClearRow(char *row_in)
274 struct xkb_row * row = (struct xkb_row *)row_in;
277 XkbcFreeGeomKeys(row, 0, row->num_keys, True);
281 XkbcFreeGeomRows(struct xkb_section * section, int first, int count, Bool freeAll)
283 _XkbFreeGeomNonLeafElems(freeAll, first, count,
284 §ion->num_rows, §ion->sz_rows,
285 (char **)§ion->rows, sizeof(struct xkb_row),
291 _XkbClearSection(char *section_in)
293 struct xkb_section * section = (struct xkb_section *)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(struct xkb_geometry * geom, int first, int count, Bool freeAll)
306 _XkbFreeGeomNonLeafElems(freeAll, first, count,
307 &geom->num_sections, &geom->sz_sections,
308 (char **)&geom->sections, sizeof(struct xkb_section),
314 _XkbClearDoodad(char *doodad_in)
316 union xkb_doodad * doodad = (union xkb_doodad *)doodad_in;
318 switch (doodad->any.type) {
320 if (doodad->text.text) {
321 free(doodad->text.text);
322 doodad->text.text = NULL;
324 if (doodad->text.font) {
325 free(doodad->text.font);
326 doodad->text.font = NULL;
331 if (doodad->logo.logo_name) {
332 free(doodad->logo.logo_name);
333 doodad->logo.logo_name = NULL;
340 XkbcFreeGeomDoodads(union xkb_doodad * doodads, int nDoodads, Bool freeAll)
343 union xkb_doodad * doodad;
346 for (i = 0, doodad = doodads; i < nDoodads; i++, doodad++)
347 _XkbClearDoodad((char *)doodad);
354 XkbcFreeGeometry(struct xkb_geometry * 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 free(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 *)realloc(*old, (*total) * sz_elem);
410 *old = (char *)calloc(*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(struct xkb_property))
428 #define _XkbAllocColors(g, n) _XkbGeomAlloc((char **)&(g)->colors, \
431 (n), sizeof(struct xkb_color))
432 #define _XkbAllocShapes(g, n) _XkbGeomAlloc((char **)&(g)->shapes, \
435 (n), sizeof(struct xkb_shape))
436 #define _XkbAllocSections(g, n) _XkbGeomAlloc((char **)&(g)->sections, \
437 &(g)->num_sections, \
439 (n), sizeof(struct xkb_section))
440 #define _XkbAllocDoodads(g, n) _XkbGeomAlloc((char **)&(g)->doodads, \
443 (n), sizeof(union xkb_doodad))
444 #define _XkbAllocKeyAliases(g, n) _XkbGeomAlloc((char **)&(g)->key_aliases, \
445 &(g)->num_key_aliases, \
446 &(g)->sz_key_aliases, \
447 (n), sizeof(struct xkb_key_alias))
449 #define _XkbAllocOutlines(s, n) _XkbGeomAlloc((char **)&(s)->outlines, \
450 &(s)->num_outlines, \
452 (n), sizeof(struct xkb_outline))
453 #define _XkbAllocRows(s, n) _XkbGeomAlloc((char **)&(s)->rows, \
456 (n), sizeof(struct xkb_row))
457 #define _XkbAllocPoints(o, n) _XkbGeomAlloc((char **)&(o)->points, \
460 (n), sizeof(struct xkb_point))
461 #define _XkbAllocKeys(r, n) _XkbGeomAlloc((char **)&(r)->keys, \
464 (n), sizeof(struct xkb_key))
465 #define _XkbAllocOverlays(s, n) _XkbGeomAlloc((char **)&(s)->overlays, \
466 &(s)->num_overlays, \
468 (n), sizeof(struct xkb_overlay))
469 #define _XkbAllocOverlayRows(o, n) _XkbGeomAlloc((char **)&(o)->rows, \
472 (n), sizeof(struct xkb_overlay_row))
473 #define _XkbAllocOverlayKeys(r, n) _XkbGeomAlloc((char **)&(r)->keys, \
476 (n), sizeof(struct xkb_overlay_key))
479 XkbcAllocGeomProps(struct xkb_geometry * geom, int nProps)
481 return _XkbAllocProps(geom, nProps);
485 XkbcAllocGeomColors(struct xkb_geometry * geom, int nColors)
487 return _XkbAllocColors(geom, nColors);
491 XkbcAllocGeomKeyAliases(struct xkb_geometry * geom, int nKeyAliases)
493 return _XkbAllocKeyAliases(geom, nKeyAliases);
497 XkbcAllocGeomShapes(struct xkb_geometry * geom, int nShapes)
499 return _XkbAllocShapes(geom, nShapes);
503 XkbcAllocGeomSections(struct xkb_geometry * geom, int nSections)
505 return _XkbAllocSections(geom, nSections);
509 XkbcAllocGeomOverlays(struct xkb_section * section, int nOverlays)
511 return _XkbAllocOverlays(section, nOverlays);
515 XkbcAllocGeomOverlayRows(struct xkb_overlay * overlay, int nRows)
517 return _XkbAllocOverlayRows(overlay, nRows);
521 XkbcAllocGeomOverlayKeys(struct xkb_overlay_row * row, int nKeys)
523 return _XkbAllocOverlayKeys(row, nKeys);
527 XkbcAllocGeomDoodads(struct xkb_geometry * geom, int nDoodads)
529 return _XkbAllocDoodads(geom, nDoodads);
533 XkbcAllocGeomSectionDoodads(struct xkb_section * section, int nDoodads)
535 return _XkbAllocDoodads(section, nDoodads);
539 XkbcAllocGeomOutlines(struct xkb_shape * shape, int nOL)
541 return _XkbAllocOutlines(shape, nOL);
545 XkbcAllocGeomRows(struct xkb_section * section, int nRows)
547 return _XkbAllocRows(section, nRows);
551 XkbcAllocGeomPoints(struct xkb_outline * ol, int nPts)
553 return _XkbAllocPoints(ol, nPts);
557 XkbcAllocGeomKeys(struct xkb_row * row, int nKeys)
559 int ret = _XkbAllocKeys(row, nKeys);
560 fprintf(stderr, "!!! allocated %d keys at %p\n", nKeys, row->keys);
565 XkbcAllocGeometry(struct xkb_desc * xkb, struct xkb_geometry_sizes * sizes)
567 struct xkb_geometry * geom;
571 xkb->geom = _XkbTypedCalloc(1, struct xkb_geometry);
577 if ((sizes->which & XkbGeomPropertiesMask) &&
578 ((rtrn = _XkbAllocProps(geom, sizes->num_properties)) != Success))
581 if ((sizes->which & XkbGeomColorsMask) &&
582 ((rtrn = _XkbAllocColors(geom, sizes->num_colors)) != Success))
585 if ((sizes->which & XkbGeomShapesMask) &&
586 ((rtrn = _XkbAllocShapes(geom, sizes->num_shapes)) != Success))
589 if ((sizes->which & XkbGeomSectionsMask) &&
590 ((rtrn = _XkbAllocSections(geom, sizes->num_sections)) != Success))
593 if ((sizes->which & XkbGeomDoodadsMask) &&
594 ((rtrn = _XkbAllocDoodads(geom, sizes->num_doodads)) != Success))
597 if ((sizes->which & XkbGeomKeyAliasesMask) &&
598 ((rtrn = _XkbAllocKeyAliases(geom, sizes->num_key_aliases)) != Success))
603 XkbcFreeGeometry(geom, XkbGeomAllMask, True);
608 struct xkb_property *
609 XkbcAddGeomProperty(struct xkb_geometry * geom,const char *name,const char *value)
612 register struct xkb_property * prop;
614 if ((!geom)||(!name)||(!value))
616 for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
617 if ((prop->name)&&(strcmp(name,prop->name)==0)) {
620 prop->value= (char *)malloc(strlen(value)+1);
622 strcpy(prop->value,value);
626 if ((geom->num_properties>=geom->sz_properties)&&
627 (_XkbAllocProps(geom,1)!=Success)) {
630 prop= &geom->properties[geom->num_properties];
631 prop->name= (char *)malloc(strlen(name)+1);
634 strcpy(prop->name,name);
635 prop->value= (char *)malloc(strlen(value)+1);
641 strcpy(prop->value,value);
642 geom->num_properties++;
646 struct xkb_key_alias *
647 XkbcAddGeomKeyAlias(struct xkb_geometry * geom,const char *aliasStr,const char *realStr)
650 register struct xkb_key_alias * alias;
652 if ((!geom)||(!aliasStr)||(!realStr)||(!aliasStr[0])||(!realStr[0]))
654 for (i=0,alias=geom->key_aliases;i<geom->num_key_aliases;i++,alias++) {
655 if (strncmp(alias->alias,aliasStr,XkbKeyNameLength)==0) {
656 bzero(alias->real,XkbKeyNameLength);
657 strncpy(alias->real,realStr,XkbKeyNameLength);
661 if ((geom->num_key_aliases>=geom->sz_key_aliases)&&
662 (_XkbAllocKeyAliases(geom,1)!=Success)) {
665 alias= &geom->key_aliases[geom->num_key_aliases];
666 bzero(alias,sizeof(struct xkb_key_alias));
667 strncpy(alias->alias,aliasStr,XkbKeyNameLength);
668 strncpy(alias->real,realStr,XkbKeyNameLength);
669 geom->num_key_aliases++;
674 XkbcAddGeomColor(struct xkb_geometry * geom,const char *spec,unsigned int pixel)
677 register struct xkb_color * color;
679 if ((!geom)||(!spec))
681 for (i=0,color=geom->colors;i<geom->num_colors;i++,color++) {
682 if ((color->spec)&&(strcmp(color->spec,spec)==0)) {
687 if ((geom->num_colors>=geom->sz_colors)&&
688 (_XkbAllocColors(geom,1)!=Success)) {
691 color= &geom->colors[geom->num_colors];
693 color->spec= (char *)malloc(strlen(spec)+1);
696 strcpy(color->spec,spec);
702 XkbcAddGeomOutline(struct xkb_shape * shape,int sz_points)
704 struct xkb_outline * outline;
706 if ((!shape)||(sz_points<0))
708 if ((shape->num_outlines>=shape->sz_outlines)&&
709 (_XkbAllocOutlines(shape,1)!=Success)) {
712 outline= &shape->outlines[shape->num_outlines];
713 bzero(outline,sizeof(struct xkb_outline));
714 if ((sz_points>0)&&(_XkbAllocPoints(outline,sz_points)!=Success))
716 shape->num_outlines++;
721 XkbcAddGeomShape(struct xkb_geometry * geom,uint32_t name,int sz_outlines)
723 struct xkb_shape * shape;
726 if ((!geom)||(!name)||(sz_outlines<0))
728 if (geom->num_shapes>0) {
729 for (shape=geom->shapes,i=0;i<geom->num_shapes;i++,shape++) {
730 if (name==shape->name)
734 if ((geom->num_shapes>=geom->sz_shapes)&&
735 (_XkbAllocShapes(geom,1)!=Success))
737 shape= &geom->shapes[geom->num_shapes];
738 bzero(shape,sizeof(struct xkb_shape));
739 if ((sz_outlines>0)&&(_XkbAllocOutlines(shape,sz_outlines)!=Success))
742 shape->primary= shape->approx= NULL;
748 XkbcAddGeomKey(struct xkb_row * row)
750 struct xkb_key * key;
753 if ((row->num_keys>=row->sz_keys)&&(_XkbAllocKeys(row,1)!=Success))
755 key= &row->keys[row->num_keys++];
756 bzero(key,sizeof(struct xkb_key));
761 XkbcAddGeomRow(struct xkb_section * section,int sz_keys)
763 struct xkb_row * row;
765 if ((!section)||(sz_keys<0))
767 if ((section->num_rows>=section->sz_rows)&&
768 (_XkbAllocRows(section,1)!=Success))
770 row= §ion->rows[section->num_rows];
771 bzero(row,sizeof(struct xkb_row));
772 if ((sz_keys>0)&&(_XkbAllocKeys(row,sz_keys)!=Success))
779 XkbcAddGeomSection( struct xkb_geometry * geom,
786 struct xkb_section * section;
788 if ((!geom)||(name==None)||(sz_rows<0))
790 for (i=0,section=geom->sections;i<geom->num_sections;i++,section++) {
791 if (section->name!=name)
793 if (((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success))||
794 ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success))||
795 ((sz_over>0)&&(_XkbAllocOverlays(section,sz_over)!=Success)))
799 if ((geom->num_sections>=geom->sz_sections)&&
800 (_XkbAllocSections(geom,1)!=Success))
802 section= &geom->sections[geom->num_sections];
803 if ((sz_rows>0)&&(_XkbAllocRows(section,sz_rows)!=Success))
805 if ((sz_doodads>0)&&(_XkbAllocDoodads(section,sz_doodads)!=Success)) {
809 section->sz_rows= section->num_rows= 0;
814 geom->num_sections++;
819 XkbcAddGeomDoodad(struct xkb_geometry * geom,struct xkb_section * section,uint32_t name)
821 union xkb_doodad *old, *doodad;
822 register int i,nDoodads;
824 if ((!geom)||(name==None))
826 if ((section!=NULL)&&(section->num_doodads>0)) {
827 old= section->doodads;
828 nDoodads= section->num_doodads;
832 nDoodads= geom->num_doodads;
834 for (i=0,doodad=old;i<nDoodads;i++,doodad++) {
835 if (doodad->any.name==name)
839 if ((section->num_doodads>=geom->sz_doodads)&&
840 (_XkbAllocDoodads(section,1)!=Success)) {
843 doodad= §ion->doodads[section->num_doodads++];
846 if ((geom->num_doodads>=geom->sz_doodads)&&
847 (_XkbAllocDoodads(geom,1)!=Success))
849 doodad= &geom->doodads[geom->num_doodads++];
851 bzero(doodad,sizeof(union xkb_doodad));
852 doodad->any.name= name;
856 struct xkb_overlay_key *
857 XkbcAddGeomOverlayKey( struct xkb_overlay * overlay,
858 struct xkb_overlay_row * row,
863 struct xkb_overlay_key * key;
864 struct xkb_section * section;
865 struct xkb_row * row_under;
868 if ((!overlay)||(!row)||(!over)||(!under))
870 section= overlay->section_under;
871 if (row->row_under>=section->num_rows)
873 row_under= §ion->rows[row->row_under];
874 for (i=0,found=False;i<row_under->num_keys;i++) {
875 if (strncmp(under,row_under->keys[i].name.name,XkbKeyNameLength)==0) {
882 if ((row->num_keys>=row->sz_keys)&&(_XkbAllocOverlayKeys(row,1)!=Success))
884 key= &row->keys[row->num_keys];
885 strncpy(key->under.name,under,XkbKeyNameLength);
886 strncpy(key->over.name,over,XkbKeyNameLength);
891 struct xkb_overlay_row *
892 XkbcAddGeomOverlayRow(struct xkb_overlay * overlay,int row_under,int sz_keys)
895 struct xkb_overlay_row * row;
897 if ((!overlay)||(sz_keys<0))
899 if (row_under>=overlay->section_under->num_rows)
901 for (i=0;i<overlay->num_rows;i++) {
902 if (overlay->rows[i].row_under==row_under) {
903 row= &overlay->rows[i];
904 if ((row->sz_keys<sz_keys)&&
905 (_XkbAllocOverlayKeys(row,sz_keys)!=Success)) {
908 return &overlay->rows[i];
911 if ((overlay->num_rows>=overlay->sz_rows)&&
912 (_XkbAllocOverlayRows(overlay,1)!=Success))
914 row= &overlay->rows[overlay->num_rows];
915 bzero(row,sizeof(struct xkb_overlay_row));
916 if ((sz_keys>0)&&(_XkbAllocOverlayKeys(row,sz_keys)!=Success))
918 row->row_under= row_under;
924 XkbcAddGeomOverlay(struct xkb_section * section,uint32_t name,int sz_rows)
927 struct xkb_overlay * overlay;
929 if ((!section)||(name==None)||(sz_rows==0))
932 for (i=0,overlay=section->overlays;i<section->num_overlays;i++,overlay++) {
933 if (overlay->name==name) {
934 if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success))
939 if ((section->num_overlays>=section->sz_overlays)&&
940 (_XkbAllocOverlays(section,1)!=Success))
942 overlay= §ion->overlays[section->num_overlays];
943 if ((sz_rows>0)&&(_XkbAllocOverlayRows(overlay,sz_rows)!=Success))
946 overlay->section_under= section;
947 section->num_overlays++;