Copy in XkbCompatMapRec and XkbSymInterpretRec

These contain actions, so transition them ahead to XkbcAction and move
them into XKBcommon.h.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
master
Daniel Stone 2010-06-17 05:56:08 +01:00
parent 60e7eeeba1
commit 15b0db5492
8 changed files with 43 additions and 41 deletions

View File

@ -185,7 +185,7 @@ typedef struct _XkbcDesc {
XkbcClientMapPtr map;
XkbIndicatorPtr indicators;
XkbNamesPtr names;
XkbCompatMapPtr compat;
XkbcCompatMapPtr compat;
XkbGeometryPtr geom;
} XkbcDescRec, *XkbcDescPtr;

View File

@ -35,8 +35,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
int
XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI)
{
XkbCompatMapPtr compat;
XkbSymInterpretRec *prev_interpret;
XkbcCompatMapPtr compat;
XkbcSymInterpretRec *prev_interpret;
if (!xkb)
return BadMatch;
@ -52,7 +52,7 @@ XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI)
prev_interpret = compat->sym_interpret;
compat->sym_interpret = _XkbTypedRealloc(compat->sym_interpret,
nSI, XkbSymInterpretRec);
nSI, XkbcSymInterpretRec);
if (!compat->sym_interpret) {
_XkbFree(prev_interpret);
compat->size_si = compat->num_si = 0;
@ -61,17 +61,17 @@ XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI)
if (compat->num_si != 0)
_XkbClearElems(compat->sym_interpret, compat->num_si,
compat->size_si - 1, XkbSymInterpretRec);
compat->size_si - 1, XkbcSymInterpretRec);
return Success;
}
compat = _XkbTypedCalloc(1, XkbCompatMapRec);
compat = _XkbTypedCalloc(1, XkbcCompatMapRec);
if (!compat)
return BadAlloc;
if (nSI > 0) {
compat->sym_interpret = _XkbTypedCalloc(nSI, XkbSymInterpretRec);
compat->sym_interpret = _XkbTypedCalloc(nSI, XkbcSymInterpretRec);
if (!compat->sym_interpret) {
_XkbFree(compat);
return BadAlloc;
@ -89,7 +89,7 @@ XkbcAllocCompatMap(XkbcDescPtr xkb, unsigned which, unsigned nSI)
void
XkbcFreeCompatMap(XkbcDescPtr xkb, unsigned which, Bool freeMap)
{
XkbCompatMapPtr compat;
XkbcCompatMapPtr compat;
if (!xkb || !xkb->compat)
return;

View File

@ -556,7 +556,9 @@ XkbcAllocGeomPoints(XkbOutlinePtr ol, int nPts)
int
XkbcAllocGeomKeys(XkbRowPtr row, int nKeys)
{
return _XkbAllocKeys(row, nKeys);
int ret = _XkbAllocKeys(row, nKeys);
fprintf(stderr, "!!! allocated %d keys at %p\n", nKeys, row->keys);
return ret;
}
int

View File

@ -662,7 +662,7 @@ XkbcChangeKeycodeRange(XkbcDescPtr xkb, int minKC, int maxKC,
if (xkb->server->vmodmap) {
bzero(&xkb->server->vmodmap[minKC],
tmp * sizeof(unsigned short));
tmp * sizeof(uint32_t));
if (changes)
changes->map.changed = _ExtendRange(changes->map.changed,
XkbVirtualModMapMask, minKC,

View File

@ -334,7 +334,7 @@ ReportNotFound(unsigned action, unsigned field, const char *what, char *bad)
static Bool
HandleNoAction(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
return ReportIllegal(action->type, field);
@ -392,7 +392,7 @@ CheckModifierField(XkbcDescPtr xkb,
static Bool
HandleSetLatchMods(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
XkbcModAction *act;
@ -437,7 +437,7 @@ HandleSetLatchMods(XkbcDescPtr xkb,
static Bool
HandleLockMods(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
XkbcModAction *act;
@ -512,7 +512,7 @@ CheckGroupField(unsigned action,
static Bool
HandleSetLatchGroup(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
XkbGroupAction *act;
@ -557,7 +557,7 @@ HandleSetLatchGroup(XkbcDescPtr xkb,
static Bool
HandleLockGroup(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
XkbGroupAction *act;
@ -583,7 +583,7 @@ HandleLockGroup(XkbcDescPtr xkb,
static Bool
HandleMovePtr(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
ExprResult rtrn;
@ -648,7 +648,7 @@ static LookupEntry lockWhich[] = {
static Bool
HandlePtrBtn(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
ExprResult rtrn;
@ -710,7 +710,7 @@ static LookupEntry ptrDflts[] = {
static Bool
HandleSetPtrDflt(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
ExprResult rtrn;
@ -783,7 +783,7 @@ static LookupEntry isoNames[] = {
static Bool
HandleISOLock(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
ExprResult rtrn;
@ -830,7 +830,7 @@ HandleISOLock(XkbcDescPtr xkb,
static Bool
HandleSwitchScreen(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
ExprResult rtrn;
@ -922,7 +922,7 @@ LookupEntry ctrlNames[] = {
static Bool
HandleSetLockControls(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
ExprResult rtrn;
@ -954,7 +954,7 @@ static LookupEntry evNames[] = {
static Bool
HandleActionMessage(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
ExprResult rtrn;
@ -1032,7 +1032,7 @@ HandleActionMessage(XkbcDescPtr xkb,
static Bool
HandleRedirectKey(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
ExprResult rtrn;
@ -1083,7 +1083,7 @@ HandleRedirectKey(XkbcDescPtr xkb,
static Bool
HandleDeviceBtn(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
ExprResult rtrn;
@ -1153,7 +1153,7 @@ HandleDeviceBtn(XkbcDescPtr xkb,
static Bool
HandleDeviceValuator(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
#if 0
@ -1168,7 +1168,7 @@ HandleDeviceValuator(XkbcDescPtr xkb,
static Bool
HandlePrivate(XkbcDescPtr xkb,
XkbAnyAction * action,
XkbcAnyAction * action,
unsigned field, ExprDef * array_ndx, ExprDef * value)
{
ExprResult rtrn;
@ -1200,7 +1200,7 @@ HandlePrivate(XkbcDescPtr xkb,
ACTION("Extra %d bytes ignored\n", len - 6);
return False;
}
strncpy((char *) action->data, rtrn.str, 7);
strncpy((char *) action->pad, rtrn.str, XkbcAnyActionDataSize);
}
free(rtrn.str);
return True;
@ -1215,9 +1215,9 @@ HandlePrivate(XkbcDescPtr xkb,
return False;
}
ndx = rtrn.uval;
if (ndx > 6)
if (ndx >= XkbcAnyActionDataSize)
{
ERROR("The data for a private action is 7 bytes long\n");
ERROR("The data for a private action is 18 bytes long\n");
ACTION("Attempt to use data[%d] ignored\n", ndx);
return False;
}
@ -1229,7 +1229,7 @@ HandlePrivate(XkbcDescPtr xkb,
ACTION("Illegal datum %d ignored\n", rtrn.ival);
return False;
}
action->data[ndx] = rtrn.uval;
action->pad[ndx] = rtrn.uval;
return True;
}
}
@ -1237,7 +1237,7 @@ HandlePrivate(XkbcDescPtr xkb,
}
typedef Bool(*actionHandler) (XkbcDescPtr /* xkb */ ,
XkbAnyAction * /* action */ ,
XkbcAnyAction * /* action */ ,
unsigned /* field */ ,
ExprDef * /* array_ndx */ ,
ExprDef * /* value */
@ -1290,7 +1290,7 @@ ApplyActionFactoryDefaults(XkbcAction * action)
int
HandleActionDef(ExprDef * def,
XkbcDescPtr xkb,
XkbAnyAction * action, unsigned mergeMode, ActionInfo * info)
XkbcAnyAction * action, unsigned mergeMode, ActionInfo * info)
{
ExprDef *arg;
register char *str;
@ -1305,7 +1305,7 @@ HandleActionDef(ExprDef * def,
exprOpText(def->op));
return False;
}
str = XkbcAtomGetString(def->value.action.name);
str = XkbcAtomText(def->value.action.name);
if (!str)
{
WSGO("Missing name in action definition!!\n");

View File

@ -66,7 +66,7 @@ typedef struct _ActionInfo
extern int HandleActionDef(ExprDef * /* def */ ,
XkbcDescPtr /* xkb */ ,
XkbAnyAction * /* action */ ,
XkbcAnyAction * /* action */ ,
unsigned /* mergeMode */ ,
ActionInfo * /* info */
);

View File

@ -39,7 +39,7 @@
typedef struct _SymInterpInfo
{
CommonInfo defs;
XkbSymInterpretRec interp;
XkbcSymInterpretRec interp;
} SymInterpInfo;
#define _SI_VirtualMod (1<<0)
@ -120,7 +120,7 @@ InitCompatInfo(CompatInfo * info, XkbcDescPtr xkb)
info->dflt.interp.act.type = XkbSA_NoAction;
for (i = 0; i < XkbcAnyActionDataSize; i++)
{
info->dflt.interp.act.data[i] = 0;
info->dflt.interp.act.pad[i] = 0;
}
ClearIndicatorMapInfo(&info->ledDflt);
info->ledDflt.defs.fileID = info->fileID;
@ -148,7 +148,7 @@ ClearCompatInfo(CompatInfo * info, XkbcDescPtr xkb)
info->dflt.interp.act.type = XkbSA_NoAction;
for (i = 0; i < XkbcAnyActionDataSize; i++)
{
info->dflt.interp.act.data[i] = 0;
info->dflt.interp.act.pad[i] = 0;
}
ClearIndicatorMapInfo(&info->ledDflt);
info->nInterps = 0;
@ -787,7 +787,7 @@ HandleCompatMapFile(XkbFile * file,
static void
CopyInterps(CompatInfo * info,
XkbCompatMapPtr compat, Bool needSymbol, unsigned pred)
XkbcCompatMapPtr compat, Bool needSymbol, unsigned pred)
{
SymInterpInfo *si;
@ -842,7 +842,7 @@ CompileCompatMap(XkbFile *file, XkbcDescPtr xkb, unsigned merge,
scanFile, info.name);
}
}
size = info.nInterps * sizeof(XkbSymInterpretRec);
size = info.nInterps * sizeof(XkbcSymInterpretRec);
if (size > 0)
{
CopyInterps(&info, xkb->compat, True, XkbSI_Exactly);

View File

@ -993,7 +993,7 @@ AddActionsToKey(KeyInfo * key,
register int i;
unsigned ndx, nActs;
ExprDef *act;
XkbAnyAction *toAct;
XkbcAnyAction *toAct;
if (!GetGroupIndex(key, arrayNdx, ACTIONS, &ndx))
return False;
@ -1035,7 +1035,7 @@ AddActionsToKey(KeyInfo * key,
}
key->actsDefined |= (1 << ndx);
toAct = (XkbAnyAction *) key->acts[ndx];
toAct = (XkbcAnyAction *) key->acts[ndx];
act = value->value.child;
for (i = 0; i < nActs; i++, toAct++)
{