Kill off usage of Display

The use of Display in xkbcomp always boiled down to passing it to
XkbInternAtom and XkbAtomGetString. This shouldn't be a problem here.
master
Dan Nicholson 2009-03-28 14:09:36 -07:00
parent 2671b777cf
commit b9335d5810
6 changed files with 178 additions and 238 deletions

View File

@ -120,7 +120,7 @@ InitCompatInfo(CompatInfo * info, XkbcDescPtr xkb)
{ {
info->dflt.interp.act.data[i] = 0; info->dflt.interp.act.data[i] = 0;
} }
ClearIndicatorMapInfo(xkb->dpy, &info->ledDflt); ClearIndicatorMapInfo(&info->ledDflt);
info->ledDflt.defs.fileID = info->fileID; info->ledDflt.defs.fileID = info->fileID;
info->ledDflt.defs.defined = 0; info->ledDflt.defs.defined = 0;
info->ledDflt.defs.merge = MergeOverride; info->ledDflt.defs.merge = MergeOverride;
@ -148,7 +148,7 @@ ClearCompatInfo(CompatInfo * info, XkbcDescPtr xkb)
{ {
info->dflt.interp.act.data[i] = 0; info->dflt.interp.act.data[i] = 0;
} }
ClearIndicatorMapInfo(xkb->dpy, &info->ledDflt); ClearIndicatorMapInfo(&info->ledDflt);
info->nInterps = 0; info->nInterps = 0;
info->interps = (SymInterpInfo *) ClearCommonInfo(&info->interps->defs); info->interps = (SymInterpInfo *) ClearCommonInfo(&info->interps->defs);
bzero((char *) &info->groupCompat[0], bzero((char *) &info->groupCompat[0],

View File

@ -67,7 +67,7 @@ typedef struct _ShapeInfo
int dfltCornerRadius; int dfltCornerRadius;
} ShapeInfo; } ShapeInfo;
#define shText(d, s) \ #define shText(s) \
((s) ? XkbcAtomText((s)->name) : "default shape") ((s) ? XkbcAtomText((s)->name) : "default shape")
#define _GD_Priority (1<<0) #define _GD_Priority (1<<0)
@ -158,7 +158,7 @@ typedef struct _RowInfo
KeyInfo dfltKey; KeyInfo dfltKey;
struct _SectionInfo *section; struct _SectionInfo *section;
} RowInfo; } RowInfo;
#define rowText(d, r) \ #define rowText(r) \
((r) ? XkbcAtomText((r)->section->name) : "default") ((r) ? XkbcAtomText((r)->section->name) : "default")
#define _GOK_UnknownRow -1 #define _GOK_UnknownRow -1
@ -179,7 +179,7 @@ typedef struct _OverlayInfo
unsigned short nKeys; unsigned short nKeys;
OverlayKeyInfo *keys; OverlayKeyInfo *keys;
} OverlayInfo; } OverlayInfo;
#define oiText(d, o) \ #define oiText(o) \
((o) ? XkbcAtomText((o)->name) : "default") ((o) ? XkbcAtomText((o)->name) : "default")
@ -212,13 +212,12 @@ typedef struct _SectionInfo
OverlayInfo *overlays; OverlayInfo *overlays;
struct _GeometryInfo *geometry; struct _GeometryInfo *geometry;
} SectionInfo; } SectionInfo;
#define scText(d, s) \ #define scText(s) \
((s) ? XkbcAtomText((s)->name) : "default") ((s) ? XkbcAtomText((s)->name) : "default")
typedef struct _GeometryInfo typedef struct _GeometryInfo
{ {
char *name; char *name;
Display *dpy;
unsigned fileID; unsigned fileID;
unsigned merge; unsigned merge;
int errorCount; int errorCount;
@ -250,7 +249,7 @@ typedef struct _GeometryInfo
} GeometryInfo; } GeometryInfo;
static char * static char *
ddText(Display * dpy, DoodadInfo * di) ddText(DoodadInfo * di)
{ {
static char buf[64]; static char buf[64];
@ -262,7 +261,7 @@ ddText(Display * dpy, DoodadInfo * di)
if (di->section) if (di->section)
{ {
sprintf(buf, "%s in section %s", sprintf(buf, "%s in section %s",
XkbcAtomText(di->name), scText(dpy, di->section)); XkbcAtomText(di->name), scText(di->section));
return buf; return buf;
} }
return XkbcAtomText(di->name); return XkbcAtomText(di->name);
@ -810,8 +809,7 @@ FindShape(GeometryInfo * info, Atom name, const char *type, const char *which)
XkbcAtomText(name), type, which); XkbcAtomText(name), type, which);
if (old) if (old)
{ {
ACTION1("Using default shape %s instead\n", ACTION1("Using default shape %s instead\n", shText(old));
shText(info->dpy, old));
return old; return old;
} }
ACTION("No default shape; definition ignored\n"); ACTION("No default shape; definition ignored\n");
@ -835,8 +833,7 @@ AddShape(GeometryInfo * info, ShapeInfo * new)
if (((old->defs.fileID == new->defs.fileID) if (((old->defs.fileID == new->defs.fileID)
&& (warningLevel > 0)) || (warningLevel > 9)) && (warningLevel > 0)) || (warningLevel > 9))
{ {
WARN1("Duplicate shape name \"%s\"\n", WARN1("Duplicate shape name \"%s\"\n", shText(old));
shText(info->dpy, old));
ACTION("Using last definition\n"); ACTION("Using last definition\n");
} }
*old = *new; *old = *new;
@ -846,7 +843,7 @@ AddShape(GeometryInfo * info, ShapeInfo * new)
if (((old->defs.fileID == new->defs.fileID) && (warningLevel > 0)) if (((old->defs.fileID == new->defs.fileID) && (warningLevel > 0))
|| (warningLevel > 9)) || (warningLevel > 9))
{ {
WARN1("Multiple shapes named \"%s\"\n", shText(info->dpy, old)); WARN1("Multiple shapes named \"%s\"\n", shText(old));
ACTION("Using first definition\n"); ACTION("Using first definition\n");
} }
return True; return True;
@ -1121,8 +1118,7 @@ AddSection(GeometryInfo * info, SectionInfo * new)
if (((old->defs.fileID == new->defs.fileID) if (((old->defs.fileID == new->defs.fileID)
&& (warningLevel > 0)) || (warningLevel > 9)) && (warningLevel > 0)) || (warningLevel > 9))
{ {
WARN1("Duplicate shape name \"%s\"\n", WARN1("Duplicate shape name \"%s\"\n", shText(old));
shText(info->dpy, old));
ACTION("Using last definition\n"); ACTION("Using last definition\n");
} }
*old = *new; *old = *new;
@ -1132,7 +1128,7 @@ AddSection(GeometryInfo * info, SectionInfo * new)
if (((old->defs.fileID == new->defs.fileID) && (warningLevel > 0)) if (((old->defs.fileID == new->defs.fileID) && (warningLevel > 0))
|| (warningLevel > 9)) || (warningLevel > 9))
{ {
WARN1("Multiple shapes named \"%s\"\n", shText(info->dpy, old)); WARN1("Multiple shapes named \"%s\"\n", shText(old));
ACTION("Using first definition\n"); ACTION("Using first definition\n");
} }
return True; return True;
@ -1419,13 +1415,12 @@ SetShapeField(ShapeInfo * si,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray("key shape", field, shText(info->dpy, si)); return ReportNotArray("key shape", field, shText(si));
} }
if (!ExprResolveFloat(value, &tmp, NULL, NULL)) if (!ExprResolveFloat(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType("key shape", field, return ReportBadType("key shape", field, shText(si), "number");
shText(info->dpy, si), "number");
} }
if (si) if (si)
si->dfltCornerRadius = tmp.ival; si->dfltCornerRadius = tmp.ival;
@ -1434,7 +1429,7 @@ SetShapeField(ShapeInfo * si,
return True; return True;
} }
info->errorCount++; info->errorCount++;
return ReportBadField("key shape", field, shText(info->dpy, si)); return ReportBadField("key shape", field, shText(si));
} }
static int static int
@ -1454,13 +1449,12 @@ SetShapeDoodadField(DoodadInfo * di,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray(typeName, field, ddText(info->dpy, di)); return ReportNotArray(typeName, field, ddText(di));
} }
if (!ExprResolveFloat(value, &tmp, NULL, NULL)) if (!ExprResolveFloat(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType(typeName, field, ddText(info->dpy, di), return ReportBadType(typeName, field, ddText(di), "number");
"number");
} }
di->defs.defined |= _GD_Corner; di->defs.defined |= _GD_Corner;
di->corner = tmp.ival; di->corner = tmp.ival;
@ -1471,13 +1465,12 @@ SetShapeDoodadField(DoodadInfo * di,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray(typeName, field, ddText(info->dpy, di)); return ReportNotArray(typeName, field, ddText(di));
} }
if (!ExprResolveFloat(value, &tmp, NULL, NULL)) if (!ExprResolveFloat(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType(typeName, field, ddText(info->dpy, di), return ReportBadType(typeName, field, ddText(di), "number");
"number");
} }
di->defs.defined |= _GD_Angle; di->defs.defined |= _GD_Angle;
di->angle = tmp.ival; di->angle = tmp.ival;
@ -1488,19 +1481,18 @@ SetShapeDoodadField(DoodadInfo * di,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray(typeName, field, ddText(info->dpy, di)); return ReportNotArray(typeName, field, ddText(di));
} }
if (!ExprResolveString(value, &tmp, NULL, NULL)) if (!ExprResolveString(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType(typeName, field, ddText(info->dpy, di), return ReportBadType(typeName, field, ddText(di), "string");
"string");
} }
di->shape = XkbcInternAtom(tmp.str, False); di->shape = XkbcInternAtom(tmp.str, False);
di->defs.defined |= _GD_Shape; di->defs.defined |= _GD_Shape;
return True; return True;
} }
return ReportBadField(typeName, field, ddText(info->dpy, di)); return ReportBadField(typeName, field, ddText(di));
} }
#define FIELD_STRING 0 #define FIELD_STRING 0
@ -1529,13 +1521,12 @@ SetTextDoodadField(DoodadInfo * di,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray(typeName, field, ddText(info->dpy, di)); return ReportNotArray(typeName, field, ddText(di));
} }
if (!ExprResolveFloat(value, &tmp, NULL, NULL)) if (!ExprResolveFloat(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType(typeName, field, ddText(info->dpy, di), return ReportBadType(typeName, field, ddText(di), "number");
"number");
} }
di->defs.defined |= _GD_Angle; di->defs.defined |= _GD_Angle;
di->angle = tmp.ival; di->angle = tmp.ival;
@ -1615,20 +1606,19 @@ SetTextDoodadField(DoodadInfo * di,
} }
else else
{ {
return ReportBadField(typeName, field, ddText(info->dpy, di)); return ReportBadField(typeName, field, ddText(di));
} }
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray(typeName, field, ddText(info->dpy, di)); return ReportNotArray(typeName, field, ddText(di));
} }
if (type == FIELD_STRING) if (type == FIELD_STRING)
{ {
if (!ExprResolveString(value, &tmp, NULL, NULL)) if (!ExprResolveString(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType(typeName, field, ddText(info->dpy, di), return ReportBadType(typeName, field, ddText(di), "string");
"string");
} }
di->defs.defined |= def; di->defs.defined |= def;
*pField.str = XkbcInternAtom(tmp.str, False); *pField.str = XkbcInternAtom(tmp.str, False);
@ -1638,15 +1628,13 @@ SetTextDoodadField(DoodadInfo * di,
if (!ExprResolveFloat(value, &tmp, NULL, NULL)) if (!ExprResolveFloat(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType(typeName, field, ddText(info->dpy, di), return ReportBadType(typeName, field, ddText(di), "number");
"number");
} }
if ((type == FIELD_USHORT) && (tmp.ival < 0)) if ((type == FIELD_USHORT) && (tmp.ival < 0))
{ {
info->errorCount++; info->errorCount++;
return return
ReportBadType(typeName, field, ddText(info->dpy, di), ReportBadType(typeName, field, ddText(di), "unsigned");
"unsigned");
} }
di->defs.defined |= def; di->defs.defined |= def;
if (type == FIELD_USHORT) if (type == FIELD_USHORT)
@ -1673,14 +1661,13 @@ SetIndicatorDoodadField(DoodadInfo * di,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray("indicator doodad", field, return ReportNotArray("indicator doodad", field, ddText(di));
ddText(info->dpy, di));
} }
if (!ExprResolveString(value, &tmp, NULL, NULL)) if (!ExprResolveString(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType("indicator doodad", field, return ReportBadType("indicator doodad", field,
ddText(info->dpy, di), "string"); ddText(di), "string");
} }
if (uStrCaseCmp(field, "oncolor") == 0) if (uStrCaseCmp(field, "oncolor") == 0)
{ {
@ -1699,7 +1686,7 @@ SetIndicatorDoodadField(DoodadInfo * di,
} }
return True; return True;
} }
return ReportBadField("indicator doodad", field, ddText(info->dpy, di)); return ReportBadField("indicator doodad", field, ddText(di));
} }
static int static int
@ -1717,13 +1704,12 @@ SetLogoDoodadField(DoodadInfo * di,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray(typeName, field, ddText(info->dpy, di)); return ReportNotArray(typeName, field, ddText(di));
} }
if (!ExprResolveFloat(value, &tmp, NULL, NULL)) if (!ExprResolveFloat(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType(typeName, field, ddText(info->dpy, di), return ReportBadType(typeName, field, ddText(di), "number");
"number");
} }
di->defs.defined |= _GD_Corner; di->defs.defined |= _GD_Corner;
di->corner = tmp.ival; di->corner = tmp.ival;
@ -1734,13 +1720,12 @@ SetLogoDoodadField(DoodadInfo * di,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray(typeName, field, ddText(info->dpy, di)); return ReportNotArray(typeName, field, ddText(di));
} }
if (!ExprResolveFloat(value, &tmp, NULL, NULL)) if (!ExprResolveFloat(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType(typeName, field, ddText(info->dpy, di), return ReportBadType(typeName, field, ddText(di), "number");
"number");
} }
di->defs.defined |= _GD_Angle; di->defs.defined |= _GD_Angle;
di->angle = tmp.ival; di->angle = tmp.ival;
@ -1751,13 +1736,12 @@ SetLogoDoodadField(DoodadInfo * di,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray(typeName, field, ddText(info->dpy, di)); return ReportNotArray(typeName, field, ddText(di));
} }
if (!ExprResolveString(value, &tmp, NULL, NULL)) if (!ExprResolveString(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType(typeName, field, ddText(info->dpy, di), return ReportBadType(typeName, field, ddText(di), "string");
"string");
} }
di->shape = XkbcInternAtom(tmp.str, False); di->shape = XkbcInternAtom(tmp.str, False);
di->defs.defined |= _GD_Shape; di->defs.defined |= _GD_Shape;
@ -1769,18 +1753,18 @@ SetLogoDoodadField(DoodadInfo * di,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray(typeName, field, ddText(info->dpy, di)); return ReportNotArray(typeName, field, ddText(di));
} }
if (!ExprResolveString(value, &tmp, NULL, NULL)) if (!ExprResolveString(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType(typeName, field, ddText(info->dpy, di), return ReportBadType(typeName, field, ddText(di),
"string"); "string");
} }
di->logoName = uStringDup(tmp.str); di->logoName = uStringDup(tmp.str);
return True; return True;
} }
return ReportBadField(typeName, field, ddText(info->dpy, di)); return ReportBadField(typeName, field, ddText(di));
} }
static int static int
@ -1796,21 +1780,19 @@ SetDoodadField(DoodadInfo * di,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray("doodad", field, ddText(info->dpy, di)); return ReportNotArray("doodad", field, ddText(di));
} }
if (!ExprResolveInteger(value, &tmp, NULL, NULL)) if (!ExprResolveInteger(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType("doodad", field, ddText(info->dpy, di), return ReportBadType("doodad", field, ddText(di), "integer");
"integer");
} }
if ((tmp.ival < 0) || (tmp.ival > XkbGeomMaxPriority)) if ((tmp.ival < 0) || (tmp.ival > XkbGeomMaxPriority))
{ {
info->errorCount++; info->errorCount++;
ERROR2("Doodad priority %d out of range (must be 0..%d)\n", ERROR2("Doodad priority %d out of range (must be 0..%d)\n",
tmp.ival, XkbGeomMaxPriority); tmp.ival, XkbGeomMaxPriority);
ACTION1("Priority for doodad %s not changed", ACTION1("Priority for doodad %s not changed", ddText(di));
ddText(info->dpy, di));
return False; return False;
} }
di->defs.defined |= _GD_Priority; di->defs.defined |= _GD_Priority;
@ -1822,13 +1804,12 @@ SetDoodadField(DoodadInfo * di,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray("doodad", field, ddText(info->dpy, di)); return ReportNotArray("doodad", field, ddText(di));
} }
if (!ExprResolveFloat(value, &tmp, NULL, NULL)) if (!ExprResolveFloat(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType("doodad", field, ddText(info->dpy, di), return ReportBadType("doodad", field, ddText(di), "number");
"number");
} }
di->defs.defined |= _GD_Left; di->defs.defined |= _GD_Left;
di->left = tmp.ival; di->left = tmp.ival;
@ -1839,13 +1820,12 @@ SetDoodadField(DoodadInfo * di,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray("doodad", field, ddText(info->dpy, di)); return ReportNotArray("doodad", field, ddText(di));
} }
if (!ExprResolveFloat(value, &tmp, NULL, NULL)) if (!ExprResolveFloat(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType("doodad", field, ddText(info->dpy, di), return ReportBadType("doodad", field, ddText(di), "number");
"number");
} }
di->defs.defined |= _GD_Top; di->defs.defined |= _GD_Top;
di->top = tmp.ival; di->top = tmp.ival;
@ -1856,13 +1836,12 @@ SetDoodadField(DoodadInfo * di,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray("doodad", field, ddText(info->dpy, di)); return ReportNotArray("doodad", field, ddText(di));
} }
if (!ExprResolveString(value, &tmp, NULL, NULL)) if (!ExprResolveString(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType("doodad", field, ddText(info->dpy, di), return ReportBadType("doodad", field, ddText(di), "string");
"string");
} }
di->defs.defined |= _GD_Color; di->defs.defined |= _GD_Color;
di->color = XkbcInternAtom(tmp.str, False); di->color = XkbcInternAtom(tmp.str, False);
@ -1882,7 +1861,7 @@ SetDoodadField(DoodadInfo * di,
} }
WSGO1("Unknown doodad type %d in SetDoodadField\n", WSGO1("Unknown doodad type %d in SetDoodadField\n",
(unsigned int) di->type); (unsigned int) di->type);
ACTION2("Definition of %s in %s ignored\n", field, ddText(info->dpy, di)); ACTION2("Definition of %s in %s ignored\n", field, ddText(di));
return False; return False;
} }
@ -1902,14 +1881,12 @@ SetSectionField(SectionInfo * si,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray("keyboard section", field, return ReportNotArray("keyboard section", field, scText(si));
scText(info->dpy, si));
} }
if (!ExprResolveInteger(value, &tmp, NULL, NULL)) if (!ExprResolveInteger(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
ReportBadType("keyboard section", field, ReportBadType("keyboard section", field, scText(si), "integer");
scText(info->dpy, si), "integer");
return False; return False;
} }
if ((tmp.ival < 0) || (tmp.ival > XkbGeomMaxPriority)) if ((tmp.ival < 0) || (tmp.ival > XkbGeomMaxPriority))
@ -1917,8 +1894,7 @@ SetSectionField(SectionInfo * si,
info->errorCount++; info->errorCount++;
ERROR2("Section priority %d out of range (must be 0..%d)\n", ERROR2("Section priority %d out of range (must be 0..%d)\n",
tmp.ival, XkbGeomMaxPriority); tmp.ival, XkbGeomMaxPriority);
ACTION1("Priority for section %s not changed", ACTION1("Priority for section %s not changed", scText(si));
scText(info->dpy, si));
return False; return False;
} }
si->priority = tmp.ival; si->priority = tmp.ival;
@ -1953,20 +1929,17 @@ SetSectionField(SectionInfo * si,
else else
{ {
info->errorCount++; info->errorCount++;
return ReportBadField("keyboard section", field, return ReportBadField("keyboard section", field, scText(si));
scText(info->dpy, si));
} }
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray("keyboard section", field, return ReportNotArray("keyboard section", field, scText(si));
scText(info->dpy, si));
} }
if (!ExprResolveFloat(value, &tmp, NULL, NULL)) if (!ExprResolveFloat(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
ReportBadType("keyboard section", field, scText(info->dpy, si), ReportBadType("keyboard section", field, scText(si), "number");
"number");
return False; return False;
} }
si->defs.defined |= def; si->defs.defined |= def;
@ -1986,14 +1959,13 @@ SetRowField(RowInfo * row,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray("keyboard row", field, return ReportNotArray("keyboard row", field, rowText(row));
rowText(info->dpy, row));
} }
if (!ExprResolveFloat(value, &tmp, NULL, NULL)) if (!ExprResolveFloat(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType("keyboard row", field, return ReportBadType("keyboard row", field, rowText(row),
rowText(info->dpy, row), "number"); "number");
} }
row->defs.defined |= _GR_Top; row->defs.defined |= _GR_Top;
row->top = tmp.uval; row->top = tmp.uval;
@ -2003,14 +1975,13 @@ SetRowField(RowInfo * row,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray("keyboard row", field, return ReportNotArray("keyboard row", field, rowText(row));
rowText(info->dpy, row));
} }
if (!ExprResolveFloat(value, &tmp, NULL, NULL)) if (!ExprResolveFloat(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType("keyboard row", field, return ReportBadType("keyboard row", field, rowText(row),
rowText(info->dpy, row), "number"); "number");
} }
row->defs.defined |= _GR_Left; row->defs.defined |= _GR_Left;
row->left = tmp.uval; row->left = tmp.uval;
@ -2020,14 +1991,13 @@ SetRowField(RowInfo * row,
if (arrayNdx != NULL) if (arrayNdx != NULL)
{ {
info->errorCount++; info->errorCount++;
return ReportNotArray("keyboard row", field, return ReportNotArray("keyboard row", field, rowText(row));
rowText(info->dpy, row));
} }
if (!ExprResolveBoolean(value, &tmp, NULL, NULL)) if (!ExprResolveBoolean(value, &tmp, NULL, NULL))
{ {
info->errorCount++; info->errorCount++;
return ReportBadType("keyboard row", field, return ReportBadType("keyboard row", field, rowText(row),
rowText(info->dpy, row), "boolean"); "boolean");
} }
row->defs.defined |= _GR_Vertical; row->defs.defined |= _GR_Vertical;
row->vertical = tmp.uval; row->vertical = tmp.uval;
@ -2035,7 +2005,7 @@ SetRowField(RowInfo * row,
else else
{ {
info->errorCount++; info->errorCount++;
return ReportBadField("keyboard row", field, rowText(info->dpy, row)); return ReportBadField("keyboard row", field, rowText(row));
} }
return True; return True;
} }
@ -2395,7 +2365,7 @@ HandleShapeBody(ShapeDef * def, ShapeInfo * si, unsigned merge,
if (def->nOutlines < 1) if (def->nOutlines < 1)
{ {
WARN1("Shape \"%s\" has no outlines\n", shText(info->dpy, si)); WARN1("Shape \"%s\" has no outlines\n", shText(si));
ACTION("Definition ignored\n"); ACTION("Definition ignored\n");
return True; return True;
} }
@ -2403,8 +2373,7 @@ HandleShapeBody(ShapeDef * def, ShapeInfo * si, unsigned merge,
si->outlines = uTypedCalloc(def->nOutlines, XkbOutlineRec); si->outlines = uTypedCalloc(def->nOutlines, XkbOutlineRec);
if (!si->outlines) if (!si->outlines)
{ {
ERROR1("Couldn't allocate outlines for \"%s\"\n", ERROR1("Couldn't allocate outlines for \"%s\"\n", shText(si));
shText(info->dpy, si));
ACTION("Definition ignored\n"); ACTION("Definition ignored\n");
info->errorCount++; info->errorCount++;
return False; return False;
@ -2425,8 +2394,7 @@ HandleShapeBody(ShapeDef * def, ShapeInfo * si, unsigned merge,
outline->points = uTypedCalloc(ol->nPoints, XkbPointRec); outline->points = uTypedCalloc(ol->nPoints, XkbPointRec);
if (!outline->points) if (!outline->points)
{ {
ERROR1("Can't allocate points for \"%s\"\n", ERROR1("Can't allocate points for \"%s\"\n", shText(si));
shText(info->dpy, si));
ACTION("Definition ignored\n"); ACTION("Definition ignored\n");
info->errorCount++; info->errorCount++;
return False; return False;
@ -2449,7 +2417,7 @@ HandleShapeBody(ShapeDef * def, ShapeInfo * si, unsigned merge,
else else
{ {
WARN1("Multiple approximations for \"%s\"\n", WARN1("Multiple approximations for \"%s\"\n",
shText(info->dpy, si)); shText(si));
ACTION("Treating all but the first as normal outlines\n"); ACTION("Treating all but the first as normal outlines\n");
} }
} }
@ -2460,14 +2428,14 @@ HandleShapeBody(ShapeDef * def, ShapeInfo * si, unsigned merge,
else else
{ {
WARN1("Multiple primary outlines for \"%s\"\n", WARN1("Multiple primary outlines for \"%s\"\n",
shText(info->dpy, si)); shText(si));
ACTION("Treating all but the first as normal outlines\n"); ACTION("Treating all but the first as normal outlines\n");
} }
} }
else else
{ {
WARN2("Unknown outline type %s for \"%s\"\n", str, WARN2("Unknown outline type %s for \"%s\"\n", str,
shText(info->dpy, si)); shText(si));
ACTION("Treated as a normal outline\n"); ACTION("Treated as a normal outline\n");
} }
} }
@ -2493,7 +2461,7 @@ HandleShapeDef(ShapeDef * def, XkbcDescPtr xkb, unsigned merge,
bzero(&si, sizeof(ShapeInfo)); bzero(&si, sizeof(ShapeInfo));
si.defs.merge = merge; si.defs.merge = merge;
si.name = si.name =
XkbcInternAtom(info->dpy, XkbcAtomGetString(def->name), False); XkbcInternAtom(XkbcAtomGetString(def->name), False);
si.dfltCornerRadius = info->dfltCornerRadius; si.dfltCornerRadius = info->dfltCornerRadius;
if (!HandleShapeBody(def, &si, merge, info)) if (!HandleShapeBody(def, &si, merge, info))
return False; return False;
@ -2520,7 +2488,7 @@ HandleDoodadDef(DoodadDef * def,
} }
InitDoodadInfo(&new, def->type, si, info); InitDoodadInfo(&new, def->type, si, info);
new.name = new.name =
XkbcInternAtom(info->dpy, XkbcAtomGetString(def->name), False); XkbcInternAtom(XkbcAtomGetString(def->name), False);
for (var = def->body; var != NULL; var = (VarDef *) var->common.next) for (var = def->body; var != NULL; var = (VarDef *) var->common.next)
{ {
if (ExprResolveLhs(var->name, &elem, &field, &ndx) == 0) if (ExprResolveLhs(var->name, &elem, &field, &ndx) == 0)
@ -2528,7 +2496,7 @@ HandleDoodadDef(DoodadDef * def,
if (elem.str != NULL) if (elem.str != NULL)
{ {
WARN1("Assignment to field of unknown element in doodad %s\n", WARN1("Assignment to field of unknown element in doodad %s\n",
ddText(info->dpy, &new)); ddText(&new));
ACTION2("No value assigned to %s.%s\n", elem.str, field.str); ACTION2("No value assigned to %s.%s\n", elem.str, field.str);
} }
else if (!SetDoodadField(&new, field.str, ndx, var->value, si, info)) else if (!SetDoodadField(&new, field.str, ndx, var->value, si, info))
@ -2553,13 +2521,13 @@ HandleOverlayDef(OverlayDef * def,
if ((def->nKeys < 1) && (warningLevel > 3)) if ((def->nKeys < 1) && (warningLevel > 3))
{ {
WARN2("Overlay \"%s\" in section \"%s\" has no keys\n", WARN2("Overlay \"%s\" in section \"%s\" has no keys\n",
XkbcAtomText(def->name), scText(info->dpy, si)); XkbcAtomText(def->name), scText(si));
ACTION("Overlay ignored\n"); ACTION("Overlay ignored\n");
return True; return True;
} }
bzero(&ol, sizeof(OverlayInfo)); bzero(&ol, sizeof(OverlayInfo));
ol.name = ol.name =
XkbcInternAtom(info->dpy, XkbcAtomGetString(def->name), False); XkbcInternAtom(XkbcAtomGetString(def->name), False);
for (keyDef = def->keys; keyDef; for (keyDef = def->keys; keyDef;
keyDef = (OverlayKeyDef *) keyDef->common.next) keyDef = (OverlayKeyDef *) keyDef->common.next)
{ {
@ -2568,7 +2536,7 @@ HandleOverlayDef(OverlayDef * def,
{ {
WSGO("Couldn't allocate OverlayKeyInfo\n"); WSGO("Couldn't allocate OverlayKeyInfo\n");
ACTION2("Overlay %s for section %s will be incomplete\n", ACTION2("Overlay %s for section %s will be incomplete\n",
oiText(info->dpy, &ol), scText(info->dpy, si)); oiText(&ol), scText(si));
return False; return False;
} }
strncpy(key->over, keyDef->over, XkbKeyNameLength); strncpy(key->over, keyDef->over, XkbKeyNameLength);
@ -2636,7 +2604,7 @@ HandleComplexKey(KeyDef * def, KeyInfo * key, GeometryInfo * info)
ERROR("Cannot determine field for unnamed expression\n"); ERROR("Cannot determine field for unnamed expression\n");
ACTION3("Ignoring key %d in row %d of section %s\n", ACTION3("Ignoring key %d in row %d of section %s\n",
row->nKeys + 1, row->section->nRows + 1, row->nKeys + 1, row->section->nRows + 1,
rowText(info->dpy, row)); rowText(row));
return False; return False;
} }
} }
@ -2652,7 +2620,7 @@ HandleRowBody(RowDef * def, RowInfo * row, unsigned merge,
if ((def->nKeys < 1) && (warningLevel > 3)) if ((def->nKeys < 1) && (warningLevel > 3))
{ {
ERROR1("Row in section %s has no keys\n", rowText(info->dpy, row)); ERROR1("Row in section %s has no keys\n", rowText(row));
ACTION("Section ignored\n"); ACTION("Section ignored\n");
return True; return True;
} }
@ -2693,7 +2661,7 @@ HandleRowBody(RowDef * def, RowInfo * row, unsigned merge,
if ((len < 1) || (len > XkbKeyNameLength)) if ((len < 1) || (len > XkbKeyNameLength))
{ {
ERROR2("Illegal name %s for key in section %s\n", ERROR2("Illegal name %s for key in section %s\n",
keyDef->name, rowText(info->dpy, row)); keyDef->name, rowText(row));
ACTION("Section not compiled\n"); ACTION("Section not compiled\n");
return False; return False;
} }
@ -2794,8 +2762,7 @@ HandleSectionBody(SectionDef * def,
{ {
WSGO2("Expected %d rows, found %d\n", (unsigned int) def->nRows, WSGO2("Expected %d rows, found %d\n", (unsigned int) def->nRows,
(unsigned int) si->nRows); (unsigned int) si->nRows);
ACTION1("Definition of section %s might be incorrect\n", ACTION1("Definition of section %s might be incorrect\n", scText(si));
scText(info->dpy, si));
} }
return True; return True;
} }
@ -2819,7 +2786,7 @@ HandleSectionDef(SectionDef * def,
return False; return False;
} }
si.name = si.name =
XkbcInternAtom(info->dpy, XkbcAtomGetString(def->name), False); XkbcInternAtom(XkbcAtomGetString(def->name), False);
if (!HandleSectionBody(def, &si, merge, info)) if (!HandleSectionBody(def, &si, merge, info))
return False; return False;
if (!AddSection(info, &si)) if (!AddSection(info, &si))
@ -2911,7 +2878,7 @@ HandleGeometryFile(XkbFile * file,
/***====================================================================***/ /***====================================================================***/
static Bool static Bool
CopyShapeDef(Display * dpy, XkbGeometryPtr geom, ShapeInfo * si) CopyShapeDef(XkbGeometryPtr geom, ShapeInfo * si)
{ {
register int i, n; register int i, n;
XkbShapePtr shape; XkbShapePtr shape;
@ -2919,12 +2886,12 @@ CopyShapeDef(Display * dpy, XkbGeometryPtr geom, ShapeInfo * si)
Atom name; Atom name;
si->index = geom->num_shapes; si->index = geom->num_shapes;
name = XkbcInternAtom(dpy, XkbcAtomGetString(si->name), False); name = XkbcInternAtom(XkbcAtomGetString(si->name), False);
shape = XkbAddGeomShape(geom, name, si->nOutlines); shape = XkbAddGeomShape(geom, name, si->nOutlines);
if (!shape) if (!shape)
{ {
WSGO("Couldn't allocate shape in geometry\n"); WSGO("Couldn't allocate shape in geometry\n");
ACTION1("Shape %s not compiled\n", shText(dpy, si)); ACTION1("Shape %s not compiled\n", shText(si));
return False; return False;
} }
old_outline = si->outlines; old_outline = si->outlines;
@ -2934,7 +2901,7 @@ CopyShapeDef(Display * dpy, XkbGeometryPtr geom, ShapeInfo * si)
if (!outline) if (!outline)
{ {
WSGO("Couldn't allocate outline in shape\n"); WSGO("Couldn't allocate outline in shape\n");
ACTION1("Shape %s is incomplete\n", shText(dpy, si)); ACTION1("Shape %s is incomplete\n", shText(si));
return False; return False;
} }
n = old_outline->num_points; n = old_outline->num_points;
@ -2964,7 +2931,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
if (warningLevel < 9) if (warningLevel < 9)
{ {
ERROR1("No position defined for doodad %s\n", ERROR1("No position defined for doodad %s\n",
ddText(info->dpy, di)); ddText(di));
ACTION("Illegal doodad ignored\n"); ACTION("Illegal doodad ignored\n");
return False; return False;
} }
@ -2981,7 +2948,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
{ {
ERROR2("No shape defined for %s doodad %s\n", ERROR2("No shape defined for %s doodad %s\n",
(di->type == XkbOutlineDoodad ? "outline" : "filled"), (di->type == XkbOutlineDoodad ? "outline" : "filled"),
ddText(info->dpy, di)); ddText(di));
ACTION("Incomplete definition ignored\n"); ACTION("Incomplete definition ignored\n");
return False; return False;
} }
@ -2991,12 +2958,12 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
si = FindShape(info, di->shape, si = FindShape(info, di->shape,
(di->type == (di->type ==
XkbOutlineDoodad ? "outline doodad" : XkbOutlineDoodad ? "outline doodad" :
"solid doodad"), ddText(info->dpy, di)); "solid doodad"), ddText(di));
if (si) if (si)
di->shape = si->name; di->shape = si->name;
else else
{ {
ERROR1("No legal shape for %s\n", ddText(info->dpy, di)); ERROR1("No legal shape for %s\n", ddText(di));
ACTION("Incomplete definition ignored\n"); ACTION("Incomplete definition ignored\n");
return False; return False;
} }
@ -3005,7 +2972,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
{ {
if (warningLevel > 5) if (warningLevel > 5)
{ {
WARN1("No color for doodad %s\n", ddText(info->dpy, di)); WARN1("No color for doodad %s\n", ddText(di));
ACTION("Using black\n"); ACTION("Using black\n");
} }
di->color = XkbcInternAtom("black", False); di->color = XkbcInternAtom("black", False);
@ -3014,8 +2981,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
case XkbTextDoodad: case XkbTextDoodad:
if ((di->defs.defined & _GD_Text) == 0) if ((di->defs.defined & _GD_Text) == 0)
{ {
ERROR1("No text specified for text doodad %s\n", ERROR1("No text specified for text doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION("Illegal doodad definition ignored\n"); ACTION("Illegal doodad definition ignored\n");
return False; return False;
} }
@ -3025,8 +2991,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
{ {
if (warningLevel > 5) if (warningLevel > 5)
{ {
WARN1("No color specified for doodad %s\n", WARN1("No color specified for doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION("Using black\n"); ACTION("Using black\n");
} }
di->color = XkbcInternAtom("black", False); di->color = XkbcInternAtom("black", False);
@ -3039,7 +3004,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
{ {
WARN1 WARN1
("Text doodad %s has full and partial font definition\n", ("Text doodad %s has full and partial font definition\n",
ddText(info->dpy, di)); ddText(di));
ACTION("Full specification ignored\n"); ACTION("Full specification ignored\n");
} }
di->defs.defined &= ~_GD_FontSpec; di->defs.defined &= ~_GD_FontSpec;
@ -3049,8 +3014,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
{ {
if (warningLevel > 5) if (warningLevel > 5)
{ {
WARN1("No font specified for doodad %s\n", WARN1("No font specified for doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION1("Using \"%s\"\n", DFLT_FONT); ACTION1("Using \"%s\"\n", DFLT_FONT);
} }
di->font = XkbcInternAtom(DFLT_FONT, False); di->font = XkbcInternAtom(DFLT_FONT, False);
@ -3059,8 +3023,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
{ {
if (warningLevel > 7) if (warningLevel > 7)
{ {
WARN1("No font slant for text doodad %s\n", WARN1("No font slant for text doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION1("Using \"%s\"\n", DFLT_SLANT); ACTION1("Using \"%s\"\n", DFLT_SLANT);
} }
di->fontSlant = XkbcInternAtom(DFLT_SLANT, False); di->fontSlant = XkbcInternAtom(DFLT_SLANT, False);
@ -3069,8 +3032,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
{ {
if (warningLevel > 7) if (warningLevel > 7)
{ {
WARN1("No font weight for text doodad %s\n", WARN1("No font weight for text doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION1("Using \"%s\"\n", DFLT_WEIGHT); ACTION1("Using \"%s\"\n", DFLT_WEIGHT);
} }
di->fontWeight = XkbcInternAtom(DFLT_WEIGHT, False); di->fontWeight = XkbcInternAtom(DFLT_WEIGHT, False);
@ -3079,8 +3041,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
{ {
if (warningLevel > 9) if (warningLevel > 9)
{ {
WARN1("No font set width for text doodad %s\n", WARN1("No font set width for text doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION1("Using \"%s\"\n", DFLT_SET_WIDTH); ACTION1("Using \"%s\"\n", DFLT_SET_WIDTH);
} }
di->fontSetWidth = XkbcInternAtom(DFLT_SET_WIDTH, False); di->fontSetWidth = XkbcInternAtom(DFLT_SET_WIDTH, False);
@ -3089,8 +3050,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
{ {
if (warningLevel > 9) if (warningLevel > 9)
{ {
WARN1("No font variant for text doodad %s\n", WARN1("No font variant for text doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION1("Using \"%s\"\n", DFLT_VARIANT); ACTION1("Using \"%s\"\n", DFLT_VARIANT);
} }
di->fontVariant = XkbcInternAtom(DFLT_VARIANT, False); di->fontVariant = XkbcInternAtom(DFLT_VARIANT, False);
@ -3099,8 +3059,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
{ {
if (warningLevel > 7) if (warningLevel > 7)
{ {
WARN1("No font encoding for doodad %s\n", WARN1("No font encoding for doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION1("Using \"%s\"\n", DFLT_ENCODING); ACTION1("Using \"%s\"\n", DFLT_ENCODING);
} }
di->fontEncoding = XkbcInternAtom(DFLT_ENCODING, False); di->fontEncoding = XkbcInternAtom(DFLT_ENCODING, False);
@ -3109,8 +3068,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
{ {
if (warningLevel > 7) if (warningLevel > 7)
{ {
WARN1("No font size for text doodad %s\n", WARN1("No font size for text doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION1("Using %s point text\n", XkbcGeomFPText(DFLT_SIZE)); ACTION1("Using %s point text\n", XkbcGeomFPText(DFLT_SIZE));
} }
di->fontSize = DFLT_SIZE; di->fontSize = DFLT_SIZE;
@ -3130,8 +3088,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
size *= nLines; size *= nLines;
if (warningLevel > 5) if (warningLevel > 5)
{ {
WARN1("No height for text doodad %s\n", WARN1("No height for text doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION1("Using calculated height %s millimeters\n", ACTION1("Using calculated height %s millimeters\n",
XkbcGeomFPText(size)); XkbcGeomFPText(size));
} }
@ -3158,7 +3115,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
width *= (di->height * 2) / 3; width *= (di->height * 2) / 3;
if (warningLevel > 5) if (warningLevel > 5)
{ {
WARN1("No width for text doodad %s\n", ddText(info->dpy, di)); WARN1("No width for text doodad %s\n", ddText(di));
ACTION1("Using calculated width %s millimeters\n", ACTION1("Using calculated width %s millimeters\n",
XkbcGeomFPText(width)); XkbcGeomFPText(width));
} }
@ -3168,22 +3125,19 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
case XkbIndicatorDoodad: case XkbIndicatorDoodad:
if ((di->defs.defined & _GD_Shape) == 0) if ((di->defs.defined & _GD_Shape) == 0)
{ {
ERROR1("No shape defined for indicator doodad %s\n", ERROR1("No shape defined for indicator doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION("Incomplete definition ignored\n"); ACTION("Incomplete definition ignored\n");
return False; return False;
} }
else else
{ {
ShapeInfo *si; ShapeInfo *si;
si = FindShape(info, di->shape, "indicator doodad", si = FindShape(info, di->shape, "indicator doodad", ddText(di));
ddText(info->dpy, di));
if (si) if (si)
di->shape = si->name; di->shape = si->name;
else else
{ {
ERROR1("No legal shape for doodad %s\n", ERROR1("No legal shape for doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION("Incomplete definition ignored\n"); ACTION("Incomplete definition ignored\n");
return False; return False;
} }
@ -3193,7 +3147,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
if (warningLevel > 5) if (warningLevel > 5)
{ {
WARN1("No \"on\" color for indicator doodad %s\n", WARN1("No \"on\" color for indicator doodad %s\n",
ddText(info->dpy, di)); ddText(di));
ACTION("Using green\n"); ACTION("Using green\n");
} }
di->color = XkbcInternAtom("green", False); di->color = XkbcInternAtom("green", False);
@ -3203,7 +3157,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
if (warningLevel > 5) if (warningLevel > 5)
{ {
WARN1("No \"off\" color for indicator doodad %s\n", WARN1("No \"off\" color for indicator doodad %s\n",
ddText(info->dpy, di)); ddText(di));
ACTION("Using black\n"); ACTION("Using black\n");
} }
di->offColor = XkbcInternAtom("black", False); di->offColor = XkbcInternAtom("black", False);
@ -3212,15 +3166,13 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
case XkbLogoDoodad: case XkbLogoDoodad:
if (di->logoName == NULL) if (di->logoName == NULL)
{ {
ERROR1("No logo name defined for logo doodad %s\n", ERROR1("No logo name defined for logo doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION("Incomplete definition ignored\n"); ACTION("Incomplete definition ignored\n");
return False; return False;
} }
if ((di->defs.defined & _GD_Shape) == 0) if ((di->defs.defined & _GD_Shape) == 0)
{ {
ERROR1("No shape defined for logo doodad %s\n", ERROR1("No shape defined for logo doodad %s\n", ddText(di));
ddText(info->dpy, di));
ACTION("Incomplete definition ignored\n"); ACTION("Incomplete definition ignored\n");
return False; return False;
} }
@ -3228,12 +3180,12 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
{ {
ShapeInfo *si; ShapeInfo *si;
si = FindShape(info, di->shape, "logo doodad", si = FindShape(info, di->shape, "logo doodad",
ddText(info->dpy, di)); ddText(di));
if (si) if (si)
di->shape = si->name; di->shape = si->name;
else else
{ {
ERROR1("No legal shape for %s\n", ddText(info->dpy, di)); ERROR1("No legal shape for %s\n", ddText(di));
ACTION("Incomplete definition ignored\n"); ACTION("Incomplete definition ignored\n");
return False; return False;
} }
@ -3242,7 +3194,7 @@ VerifyDoodadInfo(DoodadInfo * di, GeometryInfo * info)
{ {
if (warningLevel > 5) if (warningLevel > 5)
{ {
WARN1("No color for doodad %s\n", ddText(info->dpy, di)); WARN1("No color for doodad %s\n", ddText(di));
ACTION("Using black\n"); ACTION("Using black\n");
} }
di->color = XkbcInternAtom("black", False); di->color = XkbcInternAtom("black", False);
@ -3313,7 +3265,7 @@ CopyDoodadDef(XkbGeometryPtr geom,
{ {
WSGO1("Couldn't allocate doodad in %s\n", WSGO1("Couldn't allocate doodad in %s\n",
(section ? "section" : "geometry")); (section ? "section" : "geometry"));
ACTION1("Cannot copy doodad %s\n", ddText(info->dpy, di)); ACTION1("Cannot copy doodad %s\n", ddText(di));
return False; return False;
} }
doodad->any.type = di->type; doodad->any.type = di->type;
@ -3553,7 +3505,7 @@ CopySectionDef(XkbGeometryPtr geom, SectionInfo * si, GeometryInfo * info)
if (section == NULL) if (section == NULL)
{ {
WSGO("Couldn't allocate section in geometry\n"); WSGO("Couldn't allocate section in geometry\n");
ACTION1("Section %s not compiled\n", scText(info->dpy, si)); ACTION1("Section %s not compiled\n", scText(si));
return False; return False;
} }
section->top = si->top; section->top = si->top;
@ -3568,7 +3520,7 @@ CopySectionDef(XkbGeometryPtr geom, SectionInfo * si, GeometryInfo * info)
if (row == NULL) if (row == NULL)
{ {
WSGO("Couldn't allocate row in section\n"); WSGO("Couldn't allocate row in section\n");
ACTION1("Section %s is incomplete\n", scText(info->dpy, si)); ACTION1("Section %s is incomplete\n", scText(si));
return False; return False;
} }
row->top = ri->top; row->top = ri->top;
@ -3580,16 +3532,15 @@ CopySectionDef(XkbGeometryPtr geom, SectionInfo * si, GeometryInfo * info)
if ((ki->defs.defined & _GK_Name) == 0) if ((ki->defs.defined & _GK_Name) == 0)
{ {
ERROR3("Key %d of row %d in section %s has no name\n", ERROR3("Key %d of row %d in section %s has no name\n",
(int) ki->index, (int) ri->index, (int) ki->index, (int) ri->index, scText(si));
scText(info->dpy, si)); ACTION1("Section %s ignored\n", scText(si));
ACTION1("Section %s ignored\n", scText(info->dpy, si));
return False; return False;
} }
key = XkbAddGeomKey(row); key = XkbAddGeomKey(row);
if (key == NULL) if (key == NULL)
{ {
WSGO("Couldn't allocate key in row\n"); WSGO("Couldn't allocate key in row\n");
ACTION1("Section %s is incomplete\n", scText(info->dpy, si)); ACTION1("Section %s is incomplete\n", scText(si));
return False; return False;
} }
memcpy(key->name.name, ki->name, XkbKeyNameLength); memcpy(key->name.name, ki->name, XkbKeyNameLength);
@ -3650,7 +3601,6 @@ CompileGeometry(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
GeometryInfo info; GeometryInfo info;
InitGeometryInfo(&info, file->id, merge); InitGeometryInfo(&info, file->id, merge);
info.dpy = xkb->dpy;
HandleGeometryFile(file, xkb, merge, &info); HandleGeometryFile(file, xkb, merge, &info);
if (info.errorCount == 0) if (info.errorCount == 0)
@ -3720,7 +3670,7 @@ CompileGeometry(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
for (si = info.shapes; si != NULL; for (si = info.shapes; si != NULL;
si = (ShapeInfo *) si->defs.next) si = (ShapeInfo *) si->defs.next)
{ {
if (!CopyShapeDef(xkb->dpy, geom, si)) if (!CopyShapeDef(geom, si))
return False; return False;
} }
} }

View File

@ -35,15 +35,15 @@
/***====================================================================***/ /***====================================================================***/
#define ReportIndicatorBadType(d,l,f,w) \ #define ReportIndicatorBadType(l, f, w) \
ReportBadType("indicator map", (f), XkbcAtomText((l)->name), (w)) ReportBadType("indicator map", (f), XkbcAtomText((l)->name), (w))
#define ReportIndicatorNotArray(d,l,f) \ #define ReportIndicatorNotArray(l, f) \
ReportNotArray("indicator map", (f), XkbcAtomText((l)->name)) ReportNotArray("indicator map", (f), XkbcAtomText((l)->name))
/***====================================================================***/ /***====================================================================***/
void void
ClearIndicatorMapInfo(Display * dpy, LEDInfo * info) ClearIndicatorMapInfo(LEDInfo * info)
{ {
info->name = XkbcInternAtom("default", False); info->name = XkbcInternAtom("default", False);
info->indicator = _LED_NotBound; info->indicator = _LED_NotBound;
@ -208,10 +208,9 @@ SetIndicatorMapField(LEDInfo * led,
|| (uStrCaseCmp(field, "mods") == 0)) || (uStrCaseCmp(field, "mods") == 0))
{ {
if (arrayNdx != NULL) if (arrayNdx != NULL)
return ReportIndicatorNotArray(xkb->dpy, led, field); return ReportIndicatorNotArray(led, field);
if (!ExprResolveModMask(value, &rtrn, LookupVModMask, (char *) xkb)) if (!ExprResolveModMask(value, &rtrn, LookupVModMask, (char *) xkb))
return ReportIndicatorBadType(xkb->dpy, led, field, return ReportIndicatorBadType(led, field, "modifier mask");
"modifier mask");
led->real_mods = rtrn.uval & 0xff; led->real_mods = rtrn.uval & 0xff;
led->vmods = (rtrn.uval >> 8) & 0xff; led->vmods = (rtrn.uval >> 8) & 0xff;
led->defs.defined |= _LED_Mods; led->defs.defined |= _LED_Mods;
@ -219,10 +218,10 @@ SetIndicatorMapField(LEDInfo * led,
else if (uStrCaseCmp(field, "groups") == 0) else if (uStrCaseCmp(field, "groups") == 0)
{ {
if (arrayNdx != NULL) if (arrayNdx != NULL)
return ReportIndicatorNotArray(xkb->dpy, led, field); return ReportIndicatorNotArray(led, field);
if (!ExprResolveMask if (!ExprResolveMask
(value, &rtrn, SimpleLookup, (char *) groupNames)) (value, &rtrn, SimpleLookup, (char *) groupNames))
return ReportIndicatorBadType(xkb->dpy, led, field, "group mask"); return ReportIndicatorBadType(led, field, "group mask");
led->groups = rtrn.uval; led->groups = rtrn.uval;
led->defs.defined |= _LED_Groups; led->defs.defined |= _LED_Groups;
} }
@ -230,10 +229,10 @@ SetIndicatorMapField(LEDInfo * led,
(uStrCaseCmp(field, "ctrls") == 0)) (uStrCaseCmp(field, "ctrls") == 0))
{ {
if (arrayNdx != NULL) if (arrayNdx != NULL)
return ReportIndicatorNotArray(xkb->dpy, led, field); return ReportIndicatorNotArray(led, field);
if (!ExprResolveMask if (!ExprResolveMask
(value, &rtrn, SimpleLookup, (char *) ctrlNames)) (value, &rtrn, SimpleLookup, (char *) ctrlNames))
return ReportIndicatorBadType(xkb->dpy, led, field, return ReportIndicatorBadType(led, field,
"controls mask"); "controls mask");
led->ctrls = rtrn.uval; led->ctrls = rtrn.uval;
led->defs.defined |= _LED_Ctrls; led->defs.defined |= _LED_Ctrls;
@ -241,9 +240,9 @@ SetIndicatorMapField(LEDInfo * led,
else if (uStrCaseCmp(field, "allowexplicit") == 0) else if (uStrCaseCmp(field, "allowexplicit") == 0)
{ {
if (arrayNdx != NULL) if (arrayNdx != NULL)
return ReportIndicatorNotArray(xkb->dpy, led, field); return ReportIndicatorNotArray(led, field);
if (!ExprResolveBoolean(value, &rtrn, NULL, NULL)) if (!ExprResolveBoolean(value, &rtrn, NULL, NULL))
return ReportIndicatorBadType(xkb->dpy, led, field, "boolean"); return ReportIndicatorBadType(led, field, "boolean");
if (rtrn.uval) if (rtrn.uval)
led->flags &= ~XkbIM_NoExplicit; led->flags &= ~XkbIM_NoExplicit;
else else
@ -254,11 +253,11 @@ SetIndicatorMapField(LEDInfo * led,
(uStrCaseCmp(field, "whichmodifierstate") == 0)) (uStrCaseCmp(field, "whichmodifierstate") == 0))
{ {
if (arrayNdx != NULL) if (arrayNdx != NULL)
return ReportIndicatorNotArray(xkb->dpy, led, field); return ReportIndicatorNotArray(led, field);
if (!ExprResolveMask(value, &rtrn, SimpleLookup, if (!ExprResolveMask(value, &rtrn, SimpleLookup,
(char *) modComponentNames)) (char *) modComponentNames))
{ {
return ReportIndicatorBadType(xkb->dpy, led, field, return ReportIndicatorBadType(led, field,
"mask of modifier state components"); "mask of modifier state components");
} }
led->which_mods = rtrn.uval; led->which_mods = rtrn.uval;
@ -266,11 +265,11 @@ SetIndicatorMapField(LEDInfo * led,
else if (uStrCaseCmp(field, "whichgroupstate") == 0) else if (uStrCaseCmp(field, "whichgroupstate") == 0)
{ {
if (arrayNdx != NULL) if (arrayNdx != NULL)
return ReportIndicatorNotArray(xkb->dpy, led, field); return ReportIndicatorNotArray(led, field);
if (!ExprResolveMask(value, &rtrn, SimpleLookup, if (!ExprResolveMask(value, &rtrn, SimpleLookup,
(char *) groupComponentNames)) (char *) groupComponentNames))
{ {
return ReportIndicatorBadType(xkb->dpy, led, field, return ReportIndicatorBadType(led, field,
"mask of group state components"); "mask of group state components");
} }
led->which_groups = rtrn.uval; led->which_groups = rtrn.uval;
@ -283,9 +282,9 @@ SetIndicatorMapField(LEDInfo * led,
(uStrCaseCmp(field, "indicatordriveskeyboard") == 0)) (uStrCaseCmp(field, "indicatordriveskeyboard") == 0))
{ {
if (arrayNdx != NULL) if (arrayNdx != NULL)
return ReportIndicatorNotArray(xkb->dpy, led, field); return ReportIndicatorNotArray(led, field);
if (!ExprResolveBoolean(value, &rtrn, NULL, NULL)) if (!ExprResolveBoolean(value, &rtrn, NULL, NULL))
return ReportIndicatorBadType(xkb->dpy, led, field, "boolean"); return ReportIndicatorBadType(led, field, "boolean");
if (rtrn.uval) if (rtrn.uval)
led->flags |= XkbIM_LEDDrivesKB; led->flags |= XkbIM_LEDDrivesKB;
else else
@ -295,9 +294,9 @@ SetIndicatorMapField(LEDInfo * led,
else if (uStrCaseCmp(field, "index") == 0) else if (uStrCaseCmp(field, "index") == 0)
{ {
if (arrayNdx != NULL) if (arrayNdx != NULL)
return ReportIndicatorNotArray(xkb->dpy, led, field); return ReportIndicatorNotArray(led, field);
if (!ExprResolveInteger(value, &rtrn, NULL, NULL)) if (!ExprResolveInteger(value, &rtrn, NULL, NULL))
return ReportIndicatorBadType(xkb->dpy, led, field, return ReportIndicatorBadType(led, field,
"indicator index"); "indicator index");
if ((rtrn.uval < 1) || (rtrn.uval > 32)) if ((rtrn.uval < 1) || (rtrn.uval > 32))
{ {

View File

@ -51,8 +51,7 @@ typedef struct _LEDInfo
unsigned int ctrls; unsigned int ctrls;
} LEDInfo; } LEDInfo;
extern void ClearIndicatorMapInfo(Display * /* dpy */ , extern void ClearIndicatorMapInfo(LEDInfo * /* info */
LEDInfo * /* info */
); );

View File

@ -871,8 +871,7 @@ CompileKeycodes(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
ii = (IndicatorNameInfo *) ii->defs.next) ii = (IndicatorNameInfo *) ii->defs.next)
{ {
xkb->names->indicators[ii->ndx - 1] = xkb->names->indicators[ii->ndx - 1] =
XkbcInternAtom(xkb->dpy, XkbcInternAtom(XkbcAtomGetString(ii->name), False);
XkbcAtomGetString(ii->name), False);
if (xkb->indicators != NULL) if (xkb->indicators != NULL)
{ {
register unsigned bit; register unsigned bit;

View File

@ -50,7 +50,6 @@ typedef struct _PreserveInfo
typedef struct _KeyTypeInfo typedef struct _KeyTypeInfo
{ {
CommonInfo defs; CommonInfo defs;
Display *dpy;
Atom name; Atom name;
int fileID; int fileID;
unsigned mask; unsigned mask;
@ -67,7 +66,6 @@ typedef struct _KeyTypeInfo
typedef struct _KeyTypesInfo typedef struct _KeyTypesInfo
{ {
Display *dpy;
char *name; char *name;
int errorCount; int errorCount;
int fileID; int fileID;
@ -85,10 +83,10 @@ Atom tok_KEYPAD;
/***====================================================================***/ /***====================================================================***/
#define ReportTypeShouldBeArray(t,f) \ #define ReportTypeShouldBeArray(t, f) \
ReportShouldBeArray("key type",(f),TypeTxt(t)) ReportShouldBeArray("key type", (f), TypeTxt(t))
#define ReportTypeBadType(t,f,w) \ #define ReportTypeBadType(t, f, w) \
ReportBadType("key type",(f),TypeTxt(t),(w)) ReportBadType("key type", (f), TypeTxt(t), (w))
/***====================================================================***/ /***====================================================================***/
@ -113,15 +111,16 @@ extern Bool AddLevelName(KeyTypeInfo * /* type */ ,
Bool /* report */ Bool /* report */
); );
#define MapEntryTxt(t,x,e) \ #define MapEntryTxt(x, e) \
XkbVModMaskText((t)->dpy,(x),(e)->mods.real_mods,(e)->mods.vmods,XkbMessage) XkbVModMaskText((x), (e)->mods.real_mods, (e)->mods.vmods, XkbMessage)
#define PreserveIndexTxt(t,x,p) \ #define PreserveIndexTxt(x, p) \
XkbVModMaskText((t)->dpy,(x),(p)->indexMods,(p)->indexVMods,XkbMessage) XkbVModMaskText((x), (p)->indexMods, (p)->indexVMods, XkbMessage)
#define PreserveTxt(t,x,p) \ #define PreserveTxt(x, p) \
XkbVModMaskText((t)->dpy,(x),(p)->preMods,(p)->preVMods,XkbMessage) XkbVModMaskText((x), (p)->preMods, (p)->preVMods, XkbMessage)
#define TypeTxt(t) XkbcAtomText((t)->name) #define TypeTxt(t) \
#define TypeMaskTxt(t,x) \ XkbcAtomText((t)->name)
XkbVModMaskText((t)->dpy,(x),(t)->mask,(t)->vmask,XkbMessage) #define TypeMaskTxt(t, x) \
XkbVModMaskText((x), (t)->mask, (t)->vmask, XkbMessage)
/***====================================================================***/ /***====================================================================***/
@ -132,7 +131,6 @@ InitKeyTypesInfo(KeyTypesInfo * info, XkbcDescPtr xkb, KeyTypesInfo * from)
tok_TWO_LEVEL = XkbcInternAtom("TWO_LEVEL", False); tok_TWO_LEVEL = XkbcInternAtom("TWO_LEVEL", False);
tok_ALPHABETIC = XkbcInternAtom("ALPHABETIC", False); tok_ALPHABETIC = XkbcInternAtom("ALPHABETIC", False);
tok_KEYPAD = XkbcInternAtom("KEYPAD", False); tok_KEYPAD = XkbcInternAtom("KEYPAD", False);
info->dpy = NULL;
info->name = uStringDup("default"); info->name = uStringDup("default");
info->errorCount = 0; info->errorCount = 0;
info->stdPresent = 0; info->stdPresent = 0;
@ -155,7 +153,6 @@ InitKeyTypesInfo(KeyTypesInfo * info, XkbcDescPtr xkb, KeyTypesInfo * from)
InitVModInfo(&info->vmods, xkb); InitVModInfo(&info->vmods, xkb);
if (from != NULL) if (from != NULL)
{ {
info->dpy = from->dpy;
info->dflt = from->dflt; info->dflt = from->dflt;
if (from->dflt.entries) if (from->dflt.entries)
{ {
@ -223,7 +220,6 @@ FreeKeyTypeInfo(KeyTypeInfo * type)
static void static void
FreeKeyTypesInfo(KeyTypesInfo * info) FreeKeyTypesInfo(KeyTypesInfo * info)
{ {
info->dpy = NULL;
if (info->name) if (info->name)
uFree(info->name); uFree(info->name);
info->name = NULL; info->name = NULL;
@ -250,7 +246,6 @@ NextKeyType(KeyTypesInfo * info)
{ {
bzero(type, sizeof(KeyTypeInfo)); bzero(type, sizeof(KeyTypeInfo));
type->defs.fileID = info->fileID; type->defs.fileID = info->fileID;
type->dpy = info->dpy;
info->types = (KeyTypeInfo *) AddCommonInfo(&info->types->defs, info->types = (KeyTypeInfo *) AddCommonInfo(&info->types->defs,
(CommonInfo *) type); (CommonInfo *) type);
info->nTypes++; info->nTypes++;
@ -564,7 +559,7 @@ AddPreserve(XkbcDescPtr xkb,
if (warningLevel > 9) if (warningLevel > 9)
{ {
WARN2("Identical definitions for preserve[%s] in %s\n", WARN2("Identical definitions for preserve[%s] in %s\n",
PreserveIndexTxt(type, xkb, old), TypeTxt(type)); PreserveIndexTxt(xkb, old), TypeTxt(type));
ACTION("Ignored\n"); ACTION("Ignored\n");
} }
return True; return True;
@ -573,17 +568,17 @@ AddPreserve(XkbcDescPtr xkb,
{ {
char *str; char *str;
WARN2("Multiple definitions for preserve[%s] in %s\n", WARN2("Multiple definitions for preserve[%s] in %s\n",
PreserveIndexTxt(type, xkb, old), TypeTxt(type)); PreserveIndexTxt(xkb, old), TypeTxt(type));
if (clobber) if (clobber)
str = PreserveTxt(type, xkb, new); str = PreserveTxt(xkb, new);
else else
str = PreserveTxt(type, xkb, old); str = PreserveTxt(xkb, old);
ACTION1("Using %s, ", str); ACTION1("Using %s, ", str);
if (clobber) if (clobber)
str = PreserveTxt(type, xkb, old); str = PreserveTxt(xkb, old);
else else
str = PreserveTxt(type, xkb, new); str = PreserveTxt(xkb, new);
INFO1("ignoring %s\n", str); INFO1("ignoring %s\n", str);
} }
if (clobber) if (clobber)
@ -597,7 +592,7 @@ AddPreserve(XkbcDescPtr xkb,
if (!old) if (!old)
{ {
WSGO1("Couldn't allocate preserve in %s\n", TypeTxt(type)); WSGO1("Couldn't allocate preserve in %s\n", TypeTxt(type));
ACTION1("Preserve[%s] lost\n", PreserveIndexTxt(type, xkb, old)); ACTION1("Preserve[%s] lost\n", PreserveIndexTxt(xkb, old));
return False; return False;
} }
*old = *new; *old = *new;
@ -639,13 +634,13 @@ AddMapEntry(XkbcDescPtr xkb,
ignore = new->level + 1; ignore = new->level + 1;
} }
WARN2("Multiple map entries for %s in %s\n", WARN2("Multiple map entries for %s in %s\n",
MapEntryTxt(type, xkb, new), TypeTxt(type)); MapEntryTxt(xkb, new), TypeTxt(type));
ACTION2("Using %d, ignoring %d\n", use, ignore); ACTION2("Using %d, ignoring %d\n", use, ignore);
} }
else if (warningLevel > 9) else if (warningLevel > 9)
{ {
WARN3("Multiple occurences of map[%s]= %d in %s\n", WARN3("Multiple occurences of map[%s]= %d in %s\n",
MapEntryTxt(type, xkb, new), new->level + 1, TypeTxt(type)); MapEntryTxt(xkb, new), new->level + 1, TypeTxt(type));
ACTION("Ignored\n"); ACTION("Ignored\n");
return True; return True;
} }
@ -700,11 +695,11 @@ SetMapEntry(KeyTypeInfo * type,
{ {
WARN1("Map entry for unused modifiers in %s\n", TypeTxt(type)); WARN1("Map entry for unused modifiers in %s\n", TypeTxt(type));
ACTION1("Using %s instead of ", ACTION1("Using %s instead of ",
XkbVModMaskText(type->dpy, xkb, XkbVModMaskText(xkb,
entry.mods.real_mods & type->mask, entry.mods.real_mods & type->mask,
entry.mods.vmods & type->vmask, entry.mods.vmods & type->vmask,
XkbMessage)); XkbMessage));
INFO1("%s\n", MapEntryTxt(type, xkb, &entry)); INFO1("%s\n", MapEntryTxt(xkb, &entry));
} }
entry.mods.real_mods &= type->mask; entry.mods.real_mods &= type->mask;
entry.mods.vmods &= type->vmask; entry.mods.vmods &= type->vmask;
@ -720,7 +715,7 @@ SetMapEntry(KeyTypeInfo * type,
ERROR3("Shift level %d out of range (1..%d) in key type %s\n", ERROR3("Shift level %d out of range (1..%d) in key type %s\n",
XkbMaxShiftLevel + 1, rtrn.ival, TypeTxt(type)); XkbMaxShiftLevel + 1, rtrn.ival, TypeTxt(type));
ACTION1("Ignoring illegal definition of map[%s]\n", ACTION1("Ignoring illegal definition of map[%s]\n",
MapEntryTxt(type, xkb, &entry)); MapEntryTxt(xkb, &entry));
return False; return False;
} }
entry.level = rtrn.ival - 1; entry.level = rtrn.ival - 1;
@ -748,19 +743,18 @@ SetPreserve(KeyTypeInfo * type,
{ {
WARN1("Preserve for modifiers not used by the %s type\n", WARN1("Preserve for modifiers not used by the %s type\n",
TypeTxt(type)); TypeTxt(type));
ACTION1("Index %s converted to ", ACTION1("Index %s converted to ", PreserveIndexTxt(xkb, &new));
PreserveIndexTxt(type, xkb, &new));
} }
new.indexMods &= type->mask; new.indexMods &= type->mask;
new.indexVMods &= type->vmask; new.indexVMods &= type->vmask;
if (warningLevel > 0) if (warningLevel > 0)
INFO1("%s\n", PreserveIndexTxt(type, xkb, &new)); INFO1("%s\n", PreserveIndexTxt(xkb, &new));
} }
if (!ExprResolveModMask(value, &rtrn, LookupVModMask, (char *) xkb)) if (!ExprResolveModMask(value, &rtrn, LookupVModMask, (char *) xkb))
{ {
ERROR("Preserve value in a key type is not a modifier mask\n"); ERROR("Preserve value in a key type is not a modifier mask\n");
ACTION2("Ignoring preserve[%s] in type %s\n", ACTION2("Ignoring preserve[%s] in type %s\n",
PreserveIndexTxt(type, xkb, &new), TypeTxt(type)); PreserveIndexTxt(xkb, &new), TypeTxt(type));
return False; return False;
} }
new.preMods = rtrn.uval & 0xff; new.preMods = rtrn.uval & 0xff;
@ -771,14 +765,14 @@ SetPreserve(KeyTypeInfo * type,
if (warningLevel > 0) if (warningLevel > 0)
{ {
WARN2("Illegal value for preserve[%s] in type %s\n", WARN2("Illegal value for preserve[%s] in type %s\n",
PreserveTxt(type, xkb, &new), TypeTxt(type)); PreserveTxt(xkb, &new), TypeTxt(type));
ACTION1("Converted %s to ", PreserveIndexTxt(type, xkb, &new)); ACTION1("Converted %s to ", PreserveIndexTxt(xkb, &new));
} }
new.preMods &= new.indexMods; new.preMods &= new.indexMods;
new.preVMods &= new.indexVMods; new.preVMods &= new.indexVMods;
if (warningLevel > 0) if (warningLevel > 0)
{ {
INFO1("%s\n", PreserveIndexTxt(type, xkb, &new)); INFO1("%s\n", PreserveIndexTxt(xkb, &new));
} }
} }
return AddPreserve(xkb, type, &new, True, True); return AddPreserve(xkb, type, &new, True, True);
@ -906,8 +900,8 @@ SetKeyTypeField(KeyTypeInfo * type,
WARN1("Multiple modifier mask definitions for key type %s\n", WARN1("Multiple modifier mask definitions for key type %s\n",
XkbcAtomText(type->name)); XkbcAtomText(type->name));
ACTION1("Using %s, ", TypeMaskTxt(type, xkb)); ACTION1("Using %s, ", TypeMaskTxt(type, xkb));
INFO1("ignoring %s\n", XkbVModMaskText(type->dpy, xkb, mods, INFO1("ignoring %s\n", XkbVModMaskText(xkb, mods, vmods,
vmods, XkbMessage)); XkbMessage));
return False; return False;
} }
type->mask = mods; type->mask = mods;
@ -1002,7 +996,6 @@ HandleKeyTypeDef(KeyTypeDef * def,
type.defs.fileID = info->fileID; type.defs.fileID = info->fileID;
type.defs.merge = merge; type.defs.merge = merge;
type.defs.next = NULL; type.defs.next = NULL;
type.dpy = info->dpy;
type.name = def->name; type.name = def->name;
type.mask = info->dflt.mask; type.mask = info->dflt.mask;
type.vmask = info->dflt.vmask; type.vmask = info->dflt.vmask;