xkb: XkbWriteVirtualModMap(): 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:
Enrico Weigelt, metux IT consult 2024-07-15 19:52:55 +02:00 committed by Enrico Weigelt, metux IT consult .
parent 155d8314a8
commit 4140099d0f

View File

@ -1365,18 +1365,18 @@ XkbSizeVirtualModMap(XkbDescPtr xkb, xkbGetMapReply * rep)
}
static char *
XkbWriteVirtualModMap(XkbDescPtr xkb, xkbGetMapReply * rep, char *buf,
ClientPtr client)
XkbWriteVirtualModMap(XkbDescPtr xkb, KeyCode firstVModMapKey,
CARD8 nVModMapKeys, char *buf)
{
unsigned i;
xkbVModMapWireDesc *wire;
unsigned short *pMap;
wire = (xkbVModMapWireDesc *) buf;
pMap = &xkb->server->vmodmap[rep->firstVModMapKey];
for (i = 0; i < rep->nVModMapKeys; i++, pMap++) {
pMap = &xkb->server->vmodmap[firstVModMapKey];
for (i = 0; i < nVModMapKeys; i++, pMap++) {
if (*pMap != 0) {
wire->key = i + rep->firstVModMapKey;
wire->key = i + firstVModMapKey;
wire->vmods = *pMap;
wire++;
}
@ -1436,7 +1436,7 @@ XkbSendMap(ClientPtr client, XkbDescPtr xkb, xkbGetMapReply * rep)
if (rep->totalModMapKeys > 0)
desc = XkbWriteModifierMap(xkb, rep->firstModMapKey, rep->nModMapKeys, desc);
if (rep->totalVModMapKeys > 0)
desc = XkbWriteVirtualModMap(xkb, rep, desc, client);
desc = XkbWriteVirtualModMap(xkb, rep->firstVModMapKey, rep->nVModMapKeys, desc);
if ((desc - start) != (len)) {
ErrorF
("[xkb] BOGUS LENGTH in write keyboard desc, expected %d, got %ld\n",