diff options
author | Daniel Stone <daniel@fooishbar.org> | 2008-02-03 23:43:18 +1100 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2008-02-17 22:52:07 +0200 |
commit | 1332343910a1880854bae21a790cff198855cd24 (patch) | |
tree | 0cc6b9746171f7eea6ee5b122cebd829addfd928 /xkb | |
parent | 534fc5140b039a8c98ab715d0a6740d513b41209 (diff) |
XKB: Remove usage of client-side types
Since we're no longer sharing with Xlib, don't pass Displays and XPointers
everywhere.
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/XKBGAlloc.c | 32 | ||||
-rw-r--r-- | xkb/ddxLoad.c | 4 | ||||
-rw-r--r-- | xkb/xkbfmisc.c | 11 | ||||
-rw-r--r-- | xkb/xkbgeom.h | 20 | ||||
-rw-r--r-- | xkb/xkbout.c | 96 | ||||
-rw-r--r-- | xkb/xkbtext.c | 56 | ||||
-rw-r--r-- | xkb/xkmread.c | 51 |
7 files changed, 113 insertions, 157 deletions
diff --git a/xkb/XKBGAlloc.c b/xkb/XKBGAlloc.c index 94072b8ce..c37f49a55 100644 --- a/xkb/XKBGAlloc.c +++ b/xkb/XKBGAlloc.c @@ -455,7 +455,7 @@ XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap) /***====================================================================***/ static Status -_XkbGeomAlloc( XPointer * old, +_XkbGeomAlloc( void ** old, unsigned short * num, unsigned short * total, int num_new, @@ -471,8 +471,8 @@ _XkbGeomAlloc( XPointer * old, *total= (*num)+num_new; if ((*old)!=NULL) - (*old)= (XPointer)_XkbRealloc((*old),(*total)*sz_elem); - else (*old)= (XPointer)_XkbCalloc((*total),sz_elem); + (*old)= _XkbRealloc((*old),(*total)*sz_elem); + else (*old)= _XkbCalloc((*total),sz_elem); if ((*old)==NULL) { *total= *num= 0; return BadAlloc; @@ -485,44 +485,44 @@ _XkbGeomAlloc( XPointer * old, return Success; } -#define _XkbAllocProps(g,n) _XkbGeomAlloc((XPointer *)&(g)->properties,\ +#define _XkbAllocProps(g,n) _XkbGeomAlloc((void *)&(g)->properties,\ &(g)->num_properties,&(g)->sz_properties,\ (n),sizeof(XkbPropertyRec)) -#define _XkbAllocColors(g,n) _XkbGeomAlloc((XPointer *)&(g)->colors,\ +#define _XkbAllocColors(g,n) _XkbGeomAlloc((void *)&(g)->colors,\ &(g)->num_colors,&(g)->sz_colors,\ (n),sizeof(XkbColorRec)) -#define _XkbAllocShapes(g,n) _XkbGeomAlloc((XPointer *)&(g)->shapes,\ +#define _XkbAllocShapes(g,n) _XkbGeomAlloc((void *)&(g)->shapes,\ &(g)->num_shapes,&(g)->sz_shapes,\ (n),sizeof(XkbShapeRec)) -#define _XkbAllocSections(g,n) _XkbGeomAlloc((XPointer *)&(g)->sections,\ +#define _XkbAllocSections(g,n) _XkbGeomAlloc((void *)&(g)->sections,\ &(g)->num_sections,&(g)->sz_sections,\ (n),sizeof(XkbSectionRec)) -#define _XkbAllocDoodads(g,n) _XkbGeomAlloc((XPointer *)&(g)->doodads,\ +#define _XkbAllocDoodads(g,n) _XkbGeomAlloc((void *)&(g)->doodads,\ &(g)->num_doodads,&(g)->sz_doodads,\ (n),sizeof(XkbDoodadRec)) -#define _XkbAllocKeyAliases(g,n) _XkbGeomAlloc((XPointer *)&(g)->key_aliases,\ +#define _XkbAllocKeyAliases(g,n) _XkbGeomAlloc((void *)&(g)->key_aliases,\ &(g)->num_key_aliases,&(g)->sz_key_aliases,\ (n),sizeof(XkbKeyAliasRec)) -#define _XkbAllocOutlines(s,n) _XkbGeomAlloc((XPointer *)&(s)->outlines,\ +#define _XkbAllocOutlines(s,n) _XkbGeomAlloc((void *)&(s)->outlines,\ &(s)->num_outlines,&(s)->sz_outlines,\ (n),sizeof(XkbOutlineRec)) -#define _XkbAllocRows(s,n) _XkbGeomAlloc((XPointer *)&(s)->rows,\ +#define _XkbAllocRows(s,n) _XkbGeomAlloc((void *)&(s)->rows,\ &(s)->num_rows,&(s)->sz_rows,\ (n),sizeof(XkbRowRec)) -#define _XkbAllocPoints(o,n) _XkbGeomAlloc((XPointer *)&(o)->points,\ +#define _XkbAllocPoints(o,n) _XkbGeomAlloc((void *)&(o)->points,\ &(o)->num_points,&(o)->sz_points,\ (n),sizeof(XkbPointRec)) -#define _XkbAllocKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\ +#define _XkbAllocKeys(r,n) _XkbGeomAlloc((void *)&(r)->keys,\ &(r)->num_keys,&(r)->sz_keys,\ (n),sizeof(XkbKeyRec)) -#define _XkbAllocOverlays(s,n) _XkbGeomAlloc((XPointer *)&(s)->overlays,\ +#define _XkbAllocOverlays(s,n) _XkbGeomAlloc((void *)&(s)->overlays,\ &(s)->num_overlays,&(s)->sz_overlays,\ (n),sizeof(XkbOverlayRec)) -#define _XkbAllocOverlayRows(o,n) _XkbGeomAlloc((XPointer *)&(o)->rows,\ +#define _XkbAllocOverlayRows(o,n) _XkbGeomAlloc((void *)&(o)->rows,\ &(o)->num_rows,&(o)->sz_rows,\ (n),sizeof(XkbOverlayRowRec)) -#define _XkbAllocOverlayKeys(r,n) _XkbGeomAlloc((XPointer *)&(r)->keys,\ +#define _XkbAllocOverlayKeys(r,n) _XkbGeomAlloc((void *)&(r)->keys,\ &(r)->num_keys,&(r)->sz_keys,\ (n),sizeof(XkbOverlayKeyRec)) diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index 63122264b..60a8d443a 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -321,10 +321,10 @@ char tmpname[PATH_MAX]; #ifdef DEBUG if (xkbDebugFlags) { ErrorF("XkbDDXCompileKeymapByNames compiling keymap:\n"); - XkbWriteXKBKeymapForNames(stderr,names,NULL,xkb,want,need); + XkbWriteXKBKeymapForNames(stderr,names,xkb,want,need); } #endif - XkbWriteXKBKeymapForNames(out,names,NULL,xkb,want,need); + XkbWriteXKBKeymapForNames(out,names,xkb,want,need); #ifndef WIN32 if (Pclose(out)==0) #else diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c index 06d3519af..4182c3a34 100644 --- a/xkb/xkbfmisc.c +++ b/xkb/xkbfmisc.c @@ -160,7 +160,6 @@ _AddIncl( FILE * file, Bool XkbWriteXKBKeymapForNames( FILE * file, XkbComponentNamesPtr names, - Display * dpy, XkbDescPtr xkb, unsigned want, unsigned need) @@ -233,7 +232,7 @@ XkbFileInfo finfo; if ((xkb!=NULL) && (old_names!=NULL)) { if (wantNames&XkmTypesMask) { if (old_names->types!=None) { - tmp= XkbAtomGetString(dpy,old_names->types); + tmp= XkbAtomGetString(old_names->types); names->types= _XkbDupString(tmp); } else { @@ -243,7 +242,7 @@ XkbFileInfo finfo; } if (wantNames&XkmCompatMapMask) { if (old_names->compat!=None) { - tmp= XkbAtomGetString(dpy,old_names->compat); + tmp= XkbAtomGetString(old_names->compat); names->compat= _XkbDupString(tmp); } else wantDflts|= XkmCompatMapMask; @@ -252,13 +251,13 @@ XkbFileInfo finfo; if (wantNames&XkmSymbolsMask) { if (old_names->symbols==None) return False; - tmp= XkbAtomGetString(dpy,old_names->symbols); + tmp= XkbAtomGetString(old_names->symbols); names->symbols= _XkbDupString(tmp); complete|= XkmSymbolsMask; } if (wantNames&XkmKeyNamesMask) { if (old_names->keycodes!=None) { - tmp= XkbAtomGetString(dpy,old_names->keycodes); + tmp= XkbAtomGetString(old_names->keycodes); names->keycodes= _XkbDupString(tmp); } else wantDflts|= XkmKeyNamesMask; @@ -267,7 +266,7 @@ XkbFileInfo finfo; if (wantNames&XkmGeometryMask) { if (old_names->geometry==None) return False; - tmp= XkbAtomGetString(dpy,old_names->geometry); + tmp= XkbAtomGetString(old_names->geometry); names->geometry= _XkbDupString(tmp); complete|= XkmGeometryMask; wantNames&= ~XkmGeometryMask; diff --git a/xkb/xkbgeom.h b/xkb/xkbgeom.h index a6918b4b9..173affee9 100644 --- a/xkb/xkbgeom.h +++ b/xkb/xkbgeom.h @@ -599,13 +599,6 @@ XkbAllocGeometry( XkbGeometrySizesPtr /* sizes */ ); -extern Status -XkbSetGeometry( - Display * /* dpy */, - unsigned /* deviceSpec */, - XkbGeometryPtr /* geom */ -); - extern Bool XkbComputeShapeTop( XkbShapePtr /* shape */, @@ -637,19 +630,6 @@ XkbFindOverlayForKey( char * /* under */ ); -extern Status -XkbGetGeometry( - Display * /* dpy */, - XkbDescPtr /* xkb */ -); - -extern Status -XkbGetNamedGeometry( - Display * /* dpy */, - XkbDescPtr /* xkb */, - Atom /* name */ -); - _XFUNCPROTOEND #endif /* _XKBGEOM_H_ */ diff --git a/xkb/xkbout.c b/xkb/xkbout.c index fc4e43e3f..b72c05c60 100644 --- a/xkb/xkbout.c +++ b/xkb/xkbout.c @@ -52,7 +52,7 @@ #define VMOD_COMMENT_VALUE 2 static Bool -WriteXKBVModDecl(FILE *file,Display *dpy,XkbDescPtr xkb,int showValue) +WriteXKBVModDecl(FILE *file,XkbDescPtr xkb,int showValue) { register int i,nMods; Atom * vmodNames; @@ -67,7 +67,7 @@ Atom * vmodNames; if ((vmodNames!=NULL)&&(vmodNames[i]!=None)) { if (nMods==0) fprintf(file," virtual_modifiers "); else fprintf(file,","); - fprintf(file,"%s",XkbAtomText(dpy,vmodNames[i],XkbXKBFile)); + fprintf(file,"%s",XkbAtomText(vmodNames[i],XkbXKBFile)); if ((showValue!=VMOD_HIDE_VALUE)&& (xkb->server)&&(xkb->server->vmods[i]!=XkbNoModifierMask)) { if (showValue==VMOD_COMMENT_VALUE) { @@ -92,12 +92,7 @@ Atom * vmodNames; static Bool WriteXKBAction(FILE *file,XkbFileInfo *result,XkbAnyAction *action) { -XkbDescPtr xkb; -Display * dpy; - - xkb= result->xkb; - dpy= xkb->dpy; - fprintf(file,"%s",XkbActionText(dpy,xkb,(XkbAction *)action,XkbXKBFile)); + fprintf(file,"%s",XkbActionText(result->xkb,(XkbAction *)action,XkbXKBFile)); return True; } @@ -114,11 +109,9 @@ XkbWriteXKBKeycodes( FILE * file, Atom kcName; register unsigned i; XkbDescPtr xkb; -Display * dpy; char * alternate; xkb= result->xkb; - dpy= xkb->dpy; if ((!xkb)||(!xkb->names)||(!xkb->names->keys)) { _XkbLibError(_XkbErrMissingNames,"XkbWriteXKBKeycodes",0); return False; @@ -126,7 +119,7 @@ char * alternate; kcName= xkb->names->keycodes; if (kcName!=None) fprintf(file,"xkb_keycodes \"%s\" {\n", - XkbAtomText(dpy,kcName,XkbXKBFile)); + XkbAtomText(kcName,XkbXKBFile)); else fprintf(file,"xkb_keycodes {\n"); fprintf(file," minimum = %d;\n",xkb->min_key_code); fprintf(file," maximum = %d;\n",xkb->max_key_code); @@ -148,7 +141,7 @@ char * alternate; else type= " virtual "; if (xkb->names->indicators[i]!=None) { fprintf(file,"%sindicator %d = \"%s\";\n",type,i+1, - XkbAtomText(dpy,xkb->names->indicators[i],XkbXKBFile)); + XkbAtomText(xkb->names->indicators[i],XkbXKBFile)); } } } @@ -175,14 +168,12 @@ XkbWriteXKBKeyTypes( FILE * file, XkbFileAddOnFunc addOn, void * priv) { -Display * dpy; register unsigned i,n; XkbKeyTypePtr type; XkbKTMapEntryPtr entry; XkbDescPtr xkb; xkb= result->xkb; - dpy= xkb->dpy; if ((!xkb)||(!xkb->map)||(!xkb->map->types)) { _XkbLibError(_XkbErrMissingTypes,"XkbWriteXKBKeyTypes",0); return False; @@ -194,27 +185,27 @@ XkbDescPtr xkb; if ((xkb->names==NULL)||(xkb->names->types==None)) fprintf(file,"xkb_types {\n\n"); else fprintf(file,"xkb_types \"%s\" {\n\n", - XkbAtomText(dpy,xkb->names->types,XkbXKBFile)); - WriteXKBVModDecl(file,dpy,xkb, + XkbAtomText(xkb->names->types,XkbXKBFile)); + WriteXKBVModDecl(file,xkb, (showImplicit?VMOD_COMMENT_VALUE:VMOD_HIDE_VALUE)); type= xkb->map->types; for (i=0;i<xkb->map->num_types;i++,type++) { fprintf(file," type \"%s\" {\n", - XkbAtomText(dpy,type->name,XkbXKBFile)); + XkbAtomText(type->name,XkbXKBFile)); fprintf(file," modifiers= %s;\n", - XkbVModMaskText(dpy,xkb,type->mods.real_mods,type->mods.vmods, + XkbVModMaskText(xkb,type->mods.real_mods,type->mods.vmods, XkbXKBFile)); entry= type->map; for (n=0;n<type->map_count;n++,entry++) { char *str; - str=XkbVModMaskText(dpy,xkb,entry->mods.real_mods,entry->mods.vmods, + str=XkbVModMaskText(xkb,entry->mods.real_mods,entry->mods.vmods, XkbXKBFile); fprintf(file," map[%s]= Level%d;\n",str,entry->level+1); if ((type->preserve)&&((type->preserve[n].real_mods)|| (type->preserve[n].vmods))) { fprintf(file," preserve[%s]= ",str); - fprintf(file,"%s;\n",XkbVModMaskText(dpy,xkb, + fprintf(file,"%s;\n",XkbVModMaskText(xkb, type->preserve[n].real_mods, type->preserve[n].vmods, XkbXKBFile)); @@ -226,7 +217,7 @@ XkbDescPtr xkb; if ((*name)==None) continue; fprintf(file," level_name[Level%d]= \"%s\";\n",n+1, - XkbAtomText(dpy,*name,XkbXKBFile)); + XkbAtomText(*name,XkbXKBFile)); } } fprintf(file," };\n"); @@ -248,7 +239,7 @@ WriteXKBIndicatorMap( FILE * file, XkbDescPtr xkb; xkb= result->xkb; - fprintf(file," indicator \"%s\" {\n",XkbAtomGetString(xkb->dpy,name)); + fprintf(file," indicator \"%s\" {\n",XkbAtomGetString(name)); if (led->flags&XkbIM_NoExplicit) fprintf(file," !allowExplicit;\n"); if (led->flags&XkbIM_LEDDrivesKB) @@ -266,7 +257,7 @@ XkbDescPtr xkb; XkbIMWhichStateMaskText(led->which_mods,XkbXKBFile)); } fprintf(file," modifiers= %s;\n", - XkbVModMaskText(xkb->dpy,xkb, + XkbVModMaskText(xkb, led->mods.real_mods,led->mods.vmods, XkbXKBFile)); } @@ -288,13 +279,11 @@ XkbWriteXKBCompatMap( FILE * file, XkbFileAddOnFunc addOn, void * priv) { -Display * dpy; register unsigned i; XkbSymInterpretPtr interp; XkbDescPtr xkb; xkb= result->xkb; - dpy= xkb->dpy; if ((!xkb)||(!xkb->compat)||(!xkb->compat->sym_interpret)) { _XkbLibError(_XkbErrMissingCompatMap,"XkbWriteXKBCompatMap",0); return False; @@ -302,8 +291,8 @@ XkbDescPtr xkb; if ((xkb->names==NULL)||(xkb->names->compat==None)) fprintf(file,"xkb_compatibility {\n\n"); else fprintf(file,"xkb_compatibility \"%s\" {\n\n", - XkbAtomText(dpy,xkb->names->compat,XkbXKBFile)); - WriteXKBVModDecl(file,dpy,xkb, + XkbAtomText(xkb->names->compat,XkbXKBFile)); + WriteXKBVModDecl(file,xkb, (showImplicit?VMOD_COMMENT_VALUE:VMOD_HIDE_VALUE)); fprintf(file," interpret.useModMapMods= AnyLevel;\n"); @@ -318,7 +307,7 @@ XkbDescPtr xkb; XkbModMaskText(interp->mods,XkbXKBFile)); if (interp->virtual_mod!=XkbNoModifier) { fprintf(file," virtualModifier= %s;\n", - XkbVModIndexText(dpy,xkb,interp->virtual_mod,XkbXKBFile)); + XkbVModIndexText(xkb,interp->virtual_mod,XkbXKBFile)); } if (interp->match&XkbSI_LevelOneOnly) fprintf(file," useModMapMods=level1;\n"); @@ -337,7 +326,7 @@ XkbDescPtr xkb; gc= &xkb->compat->groups[i]; if ((gc->real_mods==0)&&(gc->vmods==0)) continue; - fprintf(file," group %d = %s;\n",i+1,XkbVModMaskText(xkb->dpy,xkb, + fprintf(file," group %d = %s;\n",i+1,XkbVModMaskText(xkb, gc->real_mods,gc->vmods, XkbXKBFile)); } @@ -367,7 +356,6 @@ XkbWriteXKBSymbols( FILE * file, XkbFileAddOnFunc addOn, void * priv) { -Display * dpy; register unsigned i,tmp; XkbDescPtr xkb; XkbClientMapPtr map; @@ -377,7 +365,6 @@ Bool showActions; xkb= result->xkb; map= xkb->map; srv= xkb->server; - dpy= xkb->dpy; if ((!xkb)||(!map)||(!map->syms)||(!map->key_sym_map)) { _XkbLibError(_XkbErrMissingSymbols,"XkbWriteXKBSymbols",0); return False; @@ -389,11 +376,11 @@ Bool showActions; if ((xkb->names==NULL)||(xkb->names->symbols==None)) fprintf(file,"xkb_symbols {\n\n"); else fprintf(file,"xkb_symbols \"%s\" {\n\n", - XkbAtomText(dpy,xkb->names->symbols,XkbXKBFile)); + XkbAtomText(xkb->names->symbols,XkbXKBFile)); for (tmp=i=0;i<XkbNumKbdGroups;i++) { if (xkb->names->groups[i]!=None) { fprintf(file," name[group%d]=\"%s\";\n",i+1, - XkbAtomText(dpy,xkb->names->groups[i],XkbXKBFile)); + XkbAtomText(xkb->names->groups[i],XkbXKBFile)); tmp++; } } @@ -429,19 +416,19 @@ Bool showActions; if (srv->explicit[i]&(1<<g)) { fprintf(file,"\n%s type[group%d]= \"%s\",", comment,g+1, - XkbAtomText(dpy,map->types[typeNdx].name, + XkbAtomText(map->types[typeNdx].name, XkbXKBFile)); } else if (showImplicit) { fprintf(file,"\n// type[group%d]= \"%s\",",g+1, - XkbAtomText(dpy,map->types[typeNdx].name, + XkbAtomText(map->types[typeNdx].name, XkbXKBFile)); } } } else { fprintf(file,"\n%s type= \"%s\",",comment, - XkbAtomText(dpy,map->types[typeNdx].name, + XkbAtomText(map->types[typeNdx].name, XkbXKBFile)); } simple= False; @@ -457,13 +444,13 @@ Bool showActions; (xkb->server->vmodmap[i]!=0)) { if ((srv->explicit[i]&XkbExplicitVModMapMask)!=0) { fprintf(file,"\n virtualMods= %s,", - XkbVModMaskText(dpy,xkb,0, + XkbVModMaskText(xkb,0, xkb->server->vmodmap[i], XkbXKBFile)); } else if (showImplicit) { fprintf(file,"\n// virtualMods= %s,", - XkbVModMaskText(dpy,xkb,0, + XkbVModMaskText(xkb,0, xkb->server->vmodmap[i], XkbXKBFile)); } @@ -603,7 +590,6 @@ char * iStr; static Bool WriteXKBDoodad( FILE * file, - Display * dpy, unsigned indent, XkbGeometryPtr geom, XkbDoodadPtr doodad) @@ -615,7 +601,7 @@ XkbColorPtr color; i_str= XkbIndentText(indent); fprintf(file,"%s%s \"%s\" {\n",i_str, XkbDoodadTypeText(doodad->any.type,XkbMessage), - XkbAtomText(dpy,doodad->any.name,XkbMessage)); + XkbAtomText(doodad->any.name,XkbMessage)); fprintf(file,"%s top= %s;\n",i_str, XkbGeomFPText(doodad->any.top,XkbXKBFile)); fprintf(file,"%s left= %s;\n",i_str, @@ -634,7 +620,7 @@ XkbColorPtr color; } shape= XkbShapeDoodadShape(geom,&doodad->shape); fprintf(file,"%s shape= \"%s\";\n",i_str, - XkbAtomText(dpy,shape->name,XkbXKBFile)); + XkbAtomText(shape->name,XkbXKBFile)); break; case XkbTextDoodad: if (doodad->text.angle!=0) { @@ -670,7 +656,7 @@ XkbColorPtr color; fprintf(file,"%s offColor= \"%s\";\n",i_str, XkbStringText(color->spec,XkbXKBFile)); fprintf(file,"%s shape= \"%s\";\n",i_str, - XkbAtomText(dpy,shape->name,XkbXKBFile)); + XkbAtomText(shape->name,XkbXKBFile)); break; case XkbLogoDoodad: fprintf(file,"%s logoName= \"%s\";\n",i_str, @@ -685,7 +671,7 @@ XkbColorPtr color; } shape= XkbLogoDoodadShape(geom,&doodad->logo); fprintf(file,"%s shape= \"%s\";\n",i_str, - XkbAtomText(dpy,shape->name,XkbXKBFile)); + XkbAtomText(shape->name,XkbXKBFile)); break; } fprintf(file,"%s};\n",i_str); @@ -695,7 +681,6 @@ XkbColorPtr color; /*ARGSUSED*/ static Bool WriteXKBOverlay( FILE * file, - Display * dpy, unsigned indent, XkbGeometryPtr geom, XkbOverlayPtr ol) @@ -708,7 +693,7 @@ XkbOverlayKeyPtr key; i_str= XkbIndentText(indent); if (ol->name!=None) { fprintf(file,"%soverlay \"%s\" {\n",i_str, - XkbAtomText(dpy,ol->name,XkbMessage)); + XkbAtomText(ol->name,XkbMessage)); } else fprintf(file,"%soverlay {\n",i_str); for (nOut=r=0,row=ol->rows;r<ol->num_rows;r++,row++) { @@ -730,7 +715,6 @@ XkbOverlayKeyPtr key; static Bool WriteXKBSection( FILE * file, - Display * dpy, XkbSectionPtr s, XkbGeometryPtr geom) { @@ -739,7 +723,7 @@ XkbRowPtr row; int dfltKeyColor = 0; fprintf(file," section \"%s\" {\n", - XkbAtomText(dpy,s->name,XkbXKBFile)); + XkbAtomText(s->name,XkbXKBFile)); if (s->rows&&(s->rows->num_keys>0)) { dfltKeyColor= s->rows->keys[0].color_ndx; fprintf(file," key.color= \"%s\";\n", @@ -788,7 +772,7 @@ int dfltKeyColor = 0; shape= XkbKeyShape(geom,key); fprintf(file,"{ %6s, \"%s\", %3s", XkbKeyNameText(key->name.name,XkbXKBFile), - XkbAtomText(dpy,shape->name,XkbXKBFile), + XkbAtomText(shape->name,XkbXKBFile), XkbGeomFPText(key->gap,XkbXKBFile)); if (key->color_ndx!=dfltKeyColor) { fprintf(file,", color=\"%s\"",XkbKeyColor(geom,key)->spec); @@ -803,17 +787,17 @@ int dfltKeyColor = 0; if (s->doodads!=NULL) { XkbDoodadPtr doodad; for (i=0,doodad=s->doodads;i<s->num_doodads;i++,doodad++) { - WriteXKBDoodad(file,dpy,8,geom,doodad); + WriteXKBDoodad(file,8,geom,doodad); } } if (s->overlays!=NULL) { XkbOverlayPtr ol; for (i=0,ol=s->overlays;i<s->num_overlays;i++,ol++) { - WriteXKBOverlay(file,dpy,8,geom,ol); + WriteXKBOverlay(file,8,geom,ol); } } fprintf(file," }; // End of \"%s\" section\n\n", - XkbAtomText(dpy,s->name,XkbXKBFile)); + XkbAtomText(s->name,XkbXKBFile)); return True; } @@ -825,7 +809,6 @@ XkbWriteXKBGeometry( FILE * file, XkbFileAddOnFunc addOn, void * priv) { -Display * dpy; register unsigned i,n; XkbDescPtr xkb; XkbGeometryPtr geom; @@ -835,12 +818,11 @@ XkbGeometryPtr geom; _XkbLibError(_XkbErrMissingGeometry,"XkbWriteXKBGeometry",0); return False; } - dpy= xkb->dpy; geom= xkb->geom; if (geom->name==None) fprintf(file,"xkb_geometry {\n\n"); else fprintf(file,"xkb_geometry \"%s\" {\n\n", - XkbAtomText(dpy,geom->name,XkbXKBFile)); + XkbAtomText(geom->name,XkbXKBFile)); fprintf(file," width= %s;\n", XkbGeomFPText(geom->width_mm,XkbXKBFile)); fprintf(file," height= %s;\n\n", @@ -889,7 +871,7 @@ XkbGeometryPtr geom; for (shape=geom->shapes,i=0;i<geom->num_shapes;i++,shape++) { lastR=0; fprintf(file," shape \"%s\" {", - XkbAtomText(dpy,shape->name,XkbXKBFile)); + XkbAtomText(shape->name,XkbXKBFile)); outline= shape->outlines; if (shape->num_outlines>1) { for (n=0;n<shape->num_outlines;n++,outline++) { @@ -909,13 +891,13 @@ XkbGeometryPtr geom; if (geom->num_sections>0) { XkbSectionPtr section; for (section=geom->sections,i=0;i<geom->num_sections;i++,section++){ - WriteXKBSection(file,dpy,section,geom); + WriteXKBSection(file,section,geom); } } if (geom->num_doodads>0) { XkbDoodadPtr doodad; for (i=0,doodad=geom->doodads;i<geom->num_doodads;i++,doodad++) { - WriteXKBDoodad(file,dpy,4,geom,doodad); + WriteXKBDoodad(file,4,geom,doodad); } } if (addOn) diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c index 1520a9f58..d08c91589 100644 --- a/xkb/xkbtext.c +++ b/xkb/xkbtext.c @@ -69,11 +69,11 @@ char *rtrn; /***====================================================================***/ char * -XkbAtomText(Display *dpy,Atom atm,unsigned format) +XkbAtomText(Atom atm,unsigned format) { char *rtrn,*tmp; - tmp= XkbAtomGetString(dpy,atm); + tmp= XkbAtomGetString(atm); if (tmp!=NULL) { int len; len= strlen(tmp)+1; @@ -101,7 +101,7 @@ char *rtrn,*tmp; /***====================================================================***/ char * -XkbVModIndexText(Display *dpy,XkbDescPtr xkb,unsigned ndx,unsigned format) +XkbVModIndexText(XkbDescPtr xkb,unsigned ndx,unsigned format) { register int len; register Atom *vmodNames; @@ -116,7 +116,7 @@ char numBuf[20]; if (ndx>=XkbNumVirtualMods) tmp= "illegal"; else if (vmodNames&&(vmodNames[ndx]!=None)) - tmp= XkbAtomGetString(dpy,vmodNames[ndx]); + tmp= XkbAtomGetString(vmodNames[ndx]); if (tmp==NULL) sprintf(tmp=numBuf,"%d",ndx); @@ -135,8 +135,7 @@ char numBuf[20]; } char * -XkbVModMaskText( Display * dpy, - XkbDescPtr xkb, +XkbVModMaskText( XkbDescPtr xkb, unsigned modMask, unsigned mask, unsigned format) @@ -163,7 +162,7 @@ char *str,buf[BUFFER_SIZE]; char *tmp; for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { if (mask&bit) { - tmp= XkbVModIndexText(dpy,xkb,i,format); + tmp= XkbVModIndexText(xkb,i,format); len= strlen(tmp)+1+(str==buf?0:1); if (format==XkbCFile) len+= 4; @@ -667,13 +666,13 @@ register int len; /*ARGSUSED*/ static Bool -CopyNoActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int*sz) +CopyNoActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int*sz) { return True; } static Bool -CopyModActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopyModActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int* sz) { XkbModAction * act; @@ -686,7 +685,7 @@ unsigned tmp; TryCopyStr(buf,"modMapMods",sz); else if (act->real_mods || tmp) { TryCopyStr(buf, - XkbVModMaskText(dpy,xkb,act->real_mods,tmp,XkbXKBFile), + XkbVModMaskText(xkb,act->real_mods,tmp,XkbXKBFile), sz); } else TryCopyStr(buf,"none",sz); @@ -701,7 +700,7 @@ unsigned tmp; /*ARGSUSED*/ static Bool -CopyGroupActionArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopyGroupActionArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbGroupAction * act; @@ -726,7 +725,7 @@ char tbuf[32]; /*ARGSUSED*/ static Bool -CopyMovePtrArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) +CopyMovePtrArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) { XkbPtrAction * act; int x,y; @@ -751,7 +750,7 @@ char tbuf[32]; /*ARGSUSED*/ static Bool -CopyPtrBtnArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) +CopyPtrBtnArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) { XkbPtrBtnAction * act; char tbuf[32]; @@ -785,7 +784,7 @@ char tbuf[32]; /*ARGSUSED*/ static Bool -CopySetPtrDfltArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopySetPtrDfltArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbPtrDfltAction * act; @@ -803,7 +802,7 @@ char tbuf[32]; } static Bool -CopyISOLockArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) +CopyISOLockArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) { XkbISOAction * act; char tbuf[64]; @@ -831,7 +830,7 @@ char tbuf[64]; TryCopyStr(buf,"+",sz); } if (tmp) - TryCopyStr(buf,XkbVModMaskText(dpy,xkb,0,tmp,XkbXKBFile),sz); + TryCopyStr(buf,XkbVModMaskText(xkb,0,tmp,XkbXKBFile),sz); } else TryCopyStr(buf,"none",sz); } @@ -865,7 +864,7 @@ char tbuf[64]; /*ARGSUSED*/ static Bool -CopySwitchScreenArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopySwitchScreenArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbSwitchScreenAction * act; @@ -884,7 +883,7 @@ char tbuf[32]; /*ARGSUSED*/ static Bool -CopySetLockControlsArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action, +CopySetLockControlsArgs(XkbDescPtr xkb,XkbAction *action, char *buf,int *sz) { XkbCtrlsAction * act; @@ -971,7 +970,7 @@ char tbuf[32]; /*ARGSUSED*/ static Bool -CopyActionMessageArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopyActionMessageArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbMessageAction * act; @@ -998,7 +997,7 @@ char tbuf[32]; } static Bool -CopyRedirectKeyArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopyRedirectKeyArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbRedirectKeyAction * act; @@ -1022,19 +1021,19 @@ unsigned vmods,vmods_mask; return True; if ((act->mods_mask==XkbAllModifiersMask)&& (vmods_mask==XkbAllVirtualModsMask)) { - tmp= XkbVModMaskText(dpy,xkb,act->mods,vmods,XkbXKBFile); + tmp= XkbVModMaskText(xkb,act->mods,vmods,XkbXKBFile); TryCopyStr(buf,",mods=",sz); TryCopyStr(buf,tmp,sz); } else { if ((act->mods_mask&act->mods)||(vmods_mask&vmods)) { - tmp= XkbVModMaskText(dpy,xkb,act->mods_mask&act->mods, + tmp= XkbVModMaskText(xkb,act->mods_mask&act->mods, vmods_mask&vmods,XkbXKBFile); TryCopyStr(buf,",mods= ",sz); TryCopyStr(buf,tmp,sz); } if ((act->mods_mask&(~act->mods))||(vmods_mask&(~vmods))) { - tmp= XkbVModMaskText(dpy,xkb,act->mods_mask&(~act->mods), + tmp= XkbVModMaskText(xkb,act->mods_mask&(~act->mods), vmods_mask&(~vmods),XkbXKBFile); TryCopyStr(buf,",clearMods= ",sz); TryCopyStr(buf,tmp,sz); @@ -1045,7 +1044,7 @@ unsigned vmods,vmods_mask; /*ARGSUSED*/ static Bool -CopyDeviceBtnArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf, +CopyDeviceBtnArgs(XkbDescPtr xkb,XkbAction *action,char *buf, int *sz) { XkbDeviceBtnAction * act; @@ -1078,7 +1077,7 @@ char tbuf[32]; /*ARGSUSED*/ static Bool -CopyOtherArgs(Display *dpy,XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) +CopyOtherArgs(XkbDescPtr xkb,XkbAction *action,char *buf,int *sz) { XkbAnyAction * act; char tbuf[32]; @@ -1096,7 +1095,6 @@ char tbuf[32]; } typedef Bool (*actionCopy)( - Display * /* dpy */, XkbDescPtr /* xkb */, XkbAction * /* action */, char * /* buf */, @@ -1128,7 +1126,7 @@ static actionCopy copyActionArgs[XkbSA_NumActions] = { #define ACTION_SZ 256 char * -XkbActionText(Display *dpy,XkbDescPtr xkb,XkbAction *action,unsigned format) +XkbActionText(XkbDescPtr xkb,XkbAction *action,unsigned format) { char buf[ACTION_SZ],*tmp; int sz; @@ -1145,8 +1143,8 @@ int sz; sprintf(buf,"%s(",XkbActionTypeText(action->type,XkbXKBFile)); sz= ACTION_SZ-strlen(buf)+2; /* room for close paren and NULL */ if (action->type<(unsigned)XkbSA_NumActions) - (*copyActionArgs[action->type])(dpy,xkb,action,buf,&sz); - else CopyOtherArgs(dpy,xkb,action,buf,&sz); + (*copyActionArgs[action->type])(xkb,action,buf,&sz); + else CopyOtherArgs(xkb,action,buf,&sz); TryCopyStr(buf,")",&sz); } tmp= tbGetBuffer(strlen(buf)+1); diff --git a/xkb/xkmread.c b/xkb/xkmread.c index 2bb02896b..1e5b2cb4e 100644 --- a/xkb/xkmread.c +++ b/xkb/xkmread.c @@ -44,7 +44,7 @@ #include "xkbgeom.h" Atom -XkbInternAtom(Display *dpy,char *str,Bool only_if_exists) +XkbInternAtom(char *str,Bool only_if_exists) { if (str==NULL) return None; @@ -66,18 +66,18 @@ char *new; /***====================================================================***/ -static XPointer -XkmInsureSize(XPointer oldPtr,int oldCount,int *newCountRtrn,int elemSize) +static void * +XkmInsureSize(void *oldPtr,int oldCount,int *newCountRtrn,int elemSize) { int newCount= *newCountRtrn; if (oldPtr==NULL) { if (newCount==0) return NULL; - oldPtr= (XPointer)_XkbCalloc(newCount,elemSize); + oldPtr= _XkbCalloc(newCount,elemSize); } else if (oldCount<newCount) { - oldPtr= (XPointer)_XkbRealloc(oldPtr,newCount*elemSize); + oldPtr= _XkbRealloc(oldPtr,newCount*elemSize); if (oldPtr!=NULL) { char *tmp= (char *)oldPtr; bzero(&tmp[oldCount*elemSize],(newCount-oldCount)*elemSize); @@ -197,7 +197,7 @@ XkbDescPtr xkb; char name[100]; if (named&bit) { if (nRead+=XkmGetCountedString(file,name,100)) { - xkb->names->vmods[i]= XkbInternAtom(xkb->dpy,name,False); + xkb->names->vmods[i]= XkbInternAtom(name,False); if (changes) changes->names.changed_vmods|= bit; } @@ -244,7 +244,7 @@ XkbDescPtr xkb; return -1; } if (name[0]!='\0') { - xkb->names->keycodes= XkbInternAtom(xkb->dpy,name,False); + xkb->names->keycodes= XkbInternAtom(name,False); } for (pN=&xkb->names->keys[minKC],i=minKC;i<=(int)maxKC;i++,pN++) { @@ -300,7 +300,7 @@ XkbDescPtr xkb; _XkbLibError(_XkbErrBadAlloc,"ReadXkmKeyTypes",0); return -1; } - xkb->names->types= XkbInternAtom(xkb->dpy,buf,False); + xkb->names->types= XkbInternAtom(buf,False); } num_types= XkmGetCARD16(file,&nRead); nRead+= XkmSkipPadding(file,2); @@ -355,7 +355,7 @@ XkbDescPtr xkb; return -1; } if (buf[0]!='\0') { - type->name= XkbInternAtom(xkb->dpy,buf,False); + type->name= XkbInternAtom(buf,False); } else type->name= None; @@ -393,7 +393,7 @@ XkbDescPtr xkb; nRead+= tmp; if (strlen(buf)==0) type->level_names[n]= None; - else type->level_names[n]= XkbInternAtom(xkb->dpy,buf,0); + else type->level_names[n]= XkbInternAtom(buf,0); } } } @@ -437,7 +437,7 @@ XkbCompatMapPtr compat; _XkbLibError(_XkbErrBadAlloc,"ReadXkmCompatMap",0); return -1; } - xkb->names->compat= XkbInternAtom(xkb->dpy,name,False); + xkb->names->compat= XkbInternAtom(name,False); } num_si= XkmGetCARD16(file,&nRead); groups= XkmGetCARD8(file,&nRead); @@ -523,7 +523,7 @@ XkbDescPtr xkb; } nRead+= tmp; if (buf[0]!='\0') - name= XkbInternAtom(xkb->dpy,buf,False); + name= XkbInternAtom(buf,False); else name= None; if ((tmp=fread(&wire,SIZEOF(xkmIndicatorMapDesc),1,file))<1) { _XkbLibError(_XkbErrBadLength,"ReadXkmIndicators",0); @@ -600,7 +600,7 @@ XkbDescPtr xkb; } if ((buf[0]!='\0')&&(xkb->names)) { Atom name; - name= XkbInternAtom(xkb->dpy,buf,0); + name= XkbInternAtom(buf,0); xkb->names->symbols= name; xkb->names->phys_symbols= name; } @@ -611,7 +611,7 @@ XkbDescPtr xkb; nRead+= tmp; if ((buf[0]!='\0')&&(xkb->names)) { Atom name; - name= XkbInternAtom(xkb->dpy,buf,0); + name= XkbInternAtom(buf,0); xkb->names->groups[i]= name; } else xkb->names->groups[i]= None; @@ -654,7 +654,7 @@ XkbDescPtr xkb; for (g=0;g<XkbNumKbdGroups;g++) { if ((wireMap.flags&(1<<g))&& ((tmp=XkmGetCountedString(file,buf,100))>0)) { - typeName[g]= XkbInternAtom(xkb->dpy,buf,1); + typeName[g]= XkbInternAtom(buf,1); nRead+= tmp; } type[g]=FindTypeForKey(xkb,typeName[g],wireMap.width,NULL); @@ -732,7 +732,6 @@ XkbDescPtr xkb; static int ReadXkmGeomDoodad( FILE * file, - Display * dpy, XkbGeometryPtr geom, XkbSectionPtr section) { @@ -745,7 +744,7 @@ int nRead=0; nRead+= XkmGetCountedString(file,buf,100); tmp= fread(&doodadWire,SIZEOF(xkmDoodadDesc),1,file); nRead+= SIZEOF(xkmDoodadDesc)*tmp; - doodad= XkbAddGeomDoodad(geom,section,XkbInternAtom(dpy,buf,False)); + doodad= XkbAddGeomDoodad(geom,section,XkbInternAtom(buf,False)); if (!doodad) return nRead; doodad->any.type= doodadWire.any.type; @@ -790,7 +789,6 @@ int nRead=0; static int ReadXkmGeomOverlay( FILE * file, - Display * dpy, XkbGeometryPtr geom, XkbSectionPtr section) { @@ -806,7 +804,7 @@ register int r; nRead+= XkmGetCountedString(file,buf,100); tmp= fread(&olWire,SIZEOF(xkmOverlayDesc),1,file); nRead+= tmp*SIZEOF(xkmOverlayDesc); - ol= XkbAddGeomOverlay(section,XkbInternAtom(dpy,buf,False), + ol= XkbAddGeomOverlay(section,XkbInternAtom(buf,False), olWire.num_rows); if (!ol) return nRead; @@ -833,7 +831,6 @@ register int r; static int ReadXkmGeomSection( FILE * file, - Display * dpy, XkbGeometryPtr geom) { register int i; @@ -845,7 +842,7 @@ char buf[100]; Atom nameAtom; nRead+= XkmGetCountedString(file,buf,100); - nameAtom= XkbInternAtom(dpy,buf,False); + nameAtom= XkbInternAtom(buf,False); tmp= fread(§ionWire,SIZEOF(xkmSectionDesc),1,file); nRead+= SIZEOF(xkmSectionDesc)*tmp; section= XkbAddGeomSection(geom,nameAtom,sectionWire.num_rows, @@ -896,7 +893,7 @@ Atom nameAtom; } if (sectionWire.num_doodads>0) { for (i=0;i<sectionWire.num_doodads;i++) { - tmp= ReadXkmGeomDoodad(file,dpy,geom,section); + tmp= ReadXkmGeomDoodad(file,geom,section); nRead+= tmp; if (tmp<1) return nRead; @@ -904,7 +901,7 @@ Atom nameAtom; } if (sectionWire.num_overlays>0) { for (i=0;i<sectionWire.num_overlays;i++) { - tmp= ReadXkmGeomOverlay(file,dpy,geom,section); + tmp= ReadXkmGeomOverlay(file,geom,section); nRead+= tmp; if (tmp<1) return nRead; @@ -939,7 +936,7 @@ XkbGeometrySizesRec sizes; return nRead; } geom= result->xkb->geom; - geom->name= XkbInternAtom(result->xkb->dpy,buf,False); + geom->name= XkbInternAtom(buf,False); geom->width_mm= wireGeom.width_mm; geom->height_mm= wireGeom.height_mm; nRead+= XkmGetCountedString(file,buf,100); @@ -975,7 +972,7 @@ XkbGeometrySizesRec sizes; XkbOutlinePtr ol; xkmOutlineDesc olWire; nRead+= XkmGetCountedString(file,buf,100); - nameAtom= XkbInternAtom(result->xkb->dpy,buf,False); + nameAtom= XkbInternAtom(buf,False); tmp= fread(&shapeWire,SIZEOF(xkmShapeDesc),1,file); nRead+= tmp*SIZEOF(xkmShapeDesc); shape= XkbAddGeomShape(geom,nameAtom,shapeWire.num_outlines); @@ -1014,7 +1011,7 @@ XkbGeometrySizesRec sizes; } if (wireGeom.num_sections>0) { for (i=0;i<wireGeom.num_sections;i++) { - tmp= ReadXkmGeomSection(file,result->xkb->dpy,geom); + tmp= ReadXkmGeomSection(file,geom); nRead+= tmp; if (tmp==0) return nRead; @@ -1022,7 +1019,7 @@ XkbGeometrySizesRec sizes; } if (wireGeom.num_doodads>0) { for (i=0;i<wireGeom.num_doodads;i++) { - tmp= ReadXkmGeomDoodad(file,result->xkb->dpy,geom,NULL); + tmp= ReadXkmGeomDoodad(file,geom,NULL); nRead+= tmp; if (tmp==0) return nRead; |