xkb: XkbWriteKeyActions(): only pass in the needed data
We don't need the whole struct here, especially do we not wanna change it. Therefore only pass in what's really needed, so it gets easier to understand. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
2ca5e4c560
commit
b0f6b461ff
21
xkb/xkb.c
21
xkb/xkb.c
|
@ -1185,30 +1185,29 @@ XkbSizeKeyActions(XkbDescPtr xkb, xkbGetMapReply * rep)
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
XkbWriteKeyActions(XkbDescPtr xkb, xkbGetMapReply * rep, char *buf,
|
XkbWriteKeyActions(XkbDescPtr xkb, KeyCode firstKeyAct, CARD8 nKeyActs, char *buf)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
CARD8 *numDesc;
|
CARD8 *numDesc;
|
||||||
XkbAnyAction *actDesc;
|
XkbAnyAction *actDesc;
|
||||||
|
|
||||||
numDesc = (CARD8 *) buf;
|
numDesc = (CARD8 *) buf;
|
||||||
for (i = 0; i < rep->nKeyActs; i++) {
|
for (i = 0; i < nKeyActs; i++) {
|
||||||
if (xkb->server->key_acts[i + rep->firstKeyAct] == 0)
|
if (xkb->server->key_acts[i + firstKeyAct] == 0)
|
||||||
numDesc[i] = 0;
|
numDesc[i] = 0;
|
||||||
else
|
else
|
||||||
numDesc[i] = XkbKeyNumActions(xkb, (i + rep->firstKeyAct));
|
numDesc[i] = XkbKeyNumActions(xkb, (i + firstKeyAct));
|
||||||
}
|
}
|
||||||
buf += XkbPaddedSize(rep->nKeyActs);
|
buf += XkbPaddedSize(nKeyActs);
|
||||||
|
|
||||||
actDesc = (XkbAnyAction *) buf;
|
actDesc = (XkbAnyAction *) buf;
|
||||||
for (i = 0; i < rep->nKeyActs; i++) {
|
for (i = 0; i < nKeyActs; i++) {
|
||||||
if (xkb->server->key_acts[i + rep->firstKeyAct] != 0) {
|
if (xkb->server->key_acts[i + firstKeyAct] != 0) {
|
||||||
unsigned int num;
|
unsigned int num;
|
||||||
|
|
||||||
num = XkbKeyNumActions(xkb, (i + rep->firstKeyAct));
|
num = XkbKeyNumActions(xkb, (i + firstKeyAct));
|
||||||
memcpy((char *) actDesc,
|
memcpy((char *) actDesc,
|
||||||
(char *) XkbKeyActionsPtr(xkb, (i + rep->firstKeyAct)),
|
(char *) XkbKeyActionsPtr(xkb, (i + firstKeyAct)),
|
||||||
num * SIZEOF(xkbActionWireDesc));
|
num * SIZEOF(xkbActionWireDesc));
|
||||||
actDesc += num;
|
actDesc += num;
|
||||||
}
|
}
|
||||||
|
@ -1420,7 +1419,7 @@ XkbSendMap(ClientPtr client, XkbDescPtr xkb, xkbGetMapReply * rep)
|
||||||
if (rep->nKeySyms > 0)
|
if (rep->nKeySyms > 0)
|
||||||
desc = XkbWriteKeySyms(xkb, rep->firstKeySym, rep->nKeySyms, desc, client);
|
desc = XkbWriteKeySyms(xkb, rep->firstKeySym, rep->nKeySyms, desc, client);
|
||||||
if (rep->nKeyActs > 0)
|
if (rep->nKeyActs > 0)
|
||||||
desc = XkbWriteKeyActions(xkb, rep, desc, client);
|
desc = XkbWriteKeyActions(xkb, rep->firstKeyAct, rep->nKeyActs, desc);
|
||||||
if (rep->totalKeyBehaviors > 0)
|
if (rep->totalKeyBehaviors > 0)
|
||||||
desc = XkbWriteKeyBehaviors(xkb, rep, desc, client);
|
desc = XkbWriteKeyBehaviors(xkb, rep, desc, client);
|
||||||
if (rep->virtualMods) {
|
if (rep->virtualMods) {
|
||||||
|
|
Loading…
Reference in New Issue