diff options
author | marha <marha@users.sourceforge.net> | 2013-08-26 09:04:58 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-08-26 09:04:58 +0200 |
commit | 5ee5b91b019005aa27273dff01388a68c12be293 (patch) | |
tree | d2db8b0d1533d2eea8bfe77f8a6b3d52fa3f633e /libX11/src/xkb/XKBSetGeom.c | |
parent | 854ec4da20ddff9b830be0a7d5b81d8cb4774132 (diff) | |
download | vcxsrv-5ee5b91b019005aa27273dff01388a68c12be293.tar.gz vcxsrv-5ee5b91b019005aa27273dff01388a68c12be293.tar.bz2 vcxsrv-5ee5b91b019005aa27273dff01388a68c12be293.zip |
xserver mesa fontconfig libX11 libxcb libxcb/xcb-proto xkeyboard-config git update 26 Aug 2013
xserver commit e01a3f65d3e6d92f92ef2992b338cc9625bde082
libxcb commit c52f2891b43ae77008f63700982f800371458f4d
libxcb/xcb-proto commit bd7708ac1037e647b094fa7440ebb6171b9bc75f
xkeyboard-config commit 77026e8c59cc64856180452c5f89be86928fea7c
libX11 commit e9b14d10d0258bfcc273ff8bc84cd349dccda62c
libXdmcp commit 66514a4af7eaa47e8718434356d7efce95e570cf
libXext commit 7378d4bdbd33ed49ed6cfa5c4f73d7527982aab4
libfontenc commit 3acba630d8b57084f7e92c15732408711ed5137a
libXinerama commit 6e1d1dc328ba8162bba2f4694e7f3c706a1491ff
libXau commit 899790011304c4029e15abf410e49ce7cec17e0a
xkbcomp commit 0ebdf47fd4bc434ac3d2339544c022a869510738
pixman commit 3518a0dafa63098d41e466f73d105b7e3e4b12de
xextproto commit f27fcc99d1cf935cc289933326f7d3baacd5107a
randrproto commit ca7cc541c2e43e6c784df19b4583ac35829d2f72
glproto commit 8e3407e02980d088e20041e79bdcdd3737e7827e
mkfontscale commit f48de13423c7300f4da9f61993b624426b38ddc0
xwininfo commit ba0d1b0da21d2dbdd81098ed5778f3792b472e13
libXft commit c5e760a239afc62a1c75e0509868e35957c8df52
libXmu commit d5dac08d65c4865f311cb62c161dbb1300eecd11
libxtrans commit f6a161f2a003f4da0a2e414b4faa0ee0de0c01f0
fontconfig commit fba9efecd2ef3aca84e0a4806899c09ba95f4c19
mesa commit 7fa18774bd9d0e97a82ee9b7dfce8fc5a1041c3a
Diffstat (limited to 'libX11/src/xkb/XKBSetGeom.c')
-rw-r--r-- | libX11/src/xkb/XKBSetGeom.c | 606 |
1 files changed, 309 insertions, 297 deletions
diff --git a/libX11/src/xkb/XKBSetGeom.c b/libX11/src/xkb/XKBSetGeom.c index ab76a2063..7ac37ca61 100644 --- a/libX11/src/xkb/XKBSetGeom.c +++ b/libX11/src/xkb/XKBSetGeom.c @@ -48,28 +48,29 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define _SizeCountedString(s) ((s)?XkbPaddedSize(2+strlen(s)):4) static char * -_WriteCountedString(char *wire,char *str) +_WriteCountedString(char *wire, char *str) { -CARD16 len,*pLen; + CARD16 len, *pLen; - len= (str?strlen(str):0); - pLen= (CARD16 *)wire; - *pLen= len; + len = (str ? strlen(str) : 0); + pLen = (CARD16 *) wire; + *pLen = len; if (len && str) - memcpy(&wire[2],str,len); - wire+= XkbPaddedSize(len+2); + memcpy(&wire[2], str, len); + wire += XkbPaddedSize(len + 2); return wire; } static int _SizeGeomProperties(XkbGeometryPtr geom) { -register int i,size; -XkbPropertyPtr prop; + register int i, size; + XkbPropertyPtr prop; - for (size=i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) { - size+= _SizeCountedString(prop->name); - size+= _SizeCountedString(prop->value); + for (size = i = 0, prop = geom->properties; i < geom->num_properties; + i++, prop++) { + size += _SizeCountedString(prop->name); + size += _SizeCountedString(prop->value); } return size; } @@ -77,11 +78,11 @@ XkbPropertyPtr prop; static int _SizeGeomColors(XkbGeometryPtr geom) { -register int i,size; -register XkbColorPtr color; + register int i, size; + register XkbColorPtr color; - for (i=size=0,color=geom->colors;i<geom->num_colors;i++,color++) { - size+= _SizeCountedString(color->spec); + for (i = size = 0, color = geom->colors; i < geom->num_colors; i++, color++) { + size += _SizeCountedString(color->spec); } return size; } @@ -89,35 +90,36 @@ register XkbColorPtr color; static int _SizeGeomShapes(XkbGeometryPtr geom) { -register int i,size; -register XkbShapePtr shape; - - for (i=size=0,shape=geom->shapes;i<geom->num_shapes;i++,shape++) { - register int n; - register XkbOutlinePtr ol; - size+= SIZEOF(xkbShapeWireDesc); - for (n=0,ol=shape->outlines;n<shape->num_outlines;n++,ol++) { - size+= SIZEOF(xkbOutlineWireDesc); - size+= ol->num_points*SIZEOF(xkbPointWireDesc); - } + register int i, size; + register XkbShapePtr shape; + + for (i = size = 0, shape = geom->shapes; i < geom->num_shapes; i++, shape++) { + register int n; + register XkbOutlinePtr ol; + + size += SIZEOF(xkbShapeWireDesc); + for (n = 0, ol = shape->outlines; n < shape->num_outlines; n++, ol++) { + size += SIZEOF(xkbOutlineWireDesc); + size += ol->num_points * SIZEOF(xkbPointWireDesc); + } } return size; } static int -_SizeGeomDoodads(int num_doodads,XkbDoodadPtr doodad) +_SizeGeomDoodads(int num_doodads, XkbDoodadPtr doodad) { -register int i,size; - - for (i=size=0;i<num_doodads;i++,doodad++) { - size+= SIZEOF(xkbAnyDoodadWireDesc); - if (doodad->any.type==XkbTextDoodad) { - size+= _SizeCountedString(doodad->text.text); - size+= _SizeCountedString(doodad->text.font); - } - else if (doodad->any.type==XkbLogoDoodad) { - size+= _SizeCountedString(doodad->logo.logo_name); - } + register int i, size; + + for (i = size = 0; i < num_doodads; i++, doodad++) { + size += SIZEOF(xkbAnyDoodadWireDesc); + if (doodad->any.type == XkbTextDoodad) { + size += _SizeCountedString(doodad->text.text); + size += _SizeCountedString(doodad->text.font); + } + else if (doodad->any.type == XkbLogoDoodad) { + size += _SizeCountedString(doodad->logo.logo_name); + } } return size; } @@ -125,34 +127,39 @@ register int i,size; static int _SizeGeomSections(XkbGeometryPtr geom) { -register int i,size; -XkbSectionPtr section; - - for (i=size=0,section=geom->sections;i<geom->num_sections;i++,section++) { - size+= SIZEOF(xkbSectionWireDesc); - if (section->rows) { - int r; - XkbRowPtr row; - for (r=0,row=section->rows;r<section->num_rows;row++,r++) { - size+= SIZEOF(xkbRowWireDesc); - size+= row->num_keys*SIZEOF(xkbKeyWireDesc); - } - } - if (section->doodads) - size+= _SizeGeomDoodads(section->num_doodads,section->doodads); - if (section->overlays) { - int o; - XkbOverlayPtr ol; - for (o=0,ol=section->overlays;o<section->num_overlays;o++,ol++) { - int r; - XkbOverlayRowPtr row; - size+= SIZEOF(xkbOverlayWireDesc); - for (r=0,row=ol->rows;r<ol->num_rows;r++,row++) { - size+= SIZEOF(xkbOverlayRowWireDesc); - size+= row->num_keys*SIZEOF(xkbOverlayKeyWireDesc); - } - } - } + register int i, size; + XkbSectionPtr section; + + for (i = size = 0, section = geom->sections; i < geom->num_sections; + i++, section++) { + size += SIZEOF(xkbSectionWireDesc); + if (section->rows) { + int r; + XkbRowPtr row; + + for (r = 0, row = section->rows; r < section->num_rows; row++, r++) { + size += SIZEOF(xkbRowWireDesc); + size += row->num_keys * SIZEOF(xkbKeyWireDesc); + } + } + if (section->doodads) + size += _SizeGeomDoodads(section->num_doodads, section->doodads); + if (section->overlays) { + int o; + XkbOverlayPtr ol; + + for (o = 0, ol = section->overlays; o < section->num_overlays; + o++, ol++) { + int r; + XkbOverlayRowPtr row; + + size += SIZEOF(xkbOverlayWireDesc); + for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) { + size += SIZEOF(xkbOverlayRowWireDesc); + size += row->num_keys * SIZEOF(xkbOverlayKeyWireDesc); + } + } + } } return size; } @@ -160,224 +167,230 @@ XkbSectionPtr section; static int _SizeGeomKeyAliases(XkbGeometryPtr geom) { - return geom->num_key_aliases*(2*XkbKeyNameLength); + return geom->num_key_aliases * (2 * XkbKeyNameLength); } /***====================================================================***/ static char * -_WriteGeomProperties(char *wire,XkbGeometryPtr geom) +_WriteGeomProperties(char *wire, XkbGeometryPtr geom) { -register int i; -register XkbPropertyPtr prop; + register int i; + register XkbPropertyPtr prop; - for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) { - wire= _WriteCountedString(wire,prop->name); - wire= _WriteCountedString(wire,prop->value); + for (i = 0, prop = geom->properties; i < geom->num_properties; i++, prop++) { + wire = _WriteCountedString(wire, prop->name); + wire = _WriteCountedString(wire, prop->value); } return wire; } static char * -_WriteGeomColors(char *wire,XkbGeometryPtr geom) +_WriteGeomColors(char *wire, XkbGeometryPtr geom) { -register int i; -register XkbColorPtr color; + register int i; + register XkbColorPtr color; - for (i=0,color=geom->colors;i<geom->num_colors;i++,color++) { - wire= _WriteCountedString(wire,color->spec); + for (i = 0, color = geom->colors; i < geom->num_colors; i++, color++) { + wire = _WriteCountedString(wire, color->spec); } return wire; } static char * -_WriteGeomShapes(char *wire,XkbGeometryPtr geom) +_WriteGeomShapes(char *wire, XkbGeometryPtr geom) { -int i; -XkbShapePtr shape; -xkbShapeWireDesc * shapeWire; - - for (i=0,shape=geom->shapes;i<geom->num_shapes;i++,shape++) { - register int o; - XkbOutlinePtr ol; - xkbOutlineWireDesc * olWire; - shapeWire= (xkbShapeWireDesc *)wire; - shapeWire->name= shape->name; - shapeWire->nOutlines= shape->num_outlines; - if (shape->primary!=NULL) - shapeWire->primaryNdx= XkbOutlineIndex(shape,shape->primary); - else shapeWire->primaryNdx= XkbNoShape; - if (shape->approx!=NULL) - shapeWire->approxNdx= XkbOutlineIndex(shape,shape->approx); - else shapeWire->approxNdx= XkbNoShape; - wire= (char *)&shapeWire[1]; - for (o=0,ol=shape->outlines;o<shape->num_outlines;o++,ol++) { - register int p; - XkbPointPtr pt; - xkbPointWireDesc * ptWire; - olWire= (xkbOutlineWireDesc *)wire; - olWire->nPoints= ol->num_points; - olWire->cornerRadius= ol->corner_radius; - wire= (char *)&olWire[1]; - ptWire= (xkbPointWireDesc *)wire; - for (p=0,pt=ol->points;p<ol->num_points;p++,pt++) { - ptWire[p].x= pt->x; - ptWire[p].y= pt->y; - } - wire= (char *)&ptWire[ol->num_points]; - } + int i; + XkbShapePtr shape; + xkbShapeWireDesc *shapeWire; + + for (i = 0, shape = geom->shapes; i < geom->num_shapes; i++, shape++) { + register int o; + XkbOutlinePtr ol; + xkbOutlineWireDesc *olWire; + + shapeWire = (xkbShapeWireDesc *) wire; + shapeWire->name = shape->name; + shapeWire->nOutlines = shape->num_outlines; + if (shape->primary != NULL) + shapeWire->primaryNdx = XkbOutlineIndex(shape, shape->primary); + else + shapeWire->primaryNdx = XkbNoShape; + if (shape->approx != NULL) + shapeWire->approxNdx = XkbOutlineIndex(shape, shape->approx); + else + shapeWire->approxNdx = XkbNoShape; + wire = (char *) &shapeWire[1]; + for (o = 0, ol = shape->outlines; o < shape->num_outlines; o++, ol++) { + register int p; + XkbPointPtr pt; + xkbPointWireDesc *ptWire; + + olWire = (xkbOutlineWireDesc *) wire; + olWire->nPoints = ol->num_points; + olWire->cornerRadius = ol->corner_radius; + wire = (char *) &olWire[1]; + ptWire = (xkbPointWireDesc *) wire; + for (p = 0, pt = ol->points; p < ol->num_points; p++, pt++) { + ptWire[p].x = pt->x; + ptWire[p].y = pt->y; + } + wire = (char *) &ptWire[ol->num_points]; + } } return wire; } static char * -_WriteGeomDoodads(char *wire,int num_doodads,XkbDoodadPtr doodad) +_WriteGeomDoodads(char *wire, int num_doodads, XkbDoodadPtr doodad) { -register int i; -xkbDoodadWireDesc * doodadWire; - - for (i=0;i<num_doodads;i++,doodad++) { - doodadWire= (xkbDoodadWireDesc *)wire; - wire= (char *)&doodadWire[1]; - bzero(doodadWire,SIZEOF(xkbDoodadWireDesc)); - doodadWire->any.name= doodad->any.name; - doodadWire->any.type= doodad->any.type; - doodadWire->any.priority= doodad->any.priority; - doodadWire->any.top= doodad->any.top; - doodadWire->any.left= doodad->any.left; - doodadWire->any.angle= doodad->any.angle; - switch (doodad->any.type) { - case XkbOutlineDoodad: - case XkbSolidDoodad: - doodadWire->shape.colorNdx= doodad->shape.color_ndx; - doodadWire->shape.shapeNdx= doodad->shape.shape_ndx; - break; - case XkbTextDoodad: - doodadWire->text.width= doodad->text.width; - doodadWire->text.height= doodad->text.height; - doodadWire->text.colorNdx= doodad->text.color_ndx; - wire= _WriteCountedString(wire,doodad->text.text); - wire= _WriteCountedString(wire,doodad->text.font); - break; - case XkbIndicatorDoodad: - doodadWire->indicator.shapeNdx= doodad->indicator.shape_ndx; - doodadWire->indicator.onColorNdx=doodad->indicator.on_color_ndx; - doodadWire->indicator.offColorNdx= - doodad->indicator.off_color_ndx; - break; - case XkbLogoDoodad: - doodadWire->logo.colorNdx= doodad->logo.color_ndx; - doodadWire->logo.shapeNdx= doodad->logo.shape_ndx; - wire= _WriteCountedString(wire,doodad->logo.logo_name); - break; - default: - break; - } + register int i; + + for (i = 0; i < num_doodads; i++, doodad++) { + xkbDoodadWireDesc *doodadWire = (xkbDoodadWireDesc *) wire; + + wire = (char *) &doodadWire[1]; + bzero(doodadWire, SIZEOF(xkbDoodadWireDesc)); + doodadWire->any.name = doodad->any.name; + doodadWire->any.type = doodad->any.type; + doodadWire->any.priority = doodad->any.priority; + doodadWire->any.top = doodad->any.top; + doodadWire->any.left = doodad->any.left; + doodadWire->any.angle = doodad->any.angle; + switch (doodad->any.type) { + case XkbOutlineDoodad: + case XkbSolidDoodad: + doodadWire->shape.colorNdx = doodad->shape.color_ndx; + doodadWire->shape.shapeNdx = doodad->shape.shape_ndx; + break; + case XkbTextDoodad: + doodadWire->text.width = doodad->text.width; + doodadWire->text.height = doodad->text.height; + doodadWire->text.colorNdx = doodad->text.color_ndx; + wire = _WriteCountedString(wire, doodad->text.text); + wire = _WriteCountedString(wire, doodad->text.font); + break; + case XkbIndicatorDoodad: + doodadWire->indicator.shapeNdx = doodad->indicator.shape_ndx; + doodadWire->indicator.onColorNdx = doodad->indicator.on_color_ndx; + doodadWire->indicator.offColorNdx = doodad->indicator.off_color_ndx; + break; + case XkbLogoDoodad: + doodadWire->logo.colorNdx = doodad->logo.color_ndx; + doodadWire->logo.shapeNdx = doodad->logo.shape_ndx; + wire = _WriteCountedString(wire, doodad->logo.logo_name); + break; + default: + break; + } } return wire; } static char * -_WriteGeomOverlay(char *wire,XkbOverlayPtr ol) +_WriteGeomOverlay(char *wire, XkbOverlayPtr ol) { -register int r; -XkbOverlayRowPtr row; -xkbOverlayWireDesc * olWire; - - olWire= (xkbOverlayWireDesc *)wire; - olWire->name= ol->name; - olWire->nRows= ol->num_rows; - wire= (char *)&olWire[1]; - for (r=0,row=ol->rows;r<ol->num_rows;r++,row++) { - unsigned int k; - XkbOverlayKeyPtr key; - xkbOverlayRowWireDesc * rowWire; - rowWire= (xkbOverlayRowWireDesc *)wire; - rowWire->rowUnder= row->row_under; - rowWire->nKeys= row->num_keys; - wire= (char *)&rowWire[1]; - for (k=0,key=row->keys;k<row->num_keys;k++,key++) { - xkbOverlayKeyWireDesc * keyWire; - keyWire= (xkbOverlayKeyWireDesc *)wire; - memcpy(keyWire->over,key->over.name,XkbKeyNameLength); - memcpy(keyWire->under,key->under.name,XkbKeyNameLength); - wire= (char *)&keyWire[1]; - } - } - return wire; + register int r; + XkbOverlayRowPtr row; + xkbOverlayWireDesc *olWire = (xkbOverlayWireDesc *) wire; + + olWire->name = ol->name; + olWire->nRows = ol->num_rows; + wire = (char *) &olWire[1]; + for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) { + unsigned int k; + XkbOverlayKeyPtr key; + xkbOverlayRowWireDesc *rowWire = (xkbOverlayRowWireDesc *) wire; + + rowWire->rowUnder = row->row_under; + rowWire->nKeys = row->num_keys; + wire = (char *) &rowWire[1]; + for (k = 0, key = row->keys; k < row->num_keys; k++, key++) { + xkbOverlayKeyWireDesc *keyWire = (xkbOverlayKeyWireDesc *) wire; + + memcpy(keyWire->over, key->over.name, XkbKeyNameLength); + memcpy(keyWire->under, key->under.name, XkbKeyNameLength); + wire = (char *) &keyWire[1]; + } + } + return wire; } static char * -_WriteGeomSections(char *wire,XkbGeometryPtr geom) +_WriteGeomSections(char *wire, XkbGeometryPtr geom) { -register int i; -XkbSectionPtr section; -xkbSectionWireDesc * sectionWire; - - for (i=0,section=geom->sections;i<geom->num_sections;i++,section++) { - sectionWire= (xkbSectionWireDesc *)wire; - sectionWire->name= section->name; - sectionWire->top= section->top; - sectionWire->left= section->left; - sectionWire->width= section->width; - sectionWire->height= section->height; - sectionWire->angle= section->angle; - sectionWire->priority= section->priority; - sectionWire->nRows= section->num_rows; - sectionWire->nDoodads= section->num_doodads; - sectionWire->nOverlays= section->num_overlays; - sectionWire->pad= 0; - wire= (char *)§ionWire[1]; - if (section->rows) { - int r; - XkbRowPtr row; - xkbRowWireDesc * rowWire; - for (r=0,row=section->rows;r<section->num_rows;r++,row++) { - rowWire= (xkbRowWireDesc *)wire; - rowWire->top= row->top; - rowWire->left= row->left; - rowWire->nKeys= row->num_keys; - rowWire->vertical= row->vertical; - rowWire->pad= 0; - wire= (char *)&rowWire[1]; - if (row->keys) { - int k; - XkbKeyPtr key; - xkbKeyWireDesc * keyWire; - keyWire= (xkbKeyWireDesc *)wire; - for (k=0,key=row->keys;k<row->num_keys;k++,key++) { - memcpy(keyWire[k].name,key->name.name,XkbKeyNameLength); - keyWire[k].gap= key->gap; - keyWire[k].shapeNdx= key->shape_ndx; - keyWire[k].colorNdx= key->color_ndx; - } - wire= (char *)&keyWire[row->num_keys]; - } - } - } - if (section->doodads) { - wire= _WriteGeomDoodads(wire, - section->num_doodads,section->doodads); - } - if (section->overlays) { - register int o; - for (o=0;o<section->num_overlays;o++) { - wire= _WriteGeomOverlay(wire,§ion->overlays[o]); - } - } + register int i; + XkbSectionPtr section; + + for (i = 0, section = geom->sections; i < geom->num_sections; + i++, section++) { + xkbSectionWireDesc *sectionWire = (xkbSectionWireDesc *) wire; + + sectionWire->name = section->name; + sectionWire->top = section->top; + sectionWire->left = section->left; + sectionWire->width = section->width; + sectionWire->height = section->height; + sectionWire->angle = section->angle; + sectionWire->priority = section->priority; + sectionWire->nRows = section->num_rows; + sectionWire->nDoodads = section->num_doodads; + sectionWire->nOverlays = section->num_overlays; + sectionWire->pad = 0; + wire = (char *) §ionWire[1]; + if (section->rows) { + int r; + XkbRowPtr row; + + for (r = 0, row = section->rows; r < section->num_rows; r++, row++) { + xkbRowWireDesc *rowWire = (xkbRowWireDesc *) wire; + + rowWire->top = row->top; + rowWire->left = row->left; + rowWire->nKeys = row->num_keys; + rowWire->vertical = row->vertical; + rowWire->pad = 0; + wire = (char *) &rowWire[1]; + if (row->keys) { + int k; + XkbKeyPtr key; + xkbKeyWireDesc *keyWire = (xkbKeyWireDesc *) wire; + + for (k = 0, key = row->keys; k < row->num_keys; k++, key++) { + memcpy(keyWire[k].name, key->name.name, + XkbKeyNameLength); + keyWire[k].gap = key->gap; + keyWire[k].shapeNdx = key->shape_ndx; + keyWire[k].colorNdx = key->color_ndx; + } + wire = (char *) &keyWire[row->num_keys]; + } + } + } + if (section->doodads) { + wire = _WriteGeomDoodads(wire, + section->num_doodads, section->doodads); + } + if (section->overlays) { + register int o; + + for (o = 0; o < section->num_overlays; o++) { + wire = _WriteGeomOverlay(wire, §ion->overlays[o]); + } + } } return wire; } static char * -_WriteGeomKeyAliases(char *wire,XkbGeometryPtr geom) +_WriteGeomKeyAliases(char *wire, XkbGeometryPtr geom) { -register int sz; + register int sz; - sz= geom->num_key_aliases*(XkbKeyNameLength*2); - if (sz>0) { - memcpy(wire,(char *)geom->key_aliases,sz); - wire+= sz; + sz = geom->num_key_aliases * (XkbKeyNameLength * 2); + if (sz > 0) { + memcpy(wire, (char *) geom->key_aliases, sz); + wire += sz; } return wire; } @@ -385,46 +398,46 @@ register int sz; /***====================================================================***/ static Status -_SendSetGeometry(Display *dpy,XkbGeometryPtr geom,xkbSetGeometryReq *req) +_SendSetGeometry(Display *dpy, XkbGeometryPtr geom, xkbSetGeometryReq *req) { -int sz; -char * wire,*tbuf; - - sz= 0; - sz+= _SizeCountedString(geom->label_font); - sz+= _SizeGeomProperties(geom); - sz+= _SizeGeomColors(geom); - sz+= _SizeGeomShapes(geom); - sz+= _SizeGeomSections(geom); - sz+= _SizeGeomDoodads(geom->num_doodads,geom->doodads); - sz+= _SizeGeomKeyAliases(geom); - req->length+= (sz/4); + int sz; + char *wire, *tbuf; + + sz = 0; + sz += _SizeCountedString(geom->label_font); + sz += _SizeGeomProperties(geom); + sz += _SizeGeomColors(geom); + sz += _SizeGeomShapes(geom); + sz += _SizeGeomSections(geom); + sz += _SizeGeomDoodads(geom->num_doodads, geom->doodads); + sz += _SizeGeomKeyAliases(geom); + req->length += (sz / 4); if (sz < (dpy->bufmax - dpy->buffer)) { - BufAlloc(char *,wire,sz); - tbuf= NULL; + BufAlloc(char *, wire, sz); + tbuf = NULL; } else { - tbuf= _XAllocTemp(dpy,sz); - if (!tbuf) - return BadAlloc; - wire= tbuf; + tbuf = _XAllocTemp(dpy, sz); + if (!tbuf) + return BadAlloc; + wire = tbuf; } - wire= _WriteCountedString(wire,geom->label_font); - if (geom->num_properties>0) - wire= _WriteGeomProperties(wire,geom); - if (geom->num_colors>0) - wire= _WriteGeomColors(wire,geom); - if (geom->num_shapes>0) - wire= _WriteGeomShapes(wire,geom); - if (geom->num_sections>0) - wire= _WriteGeomSections(wire,geom); - if (geom->num_doodads>0) - wire= _WriteGeomDoodads(wire,geom->num_doodads,geom->doodads); - if (geom->num_key_aliases>0) - wire= _WriteGeomKeyAliases(wire,geom); - if (tbuf!=NULL) { - Data(dpy,tbuf,sz); - _XFreeTemp(dpy,tbuf,sz); + wire = _WriteCountedString(wire, geom->label_font); + if (geom->num_properties > 0) + wire = _WriteGeomProperties(wire, geom); + if (geom->num_colors > 0) + wire = _WriteGeomColors(wire, geom); + if (geom->num_shapes > 0) + wire = _WriteGeomShapes(wire, geom); + if (geom->num_sections > 0) + wire = _WriteGeomSections(wire, geom); + if (geom->num_doodads > 0) + wire = _WriteGeomDoodads(wire, geom->num_doodads, geom->doodads); + if (geom->num_key_aliases > 0) + wire = _WriteGeomKeyAliases(wire, geom); + if (tbuf != NULL) { + Data(dpy, tbuf, sz); + _XFreeTemp(dpy, tbuf, sz); } return Success; } @@ -432,35 +445,34 @@ char * wire,*tbuf; /***====================================================================***/ Status -XkbSetGeometry(Display *dpy,unsigned deviceSpec,XkbGeometryPtr geom) +XkbSetGeometry(Display *dpy, unsigned deviceSpec, XkbGeometryPtr geom) { -xkbSetGeometryReq *req; -Status ret; + xkbSetGeometryReq *req; + Status ret; - if ( (!geom) || (dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) - return BadAccess; + if ((!geom) || (dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; LockDisplay(dpy); GetReq(kbSetGeometry, req); req->reqType = dpy->xkb_info->codes->major_opcode; req->xkbReqType = X_kbSetGeometry; req->deviceSpec = deviceSpec; - req->nShapes= geom->num_shapes; - req->nSections= geom->num_sections; - req->name= geom->name; - req->widthMM= geom->width_mm; - req->heightMM= geom->height_mm; - req->nProperties= geom->num_properties; - req->nColors= geom->num_colors; - req->nDoodads= geom->num_doodads; - req->nKeyAliases= geom->num_key_aliases; - req->baseColorNdx= (geom->base_color-geom->colors); - req->labelColorNdx= (geom->label_color-geom->colors); - - ret = _SendSetGeometry(dpy,geom,req); + req->nShapes = geom->num_shapes; + req->nSections = geom->num_sections; + req->name = geom->name; + req->widthMM = geom->width_mm; + req->heightMM = geom->height_mm; + req->nProperties = geom->num_properties; + req->nColors = geom->num_colors; + req->nDoodads = geom->num_doodads; + req->nKeyAliases = geom->num_key_aliases; + req->baseColorNdx = (geom->base_color - geom->colors); + req->labelColorNdx = (geom->label_color - geom->colors); + + ret = _SendSetGeometry(dpy, geom, req); UnlockDisplay(dpy); SyncHandle(); return ret; } - |