xkb: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
71cbcb6f02
commit
1425d94daa
301
xkb/xkb.c
301
xkb/xkb.c
|
@ -202,19 +202,14 @@ ProcXkbUseExtension(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
xkbUseExtensionReply rep = {
|
xkbUseExtensionReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.supported = supported,
|
.supported = supported,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.serverMajor = SERVER_XKB_MAJOR_VERSION,
|
.serverMajor = SERVER_XKB_MAJOR_VERSION,
|
||||||
.serverMinor = SERVER_XKB_MINOR_VERSION
|
.serverMinor = SERVER_XKB_MINOR_VERSION
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD16(serverMajor);
|
||||||
swaps(&rep.serverMajor);
|
REPLY_FIELD_CARD16(serverMinor);
|
||||||
swaps(&rep.serverMinor);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
}
|
|
||||||
WriteToClient(client, SIZEOF(xkbUseExtensionReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
@ -607,9 +602,7 @@ ProcXkbGetState(ClientPtr client)
|
||||||
xkb = &dev->key->xkbInfo->state;
|
xkb = &dev->key->xkbInfo->state;
|
||||||
|
|
||||||
xkbGetStateReply rep = {
|
xkbGetStateReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.deviceID = dev->id,
|
.deviceID = dev->id,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.mods = XkbStateFieldFromRec(xkb) & 0xff,
|
.mods = XkbStateFieldFromRec(xkb) & 0xff,
|
||||||
.baseMods = xkb->base_mods,
|
.baseMods = xkb->base_mods,
|
||||||
.latchedMods = xkb->latched_mods,
|
.latchedMods = xkb->latched_mods,
|
||||||
|
@ -621,12 +614,8 @@ ProcXkbGetState(ClientPtr client)
|
||||||
.compatState = xkb->compat_state,
|
.compatState = xkb->compat_state,
|
||||||
.ptrBtnState = xkb->ptr_buttons
|
.ptrBtnState = xkb->ptr_buttons
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(ptrBtnState);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swaps(&rep.ptrBtnState);
|
|
||||||
}
|
|
||||||
WriteToClient(client, SIZEOF(xkbGetStateReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
@ -719,9 +708,7 @@ ProcXkbGetControls(ClientPtr client)
|
||||||
xkb = dev->key->xkbInfo->desc->ctrls;
|
xkb = dev->key->xkbInfo->desc->ctrls;
|
||||||
|
|
||||||
xkbGetControlsReply rep = {
|
xkbGetControlsReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.deviceID = ((DeviceIntPtr) dev)->id,
|
.deviceID = ((DeviceIntPtr) dev)->id,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = bytes_to_int32(sizeof(xkbGetControlsReply) -
|
.length = bytes_to_int32(sizeof(xkbGetControlsReply) -
|
||||||
sizeof(xGenericReply)),
|
sizeof(xGenericReply)),
|
||||||
.mkDfltBtn = xkb->mk_dflt_btn,
|
.mkDfltBtn = xkb->mk_dflt_btn,
|
||||||
|
@ -751,30 +738,25 @@ ProcXkbGetControls(ClientPtr client)
|
||||||
.enabledCtrls = xkb->enabled_ctrls,
|
.enabledCtrls = xkb->enabled_ctrls,
|
||||||
};
|
};
|
||||||
memcpy(rep.perKeyRepeat, xkb->per_key_repeat, XkbPerKeyBitArraySize);
|
memcpy(rep.perKeyRepeat, xkb->per_key_repeat, XkbPerKeyBitArraySize);
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(internalVMods);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD16(ignoreLockVMods);
|
||||||
swapl(&rep.length);
|
REPLY_FIELD_CARD32(enabledCtrls);
|
||||||
swaps(&rep.internalVMods);
|
REPLY_FIELD_CARD16(repeatDelay);
|
||||||
swaps(&rep.ignoreLockVMods);
|
REPLY_FIELD_CARD16(repeatInterval);
|
||||||
swapl(&rep.enabledCtrls);
|
REPLY_FIELD_CARD16(slowKeysDelay);
|
||||||
swaps(&rep.repeatDelay);
|
REPLY_FIELD_CARD16(debounceDelay);
|
||||||
swaps(&rep.repeatInterval);
|
REPLY_FIELD_CARD16(mkDelay);
|
||||||
swaps(&rep.slowKeysDelay);
|
REPLY_FIELD_CARD16(mkInterval);
|
||||||
swaps(&rep.debounceDelay);
|
REPLY_FIELD_CARD16(mkTimeToMax);
|
||||||
swaps(&rep.mkDelay);
|
REPLY_FIELD_CARD16(mkMaxSpeed);
|
||||||
swaps(&rep.mkInterval);
|
REPLY_FIELD_CARD16(mkCurve);
|
||||||
swaps(&rep.mkTimeToMax);
|
REPLY_FIELD_CARD16(axTimeout);
|
||||||
swaps(&rep.mkMaxSpeed);
|
REPLY_FIELD_CARD32(axtCtrlsMask);
|
||||||
swaps(&rep.mkCurve);
|
REPLY_FIELD_CARD32(axtCtrlsValues);
|
||||||
swaps(&rep.axTimeout);
|
REPLY_FIELD_CARD16(axtOptsMask);
|
||||||
swapl(&rep.axtCtrlsMask);
|
REPLY_FIELD_CARD16(axtOptsValues);
|
||||||
swapl(&rep.axtCtrlsValues);
|
REPLY_FIELD_CARD16(axOptions);
|
||||||
swaps(&rep.axtOptsMask);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swaps(&rep.axtOptsValues);
|
|
||||||
swaps(&rep.axOptions);
|
|
||||||
}
|
|
||||||
WriteToClient(client, SIZEOF(xkbGetControlsReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1492,10 +1474,7 @@ ProcXkbGetMap(ClientPtr client)
|
||||||
xkb = dev->key->xkbInfo->desc;
|
xkb = dev->key->xkbInfo->desc;
|
||||||
|
|
||||||
xkbGetMapReply rep = {
|
xkbGetMapReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.deviceID = dev->id,
|
.deviceID = dev->id,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = bytes_to_int32(sizeof(xkbGetMapReply) - sizeof(xGenericReply)),
|
|
||||||
.present = stuff->partial | stuff->full,
|
.present = stuff->partial | stuff->full,
|
||||||
.minKeyCode = xkb->min_key_code,
|
.minKeyCode = xkb->min_key_code,
|
||||||
.maxKeyCode = xkb->max_key_code,
|
.maxKeyCode = xkb->max_key_code,
|
||||||
|
@ -1591,16 +1570,10 @@ ProcXkbGetMap(ClientPtr client)
|
||||||
|
|
||||||
XkbAssembleMap(client, xkb, rep, payload_buf);
|
XkbAssembleMap(client, xkb, rep, payload_buf);
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(present);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD16(totalSyms);
|
||||||
swapl(&rep.length);
|
REPLY_FIELD_CARD16(totalActs);
|
||||||
swaps(&rep.present);
|
REPLY_SEND_EXTRA(payload_buf, payload_len);
|
||||||
swaps(&rep.totalSyms);
|
|
||||||
swaps(&rep.totalActs);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xkbGetMapReply), &rep);
|
|
||||||
WriteToClient(client, payload_len, payload_buf);
|
|
||||||
free(payload_buf);
|
free(payload_buf);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
@ -2905,8 +2878,6 @@ ProcXkbGetCompatMap(ClientPtr client)
|
||||||
compat = xkb->compat;
|
compat = xkb->compat;
|
||||||
|
|
||||||
xkbGetCompatMapReply rep = {
|
xkbGetCompatMapReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.deviceID = dev->id,
|
.deviceID = dev->id,
|
||||||
.firstSI = stuff->firstSI,
|
.firstSI = stuff->firstSI,
|
||||||
.nSI = stuff->nSI,
|
.nSI = stuff->nSI,
|
||||||
|
@ -2931,16 +2902,10 @@ ProcXkbGetCompatMap(ClientPtr client)
|
||||||
|
|
||||||
XkbAssembleCompatMap(client, compat, rep, buf);
|
XkbAssembleCompatMap(client, compat, rep, buf);
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(firstSI);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD16(nSI);
|
||||||
swapl(&rep.length);
|
REPLY_FIELD_CARD16(nTotalSI);
|
||||||
swaps(&rep.firstSI);
|
REPLY_SEND_EXTRA(buf, sz);
|
||||||
swaps(&rep.nSI);
|
|
||||||
swaps(&rep.nTotalSI);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xkbGetCompatMapReply), &rep);
|
|
||||||
WriteToClient(client, sz, buf);
|
|
||||||
free(buf);
|
free(buf);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
@ -3185,18 +3150,12 @@ ProcXkbGetIndicatorState(ClientPtr client)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
xkbGetIndicatorStateReply rep = {
|
xkbGetIndicatorStateReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.deviceID = dev->id,
|
.deviceID = dev->id,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.state = sli->effectiveState
|
.state = sli->effectiveState
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD32(state);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swapl(&rep.state);
|
|
||||||
}
|
|
||||||
WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
@ -3271,9 +3230,7 @@ ProcXkbGetIndicatorMap(ClientPtr client)
|
||||||
leds = xkb->indicators;
|
leds = xkb->indicators;
|
||||||
|
|
||||||
xkbGetIndicatorMapReply rep = {
|
xkbGetIndicatorMapReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.deviceID = dev->id,
|
.deviceID = dev->id,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.which = stuff->which
|
.which = stuff->which
|
||||||
};
|
};
|
||||||
XkbComputeGetIndicatorMapReplySize(leds, &rep);
|
XkbComputeGetIndicatorMapReplySize(leds, &rep);
|
||||||
|
@ -3285,15 +3242,9 @@ ProcXkbGetIndicatorMap(ClientPtr client)
|
||||||
|
|
||||||
XkbAssembleIndicatorMap(client, leds, rep, buf);
|
XkbAssembleIndicatorMap(client, leds, rep, buf);
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD32(which);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD32(realIndicators);
|
||||||
swapl(&rep.length);
|
REPLY_SEND_EXTRA(buf, sz);
|
||||||
swapl(&rep.which);
|
|
||||||
swapl(&rep.realIndicators);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xkbGetIndicatorMapReply), &rep);
|
|
||||||
WriteToClient(client, sz, buf);
|
|
||||||
free(buf);
|
free(buf);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
@ -3447,8 +3398,6 @@ ProcXkbGetNamedIndicator(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
xkbGetNamedIndicatorReply rep = {
|
xkbGetNamedIndicatorReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.deviceID = dev->id,
|
.deviceID = dev->id,
|
||||||
.indicator = stuff->indicator,
|
.indicator = stuff->indicator,
|
||||||
.supported = TRUE,
|
.supported = TRUE,
|
||||||
|
@ -3468,16 +3417,11 @@ ProcXkbGetNamedIndicator(ClientPtr client)
|
||||||
rep.virtualMods = map->mods.vmods;
|
rep.virtualMods = map->mods.vmods;
|
||||||
rep.ctrls = map->ctrls;
|
rep.ctrls = map->ctrls;
|
||||||
}
|
}
|
||||||
if (client->swapped) {
|
|
||||||
swapl(&rep.length);
|
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.indicator);
|
|
||||||
swaps(&rep.virtualMods);
|
|
||||||
swapl(&rep.ctrls);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, SIZEOF(xkbGetNamedIndicatorReply), &rep);
|
REPLY_FIELD_CARD32(indicator);
|
||||||
return Success;
|
REPLY_FIELD_CARD16(virtualMods);
|
||||||
|
REPLY_FIELD_CARD32(ctrls);
|
||||||
|
REPLY_SEND_RET_SUCCESS();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3955,9 +3899,7 @@ ProcXkbGetNames(ClientPtr client)
|
||||||
xkb = dev->key->xkbInfo->desc;
|
xkb = dev->key->xkbInfo->desc;
|
||||||
|
|
||||||
xkbGetNamesReply rep = {
|
xkbGetNamesReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.deviceID = dev->id,
|
.deviceID = dev->id,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.which = stuff->which,
|
.which = stuff->which,
|
||||||
.nTypes = xkb->map->num_types,
|
.nTypes = xkb->map->num_types,
|
||||||
.firstKey = xkb->min_key_code,
|
.firstKey = xkb->min_key_code,
|
||||||
|
@ -3974,16 +3916,10 @@ ProcXkbGetNames(ClientPtr client)
|
||||||
|
|
||||||
XkbAssembleNames(client, xkb, rep, payload_buf);
|
XkbAssembleNames(client, xkb, rep, payload_buf);
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD32(which);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD16(virtualMods);
|
||||||
swapl(&rep.length);
|
REPLY_FIELD_CARD32(indicators);
|
||||||
swapl(&rep.which);
|
REPLY_SEND_EXTRA(payload_buf, sz);
|
||||||
swaps(&rep.virtualMods);
|
|
||||||
swapl(&rep.indicators);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(rep), &rep);
|
|
||||||
WriteToClient(client, sz, payload_buf);
|
|
||||||
free(payload_buf);
|
free(payload_buf);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
@ -5023,9 +4959,7 @@ ProcXkbGetGeometry(ClientPtr client)
|
||||||
geom = XkbLookupNamedGeometry(dev, stuff->name, &shouldFree);
|
geom = XkbLookupNamedGeometry(dev, stuff->name, &shouldFree);
|
||||||
|
|
||||||
xkbGetGeometryReply rep = {
|
xkbGetGeometryReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.deviceID = dev->id,
|
.deviceID = dev->id,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
};
|
||||||
status = XkbComputeGetGeometryReplySize(geom, &rep, stuff->name);
|
status = XkbComputeGetGeometryReplySize(geom, &rep, stuff->name);
|
||||||
if (status != Success)
|
if (status != Success)
|
||||||
|
@ -5040,22 +4974,16 @@ ProcXkbGetGeometry(ClientPtr client)
|
||||||
|
|
||||||
XkbAssembleGeometry(client, geom, rep, buf);
|
XkbAssembleGeometry(client, geom, rep, buf);
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD32(name);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD16(widthMM);
|
||||||
swapl(&rep.length);
|
REPLY_FIELD_CARD16(heightMM);
|
||||||
swapl(&rep.name);
|
REPLY_FIELD_CARD16(nProperties);
|
||||||
swaps(&rep.widthMM);
|
REPLY_FIELD_CARD16(nColors);
|
||||||
swaps(&rep.heightMM);
|
REPLY_FIELD_CARD16(nShapes);
|
||||||
swaps(&rep.nProperties);
|
REPLY_FIELD_CARD16(nSections);
|
||||||
swaps(&rep.nColors);
|
REPLY_FIELD_CARD16(nDoodads);
|
||||||
swaps(&rep.nShapes);
|
REPLY_FIELD_CARD16(nKeyAliases);
|
||||||
swaps(&rep.nSections);
|
REPLY_SEND_EXTRA(buf, len);
|
||||||
swaps(&rep.nDoodads);
|
|
||||||
swaps(&rep.nKeyAliases);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xkbGetGeometryReply), &rep);
|
|
||||||
WriteToClient(client, len, buf);
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
free_out:
|
free_out:
|
||||||
|
@ -5711,22 +5639,17 @@ ProcXkbPerClientFlags(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
xkbPerClientFlagsReply rep = {
|
xkbPerClientFlagsReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.supported = XkbPCF_AllFlagsMask,
|
.supported = XkbPCF_AllFlagsMask,
|
||||||
.value = client->xkbClientFlags & XkbPCF_AllFlagsMask,
|
.value = client->xkbClientFlags & XkbPCF_AllFlagsMask,
|
||||||
.autoCtrls = interest ? interest->autoCtrls : 0,
|
.autoCtrls = interest ? interest->autoCtrls : 0,
|
||||||
.autoCtrlValues = interest ? interest->autoCtrlValues : 0,
|
.autoCtrlValues = interest ? interest->autoCtrlValues : 0,
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD32(supported);
|
||||||
swapl(&rep.supported);
|
REPLY_FIELD_CARD32(value);
|
||||||
swapl(&rep.value);
|
REPLY_FIELD_CARD32(autoCtrls);
|
||||||
swapl(&rep.autoCtrls);
|
REPLY_FIELD_CARD32(autoCtrlValues);
|
||||||
swapl(&rep.autoCtrlValues);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
}
|
|
||||||
WriteToClient(client, SIZEOF(xkbPerClientFlagsReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
@ -5837,16 +5760,10 @@ ProcXkbListComponents(ClientPtr client)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
|
|
||||||
xkbListComponentsReply rep = {
|
xkbListComponentsReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.deviceID = dev->id,
|
.deviceID = dev->id,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swapl(&rep.length);
|
|
||||||
}
|
|
||||||
WriteToClient(client, SIZEOF(xkbListComponentsReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
|
@ -6048,7 +5965,7 @@ ProcXkbGetKbdByName(ClientPtr client)
|
||||||
mrep.nVModMapKeys = XkbNumKeys(new);
|
mrep.nVModMapKeys = XkbNumKeys(new);
|
||||||
}
|
}
|
||||||
XkbComputeGetMapReplySize(new, &mrep);
|
XkbComputeGetMapReplySize(new, &mrep);
|
||||||
payload_length += SIZEOF(xGenericReply) / 4 + mrep.length;
|
payload_length += bytes_to_int32(sizeof(xkbGetMapReply));
|
||||||
}
|
}
|
||||||
if (new->compat == NULL)
|
if (new->compat == NULL)
|
||||||
reported &= ~XkbGBN_CompatMapMask;
|
reported &= ~XkbGBN_CompatMapMask;
|
||||||
|
@ -6107,9 +6024,7 @@ ProcXkbGetKbdByName(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
xkbGetKbdByNameReply rep = {
|
xkbGetKbdByNameReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.deviceID = dev->id,
|
.deviceID = dev->id,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.minKeyCode = xkb->min_key_code,
|
.minKeyCode = xkb->min_key_code,
|
||||||
.maxKeyCode = xkb->max_key_code,
|
.maxKeyCode = xkb->max_key_code,
|
||||||
.reported = reported,
|
.reported = reported,
|
||||||
|
@ -6124,13 +6039,6 @@ ProcXkbGetKbdByName(ClientPtr client)
|
||||||
|
|
||||||
char *payload_walk = payload_buffer;
|
char *payload_walk = payload_buffer;
|
||||||
|
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
swaps(&rep.found);
|
|
||||||
swaps(&rep.reported);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reported & (XkbGBN_SymbolsMask | XkbGBN_TypesMask)) {
|
if (reported & (XkbGBN_SymbolsMask | XkbGBN_TypesMask)) {
|
||||||
char *buf = payload_walk + sizeof(mrep);
|
char *buf = payload_walk + sizeof(mrep);
|
||||||
XkbAssembleMap(client, xkb, mrep, buf);
|
XkbAssembleMap(client, xkb, mrep, buf);
|
||||||
|
@ -6216,8 +6124,9 @@ ProcXkbGetKbdByName(ClientPtr client)
|
||||||
payload_walk = buf + (grep.length * 4) - (sizeof(grep) - sizeof(xGenericReply));
|
payload_walk = buf + (grep.length * 4) - (sizeof(grep) - sizeof(xGenericReply));
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xkbGetKbdByNameReply), &rep);
|
REPLY_FIELD_CARD16(found);
|
||||||
WriteToClient(client, payload_length * 4, payload_buffer);
|
REPLY_FIELD_CARD16(reported);
|
||||||
|
REPLY_SEND_EXTRA(payload_buffer, payload_length * 4);
|
||||||
|
|
||||||
free(payload_buffer);
|
free(payload_buffer);
|
||||||
|
|
||||||
|
@ -6386,7 +6295,8 @@ static int
|
||||||
FillDeviceLedInfo(XkbSrvLedInfoPtr sli, char *buffer, ClientPtr client)
|
FillDeviceLedInfo(XkbSrvLedInfoPtr sli, char *buffer, ClientPtr client)
|
||||||
{
|
{
|
||||||
int length = 0;
|
int length = 0;
|
||||||
xkbDeviceLedsWireDesc wire = {
|
|
||||||
|
xkbDeviceLedsWireDesc rep = {
|
||||||
.ledClass = sli->class,
|
.ledClass = sli->class,
|
||||||
.ledID = sli->id,
|
.ledID = sli->id,
|
||||||
.namesPresent = sli->namesPresent,
|
.namesPresent = sli->namesPresent,
|
||||||
|
@ -6395,18 +6305,16 @@ FillDeviceLedInfo(XkbSrvLedInfoPtr sli, char *buffer, ClientPtr client)
|
||||||
.state = sli->effectiveState,
|
.state = sli->effectiveState,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD16(ledClass);
|
||||||
swaps(&wire.ledClass);
|
REPLY_FIELD_CARD16(ledID);
|
||||||
swaps(&wire.ledID);
|
REPLY_FIELD_CARD32(namesPresent);
|
||||||
swapl(&wire.namesPresent);
|
REPLY_FIELD_CARD32(mapsPresent);
|
||||||
swapl(&wire.mapsPresent);
|
REPLY_FIELD_CARD32(physIndicators);
|
||||||
swapl(&wire.physIndicators);
|
REPLY_FIELD_CARD32(state);
|
||||||
swapl(&wire.state);
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(buffer, &wire, sizeof(wire));
|
memcpy(buffer, &rep, sizeof(rep));
|
||||||
buffer += sizeof(wire);
|
buffer += sizeof(rep);
|
||||||
length += sizeof(wire);
|
length += sizeof(rep);
|
||||||
|
|
||||||
if (sli->namesPresent | sli->mapsPresent) {
|
if (sli->namesPresent | sli->mapsPresent) {
|
||||||
register unsigned i, bit;
|
register unsigned i, bit;
|
||||||
|
@ -6416,9 +6324,7 @@ FillDeviceLedInfo(XkbSrvLedInfoPtr sli, char *buffer, ClientPtr client)
|
||||||
if (sli->namesPresent & bit) {
|
if (sli->namesPresent & bit) {
|
||||||
CARD32 *val = (CARD32*)buffer;
|
CARD32 *val = (CARD32*)buffer;
|
||||||
*val = sli->names[i];
|
*val = sli->names[i];
|
||||||
if (client->swapped) {
|
REPLY_BUF_CARD32(val, 1);
|
||||||
swapl(val);
|
|
||||||
}
|
|
||||||
length += sizeof(CARD32);
|
length += sizeof(CARD32);
|
||||||
buffer += sizeof(CARD32);
|
buffer += sizeof(CARD32);
|
||||||
}
|
}
|
||||||
|
@ -6530,9 +6436,7 @@ ProcXkbGetDeviceInfo(ClientPtr client)
|
||||||
nameLen = XkbSizeCountedString(dev->name);
|
nameLen = XkbSizeCountedString(dev->name);
|
||||||
|
|
||||||
xkbGetDeviceInfoReply rep = {
|
xkbGetDeviceInfoReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.deviceID = dev->id,
|
.deviceID = dev->id,
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = bytes_to_int32(nameLen),
|
.length = bytes_to_int32(nameLen),
|
||||||
.present = wanted,
|
.present = wanted,
|
||||||
.supported = XkbXI_AllDeviceFeaturesMask,
|
.supported = XkbXI_AllDeviceFeaturesMask,
|
||||||
|
@ -6598,18 +6502,6 @@ ProcXkbGetDeviceInfo(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
length = rep.length * 4;
|
length = rep.length * 4;
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
swaps(&rep.present);
|
|
||||||
swaps(&rep.supported);
|
|
||||||
swaps(&rep.unsupported);
|
|
||||||
swaps(&rep.nDeviceLedFBs);
|
|
||||||
swaps(&rep.dfltKbdFB);
|
|
||||||
swaps(&rep.dfltLedFB);
|
|
||||||
swapl(&rep.devType);
|
|
||||||
}
|
|
||||||
WriteToClient(client, SIZEOF(xkbGetDeviceInfoReply), &rep);
|
|
||||||
|
|
||||||
int sz = nameLen + rep.nBtnsRtrn * sizeof(xkbActionWireDesc) + led_len;
|
int sz = nameLen + rep.nBtnsRtrn * sizeof(xkbActionWireDesc) + led_len;
|
||||||
char *buf = calloc(1, sz);
|
char *buf = calloc(1, sz);
|
||||||
|
@ -6641,7 +6533,16 @@ ProcXkbGetDeviceInfo(ClientPtr client)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteToClient(client, sizeof(buf), &buf);
|
REPLY_FIELD_CARD16(present);
|
||||||
|
REPLY_FIELD_CARD16(supported);
|
||||||
|
REPLY_FIELD_CARD16(unsupported);
|
||||||
|
REPLY_FIELD_CARD16(nDeviceLedFBs);
|
||||||
|
REPLY_FIELD_CARD16(dfltKbdFB);
|
||||||
|
REPLY_FIELD_CARD16(dfltLedFB);
|
||||||
|
REPLY_FIELD_CARD32(devType);
|
||||||
|
REPLY_SEND_EXTRA(buf, sz);
|
||||||
|
free(buf);
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6694,9 +6595,8 @@ CheckSetDeviceIndicators(char *wire,
|
||||||
return (char *) atomWire;
|
return (char *) atomWire;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_BUF_CARD32(atomWire, 1);
|
||||||
swapl(atomWire);
|
|
||||||
}
|
|
||||||
CHK_ATOM_OR_NONE3(((Atom) (*atomWire)), client->errorValue,
|
CHK_ATOM_OR_NONE3(((Atom) (*atomWire)), client->errorValue,
|
||||||
*status_rtrn, NULL);
|
*status_rtrn, NULL);
|
||||||
atomWire++;
|
atomWire++;
|
||||||
|
@ -7042,22 +6942,17 @@ ProcXkbSetDebuggingFlags(ClientPtr client)
|
||||||
xkbDebugCtrls = newCtrls;
|
xkbDebugCtrls = newCtrls;
|
||||||
|
|
||||||
xkbSetDebuggingFlagsReply rep = {
|
xkbSetDebuggingFlagsReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.currentFlags = newFlags,
|
.currentFlags = newFlags,
|
||||||
.currentCtrls = newCtrls,
|
.currentCtrls = newCtrls,
|
||||||
.supportedFlags = ~0,
|
.supportedFlags = ~0,
|
||||||
.supportedCtrls = ~0
|
.supportedCtrls = ~0
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD32(currentFlags);
|
||||||
swapl(&rep.currentFlags);
|
REPLY_FIELD_CARD32(currentCtrls);
|
||||||
swapl(&rep.currentCtrls);
|
REPLY_FIELD_CARD32(supportedFlags);
|
||||||
swapl(&rep.supportedFlags);
|
REPLY_FIELD_CARD32(supportedCtrls);
|
||||||
swapl(&rep.supportedCtrls);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
}
|
|
||||||
WriteToClient(client, SIZEOF(xkbSetDebuggingFlagsReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
Loading…
Reference in New Issue