コード例 #1
0
ファイル: XKBGAlloc.c プロジェクト: SvenDowideit/clearlinux
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;
}
コード例 #2
0
ファイル: XKBGAlloc.c プロジェクト: AmesianX/xorg-server
XkbDoodadPtr
XkbAddGeomDoodad(XkbGeometryPtr geom, XkbSectionPtr section, Atom name)
{
    XkbDoodadPtr old, doodad;
    register int i, nDoodads;

    if ((!geom) || (name == None))
        return NULL;
    if ((section != NULL) && (section->num_doodads > 0)) {
        old = section->doodads;
        nDoodads = section->num_doodads;
    }
    else {
        old = geom->doodads;
        nDoodads = geom->num_doodads;
    }
    for (i = 0, doodad = old; i < nDoodads; i++, doodad++) {
        if (doodad->any.name == name)
            return doodad;
    }
    if (section) {
        if ((section->num_doodads >= geom->sz_doodads) &&
            (_XkbAllocDoodads(section, 1) != Success)) {
            return NULL;
        }
        doodad = &section->doodads[section->num_doodads++];
    }
    else {
        if ((geom->num_doodads >= geom->sz_doodads) &&
            (_XkbAllocDoodads(geom, 1) != Success))
            return NULL;
        doodad = &geom->doodads[geom->num_doodads++];
    }
    memset(doodad, 0, sizeof(XkbDoodadRec));
    doodad->any.name = name;
    return doodad;
}
コード例 #3
0
ファイル: XKBGAlloc.c プロジェクト: AmesianX/xorg-server
Status
XkbAllocGeometry(XkbDescPtr xkb, XkbGeometrySizesPtr sizes)
{
    XkbGeometryPtr geom;
    Status rtrn;

    if (xkb->geom == NULL) {
        xkb->geom = calloc(1, sizeof(XkbGeometryRec));
        if (!xkb->geom)
            return BadAlloc;
    }
    geom = xkb->geom;
    if ((sizes->which & XkbGeomPropertiesMask) &&
        ((rtrn = _XkbAllocProps(geom, sizes->num_properties)) != Success)) {
        goto BAIL;
    }
    if ((sizes->which & XkbGeomColorsMask) &&
        ((rtrn = _XkbAllocColors(geom, sizes->num_colors)) != Success)) {
        goto BAIL;
    }
    if ((sizes->which & XkbGeomShapesMask) &&
        ((rtrn = _XkbAllocShapes(geom, sizes->num_shapes)) != Success)) {
        goto BAIL;
    }
    if ((sizes->which & XkbGeomSectionsMask) &&
        ((rtrn = _XkbAllocSections(geom, sizes->num_sections)) != Success)) {
        goto BAIL;
    }
    if ((sizes->which & XkbGeomDoodadsMask) &&
        ((rtrn = _XkbAllocDoodads(geom, sizes->num_doodads)) != Success)) {
        goto BAIL;
    }
    if ((sizes->which & XkbGeomKeyAliasesMask) &&
        ((rtrn =
          _XkbAllocKeyAliases(geom, sizes->num_key_aliases)) != Success)) {
        goto BAIL;
    }
    return Success;
 BAIL:
    XkbFreeGeometry(geom, XkbGeomAllMask, TRUE);
    xkb->geom = NULL;
    return rtrn;
}
コード例 #4
0
ファイル: XKBGAlloc.c プロジェクト: KuroyTatakai/libX11
Status
XkbAllocGeomSectionDoodads(XkbSectionPtr section,int nDoodads)
{
    return _XkbAllocDoodads(section,nDoodads);
}
コード例 #5
0
ファイル: XKBGAlloc.c プロジェクト: KuroyTatakai/libX11
Status
XkbAllocGeomDoodads(XkbGeometryPtr geom,int nDoodads)
{
    return _XkbAllocDoodads(geom,nDoodads);
}