libxkbcomp: Eradicate XkbFileInfo usage
The only real usage was in the frontend to generate a .xkm file. The rest of the code just operated on the attached XkbDescPtr. Note that here we've replaced the usage of the defined field in CompileKeymap with the equivalent field in a XkbcDescPtr.master
parent
f3677538f4
commit
dd25bbc9ac
|
@ -805,15 +805,13 @@ CopyInterps(CompatInfo * info,
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
CompileCompatMap(XkbFile * file,
|
CompileCompatMap(XkbFile *file, XkbcDescPtr xkb, unsigned merge,
|
||||||
XkbFileInfo * result, unsigned merge, LEDInfo ** unboundLEDs)
|
LEDInfoPtr *unboundLEDs)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CompatInfo info;
|
CompatInfo info;
|
||||||
XkbDescPtr xkb;
|
|
||||||
GroupCompatInfo *gcm;
|
GroupCompatInfo *gcm;
|
||||||
|
|
||||||
xkb = result->xkb;
|
|
||||||
InitCompatInfo(&info, xkb);
|
InitCompatInfo(&info, xkb);
|
||||||
info.dflt.defs.merge = merge;
|
info.dflt.defs.merge = merge;
|
||||||
info.ledDflt.defs.merge = merge;
|
info.ledDflt.defs.merge = merge;
|
||||||
|
@ -867,7 +865,7 @@ CompileCompatMap(XkbFile * file,
|
||||||
}
|
}
|
||||||
if (info.leds != NULL)
|
if (info.leds != NULL)
|
||||||
{
|
{
|
||||||
if (!CopyIndicatorMapDefs(result, info.leds, unboundLEDs))
|
if (!CopyIndicatorMapDefs(xkb, info.leds, unboundLEDs))
|
||||||
info.errorCount++;
|
info.errorCount++;
|
||||||
info.leds = NULL;
|
info.leds = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3658,12 +3658,10 @@ CopySectionDef(XkbGeometryPtr geom, SectionInfo * si, GeometryInfo * info)
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
CompileGeometry(XkbFile * file, XkbFileInfo * result, unsigned merge)
|
CompileGeometry(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
|
||||||
{
|
{
|
||||||
GeometryInfo info;
|
GeometryInfo info;
|
||||||
XkbDescPtr xkb;
|
|
||||||
|
|
||||||
xkb = result->xkb;
|
|
||||||
InitGeometryInfo(&info, file->id, merge);
|
InitGeometryInfo(&info, file->id, merge);
|
||||||
info.dpy = xkb->dpy;
|
info.dpy = xkb->dpy;
|
||||||
HandleGeometryFile(file, xkb, merge, &info);
|
HandleGeometryFile(file, xkb, merge, &info);
|
||||||
|
|
|
@ -371,14 +371,11 @@ HandleIndicatorMapDef(IndicatorMapDef * def,
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
CopyIndicatorMapDefs(XkbFileInfo * result, LEDInfo * leds,
|
CopyIndicatorMapDefs(XkbcDescPtr xkb, LEDInfo *leds, LEDInfo **unboundRtrn)
|
||||||
LEDInfo ** unboundRtrn)
|
|
||||||
{
|
{
|
||||||
LEDInfo *led, *next;
|
LEDInfo *led, *next;
|
||||||
LEDInfo *unbound, *last;
|
LEDInfo *unbound, *last;
|
||||||
XkbDescPtr xkb;
|
|
||||||
|
|
||||||
xkb = result->xkb;
|
|
||||||
if (XkbAllocNames(xkb, XkbIndicatorNamesMask, 0, 0) != Success)
|
if (XkbAllocNames(xkb, XkbIndicatorNamesMask, 0, 0) != Success)
|
||||||
{
|
{
|
||||||
WSGO("Couldn't allocate names\n");
|
WSGO("Couldn't allocate names\n");
|
||||||
|
@ -441,14 +438,12 @@ CopyIndicatorMapDefs(XkbFileInfo * result, LEDInfo * leds,
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
BindIndicators(XkbFileInfo * result,
|
BindIndicators(XkbcDescPtr xkb, Bool force, LEDInfo *unbound,
|
||||||
Bool force, LEDInfo * unbound, LEDInfo ** unboundRtrn)
|
LEDInfo **unboundRtrn)
|
||||||
{
|
{
|
||||||
XkbDescPtr xkb;
|
|
||||||
register int i;
|
register int i;
|
||||||
register LEDInfo *led, *next, *last;
|
register LEDInfo *led, *next, *last;
|
||||||
|
|
||||||
xkb = result->xkb;
|
|
||||||
if (xkb->names != NULL)
|
if (xkb->names != NULL)
|
||||||
{
|
{
|
||||||
for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next)
|
for (led = unbound; led != NULL; led = (LEDInfo *) led->defs.next)
|
||||||
|
|
|
@ -74,15 +74,11 @@ extern LEDInfo *HandleIndicatorMapDef(IndicatorMapDef * /* stmt */ ,
|
||||||
unsigned /* mergeMode */
|
unsigned /* mergeMode */
|
||||||
);
|
);
|
||||||
|
|
||||||
extern Bool CopyIndicatorMapDefs(XkbFileInfo * /* result */ ,
|
extern Bool
|
||||||
LEDInfo * /* leds */ ,
|
CopyIndicatorMapDefs(XkbcDescPtr xkb, LEDInfo *leds, LEDInfo **unboundRtrn);
|
||||||
LEDInfo ** /* unboundRtrn */
|
|
||||||
);
|
|
||||||
|
|
||||||
extern Bool BindIndicators(XkbFileInfo * /* result */ ,
|
extern Bool
|
||||||
Bool /* force */ ,
|
BindIndicators(XkbcDescPtr xkb, Bool force, LEDInfo *unbound,
|
||||||
LEDInfo * /* unbound */ ,
|
LEDInfo **unboundRtrn);
|
||||||
LEDInfo ** /* unboundRtrn */
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif /* INDICATORS_H */
|
#endif /* INDICATORS_H */
|
||||||
|
|
|
@ -822,12 +822,10 @@ HandleKeycodesFile(XkbFile * file,
|
||||||
* @return True on success, False otherwise.
|
* @return True on success, False otherwise.
|
||||||
*/
|
*/
|
||||||
Bool
|
Bool
|
||||||
CompileKeycodes(XkbFile * file, XkbFileInfo * result, unsigned merge)
|
CompileKeycodes(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
|
||||||
{
|
{
|
||||||
KeyNamesInfo info; /* contains all the info after parsing */
|
KeyNamesInfo info; /* contains all the info after parsing */
|
||||||
XkbDescPtr xkb;
|
|
||||||
|
|
||||||
xkb = result->xkb;
|
|
||||||
InitKeyNamesInfo(&info);
|
InitKeyNamesInfo(&info);
|
||||||
HandleKeycodesFile(file, xkb, merge, &info);
|
HandleKeycodesFile(file, xkb, merge, &info);
|
||||||
|
|
||||||
|
|
|
@ -42,12 +42,12 @@
|
||||||
static XkbFile *sections[MAX_SECTIONS];
|
static XkbFile *sections[MAX_SECTIONS];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compile the given file and store the output in result.
|
* Compile the given file and store the output in xkb.
|
||||||
* @param file A list of XkbFiles, each denoting one type (e.g.
|
* @param file A list of XkbFiles, each denoting one type (e.g.
|
||||||
* XkmKeyNamesIdx, etc.)
|
* XkmKeyNamesIdx, etc.)
|
||||||
*/
|
*/
|
||||||
Bool
|
Bool
|
||||||
CompileKeymap(XkbFile * file, XkbFileInfo * result, unsigned merge)
|
CompileKeymap(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
|
||||||
{
|
{
|
||||||
unsigned have;
|
unsigned have;
|
||||||
Bool ok;
|
Bool ok;
|
||||||
|
@ -145,20 +145,20 @@ CompileKeymap(XkbFile * file, XkbFileInfo * result, unsigned merge)
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
if (ok && (sections[KEYCODES] != NULL))
|
if (ok && (sections[KEYCODES] != NULL))
|
||||||
ok = CompileKeycodes(sections[KEYCODES], result, MergeOverride);
|
ok = CompileKeycodes(sections[KEYCODES], xkb, MergeOverride);
|
||||||
if (ok && (sections[GEOMETRY] != NULL))
|
if (ok && (sections[GEOMETRY] != NULL))
|
||||||
ok = CompileGeometry(sections[GEOMETRY], result, MergeOverride);
|
ok = CompileGeometry(sections[GEOMETRY], xkb, MergeOverride);
|
||||||
if (ok && (sections[TYPES] != NULL))
|
if (ok && (sections[TYPES] != NULL))
|
||||||
ok = CompileKeyTypes(sections[TYPES], result, MergeOverride);
|
ok = CompileKeyTypes(sections[TYPES], xkb, MergeOverride);
|
||||||
if (ok && (sections[COMPAT] != NULL))
|
if (ok && (sections[COMPAT] != NULL))
|
||||||
ok = CompileCompatMap(sections[COMPAT], result, MergeOverride,
|
ok = CompileCompatMap(sections[COMPAT], xkb, MergeOverride,
|
||||||
&unbound);
|
&unbound);
|
||||||
if (ok && (sections[SYMBOLS] != NULL))
|
if (ok && (sections[SYMBOLS] != NULL))
|
||||||
ok = CompileSymbols(sections[SYMBOLS], result, MergeOverride);
|
ok = CompileSymbols(sections[SYMBOLS], xkb, MergeOverride);
|
||||||
}
|
}
|
||||||
if (!ok)
|
if (!ok)
|
||||||
return False;
|
return False;
|
||||||
result->defined = have;
|
xkb->defined = have;
|
||||||
if (required & (~have))
|
if (required & (~have))
|
||||||
{
|
{
|
||||||
register int i, bit;
|
register int i, bit;
|
||||||
|
@ -178,6 +178,6 @@ CompileKeymap(XkbFile * file, XkbFileInfo * result, unsigned merge)
|
||||||
XkbConfigText(mainType, XkbMessage));
|
XkbConfigText(mainType, XkbMessage));
|
||||||
ok = False;
|
ok = False;
|
||||||
}
|
}
|
||||||
ok = BindIndicators(result, True, unbound, NULL);
|
ok = BindIndicators(xkb, True, unbound, NULL);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1205,12 +1205,10 @@ CopyDefToKeyType(XkbDescPtr xkb, XkbKeyTypePtr type, KeyTypeInfo * def)
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
CompileKeyTypes(XkbFile * file, XkbFileInfo * result, unsigned merge)
|
CompileKeyTypes(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
|
||||||
{
|
{
|
||||||
KeyTypesInfo info;
|
KeyTypesInfo info;
|
||||||
XkbDescPtr xkb;
|
|
||||||
|
|
||||||
xkb = result->xkb;
|
|
||||||
InitKeyTypesInfo(&info, xkb, NULL);
|
InitKeyTypesInfo(&info, xkb, NULL);
|
||||||
info.fileID = file->id;
|
info.fileID = file->id;
|
||||||
HandleKeyTypesFile(file, xkb, merge, &info);
|
HandleKeyTypesFile(file, xkb, merge, &info);
|
||||||
|
|
|
@ -1944,12 +1944,12 @@ PrepareKeyDef(KeyInfo * key)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the KeyInfo into result.
|
* Copy the KeyInfo into the keyboard description.
|
||||||
*
|
*
|
||||||
* This function recurses.
|
* This function recurses.
|
||||||
*/
|
*/
|
||||||
static Bool
|
static Bool
|
||||||
CopySymbolsDef(XkbFileInfo * result, KeyInfo * key, int start_from)
|
CopySymbolsDef(XkbcDescPtr xkb, KeyInfo *key, int start_from)
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
unsigned okc, kc, width, tmp, nGroups;
|
unsigned okc, kc, width, tmp, nGroups;
|
||||||
|
@ -1957,10 +1957,8 @@ CopySymbolsDef(XkbFileInfo * result, KeyInfo * key, int start_from)
|
||||||
Bool haveActions, autoType, useAlias;
|
Bool haveActions, autoType, useAlias;
|
||||||
KeySym *outSyms;
|
KeySym *outSyms;
|
||||||
XkbAction *outActs;
|
XkbAction *outActs;
|
||||||
XkbDescPtr xkb;
|
|
||||||
unsigned types[XkbNumKbdGroups];
|
unsigned types[XkbNumKbdGroups];
|
||||||
|
|
||||||
xkb = result->xkb;
|
|
||||||
useAlias = (start_from == 0);
|
useAlias = (start_from == 0);
|
||||||
|
|
||||||
/* get the keycode for the key. */
|
/* get the keycode for the key. */
|
||||||
|
@ -2151,17 +2149,15 @@ CopySymbolsDef(XkbFileInfo * result, KeyInfo * key, int start_from)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do the same thing for the next key */
|
/* do the same thing for the next key */
|
||||||
CopySymbolsDef(result, key, kc + 1);
|
CopySymbolsDef(xkb, key, kc + 1);
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
CopyModMapDef(XkbFileInfo * result, ModMapEntry * entry)
|
CopyModMapDef(XkbcDescPtr xkb, ModMapEntry *entry)
|
||||||
{
|
{
|
||||||
unsigned kc;
|
unsigned kc;
|
||||||
XkbDescPtr xkb;
|
|
||||||
|
|
||||||
xkb = result->xkb;
|
|
||||||
if ((!entry->haveSymbol)
|
if ((!entry->haveSymbol)
|
||||||
&&
|
&&
|
||||||
(!FindNamedKey
|
(!FindNamedKey
|
||||||
|
@ -2198,17 +2194,15 @@ CopyModMapDef(XkbFileInfo * result, ModMapEntry * entry)
|
||||||
* Handle the xkb_symbols section of an xkb file.
|
* Handle the xkb_symbols section of an xkb file.
|
||||||
*
|
*
|
||||||
* @param file The parsed xkb_symbols section of the xkb file.
|
* @param file The parsed xkb_symbols section of the xkb file.
|
||||||
* @param result Handle to the data to store the result in.
|
* @param xkb Handle to the keyboard description to store the symbols in.
|
||||||
* @param merge Merge strategy (e.g. MergeOverride).
|
* @param merge Merge strategy (e.g. MergeOverride).
|
||||||
*/
|
*/
|
||||||
Bool
|
Bool
|
||||||
CompileSymbols(XkbFile * file, XkbFileInfo * result, unsigned merge)
|
CompileSymbols(XkbFile *file, XkbcDescPtr xkb, unsigned merge)
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
SymbolsInfo info;
|
SymbolsInfo info;
|
||||||
XkbDescPtr xkb;
|
|
||||||
|
|
||||||
xkb = result->xkb;
|
|
||||||
InitSymbolsInfo(&info, xkb);
|
InitSymbolsInfo(&info, xkb);
|
||||||
info.dflt.defs.fileID = file->id;
|
info.dflt.defs.fileID = file->id;
|
||||||
info.dflt.defs.merge = merge;
|
info.dflt.defs.merge = merge;
|
||||||
|
@ -2265,7 +2259,7 @@ CompileSymbols(XkbFile * file, XkbFileInfo * result, unsigned merge)
|
||||||
/* copy! */
|
/* copy! */
|
||||||
for (key = info.keys, i = 0; i < info.nKeys; i++, key++)
|
for (key = info.keys, i = 0; i < info.nKeys; i++, key++)
|
||||||
{
|
{
|
||||||
if (!CopySymbolsDef(result, key, 0))
|
if (!CopySymbolsDef(xkb, key, 0))
|
||||||
info.errorCount++;
|
info.errorCount++;
|
||||||
}
|
}
|
||||||
if (warningLevel > 3)
|
if (warningLevel > 3)
|
||||||
|
@ -2290,7 +2284,7 @@ CompileSymbols(XkbFile * file, XkbFileInfo * result, unsigned merge)
|
||||||
ModMapEntry *mm, *next;
|
ModMapEntry *mm, *next;
|
||||||
for (mm = info.modMap; mm != NULL; mm = next)
|
for (mm = info.modMap; mm != NULL; mm = next)
|
||||||
{
|
{
|
||||||
if (!CopyModMapDef(result, mm))
|
if (!CopyModMapDef(xkb, mm))
|
||||||
info.errorCount++;
|
info.errorCount++;
|
||||||
next = (ModMapEntry *) mm->defs.next;
|
next = (ModMapEntry *) mm->defs.next;
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,38 +336,26 @@ typedef struct _XkbFile
|
||||||
Bool compiled;
|
Bool compiled;
|
||||||
} XkbFile;
|
} XkbFile;
|
||||||
|
|
||||||
extern Bool CompileKeymap(XkbFile * /* file */ ,
|
extern Bool
|
||||||
XkbFileInfo * /* result */ ,
|
CompileKeymap(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
|
||||||
unsigned /* merge */
|
|
||||||
);
|
|
||||||
|
|
||||||
extern Bool CompileKeycodes(XkbFile * /* file */ ,
|
extern Bool
|
||||||
XkbFileInfo * /* result */ ,
|
CompileKeycodes(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
|
||||||
unsigned /* merge */
|
|
||||||
);
|
|
||||||
|
|
||||||
extern Bool CompileGeometry(XkbFile * /* file */ ,
|
extern Bool
|
||||||
XkbFileInfo * /* result */ ,
|
CompileGeometry(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
|
||||||
unsigned /* merge */
|
|
||||||
);
|
|
||||||
|
|
||||||
extern Bool CompileKeyTypes(XkbFile * /* file */ ,
|
extern Bool
|
||||||
XkbFileInfo * /* result */ ,
|
CompileKeyTypes(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
|
||||||
unsigned /* merge */
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef struct _LEDInfo *LEDInfoPtr;
|
typedef struct _LEDInfo *LEDInfoPtr;
|
||||||
|
|
||||||
extern Bool CompileCompatMap(XkbFile * /* file */ ,
|
extern Bool
|
||||||
XkbFileInfo * /* result */ ,
|
CompileCompatMap(XkbFile *file, XkbcDescPtr xkb, unsigned merge,
|
||||||
unsigned /* merge */ ,
|
LEDInfoPtr *unboundLEDs);
|
||||||
LEDInfoPtr * /* unboundLEDs */
|
|
||||||
);
|
|
||||||
|
|
||||||
extern Bool CompileSymbols(XkbFile * /* file */ ,
|
extern Bool
|
||||||
XkbFileInfo * /* result */ ,
|
CompileSymbols(XkbFile *file, XkbcDescPtr xkb, unsigned merge);
|
||||||
unsigned /* merge */
|
|
||||||
);
|
|
||||||
|
|
||||||
#define WantLongListing (1<<0)
|
#define WantLongListing (1<<0)
|
||||||
#define WantPartialMaps (1<<1)
|
#define WantPartialMaps (1<<1)
|
||||||
|
|
Loading…
Reference in New Issue