XkbSectionPtr XkbAddGeomSection(XkbGeometryPtr geom, Atom name, int sz_rows, int sz_doodads, int sz_over) { register int i; XkbSectionPtr section; if ((!geom) || (name == None) || (sz_rows < 0)) return NULL; for (i = 0, section = geom->sections; i < geom->num_sections; i++, section++) { if (section->name != name) continue; if (((sz_rows > 0) && (_XkbAllocRows(section, sz_rows) != Success)) || ((sz_doodads > 0) && (_XkbAllocDoodads(section, sz_doodads) != Success)) || ((sz_over > 0) && (_XkbAllocOverlays(section, sz_over) != Success))) return NULL; return section; } if ((geom->num_sections >= geom->sz_sections) && (_XkbAllocSections(geom, 1) != Success)) return NULL; section = &geom->sections[geom->num_sections]; if ((sz_rows > 0) && (_XkbAllocRows(section, sz_rows) != Success)) return NULL; if ((sz_doodads > 0) && (_XkbAllocDoodads(section, sz_doodads) != Success)) { if (section->rows) { _XkbFree(section->rows); section->rows = NULL; section->sz_rows = section->num_rows = 0; } return NULL; } section->name = name; geom->num_sections++; return section; }
XkbRowPtr XkbAddGeomRow(XkbSectionPtr section, int sz_keys) { XkbRowPtr row; if ((!section) || (sz_keys < 0)) return NULL; if ((section->num_rows >= section->sz_rows) && (_XkbAllocRows(section, 1) != Success)) return NULL; row = §ion->rows[section->num_rows]; memset(row, 0, sizeof(XkbRowRec)); if ((sz_keys > 0) && (_XkbAllocKeys(row, sz_keys) != Success)) return NULL; section->num_rows++; return row; }
Status XkbAllocGeomRows(XkbSectionPtr section,int nRows) { return _XkbAllocRows(section,nRows); }