[PATCH 09/19] Use C99 designated initializers in xkb Replies
Alan Coopersmith
alan.coopersmith at oracle.com
Sun Jun 24 10:25:16 PDT 2012
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
xkb/xkb.c | 525 +++++++++++++++++++++++++++++++------------------------------
1 file changed, 265 insertions(+), 260 deletions(-)
diff --git a/xkb/xkb.c b/xkb/xkb.c
index b21815c..03bd69e 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -157,7 +157,6 @@ int
ProcXkbUseExtension(ClientPtr client)
{
REQUEST(xkbUseExtensionReq);
- xkbUseExtensionReply rep;
int supported;
REQUEST_SIZE_MATCH(xkbUseExtensionReq);
@@ -181,19 +180,22 @@ ProcXkbUseExtension(ClientPtr client)
stuff->wantedMinor, SERVER_XKB_MAJOR_VERSION,
SERVER_XKB_MINOR_VERSION);
}
- memset(&rep, 0, sizeof(xkbUseExtensionReply));
- rep.type = X_Reply;
- rep.supported = supported;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.serverMajor = SERVER_XKB_MAJOR_VERSION;
- rep.serverMinor = SERVER_XKB_MINOR_VERSION;
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swaps(&rep.serverMajor);
- swaps(&rep.serverMinor);
+ {
+ xkbUseExtensionReply rep = {
+ .type = X_Reply,
+ .supported = supported,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .serverMajor = SERVER_XKB_MAJOR_VERSION,
+ .serverMinor = SERVER_XKB_MINOR_VERSION
+ };
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.serverMajor);
+ swaps(&rep.serverMinor);
+ }
+ WriteToClient(client, SIZEOF(xkbUseExtensionReply), &rep);
}
- WriteToClient(client, SIZEOF(xkbUseExtensionReply), &rep);
return Success;
}
@@ -566,8 +568,6 @@ ProcXkbGetState(ClientPtr client)
{
REQUEST(xkbGetStateReq);
DeviceIntPtr dev;
- xkbGetStateReply rep;
- XkbStateRec *xkb;
REQUEST_SIZE_MATCH(xkbGetStateReq);
@@ -576,27 +576,30 @@ ProcXkbGetState(ClientPtr client)
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
- xkb = &dev->key->xkbInfo->state;
- memset(&rep, 0, sizeof(xkbGetStateReply));
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.deviceID = dev->id;
- rep.mods = XkbStateFieldFromRec(xkb) & 0xff;
- rep.baseMods = xkb->base_mods;
- rep.lockedMods = xkb->locked_mods;
- rep.latchedMods = xkb->latched_mods;
- rep.group = xkb->group;
- rep.baseGroup = xkb->base_group;
- rep.latchedGroup = xkb->latched_group;
- rep.lockedGroup = xkb->locked_group;
- rep.compatState = xkb->compat_state;
- rep.ptrBtnState = xkb->ptr_buttons;
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swaps(&rep.ptrBtnState);
+ {
+ XkbStateRec *xkb = &dev->key->xkbInfo->state;
+ xkbGetStateReply rep = {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .mods = XkbStateFieldFromRec(xkb) & 0xff,
+ .baseMods = xkb->base_mods,
+ .latchedMods = xkb->latched_mods,
+ .lockedMods = xkb->locked_mods,
+ .group = xkb->group,
+ .lockedGroup = xkb->locked_group,
+ .baseGroup = xkb->base_group,
+ .latchedGroup = xkb->latched_group,
+ .compatState = xkb->compat_state,
+ .ptrBtnState = xkb->ptr_buttons
+ };
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.ptrBtnState);
+ }
+ WriteToClient(client, SIZEOF(xkbGetStateReply), &rep);
}
- WriteToClient(client, SIZEOF(xkbGetStateReply), &rep);
return Success;
}
@@ -675,8 +678,6 @@ ProcXkbLatchLockState(ClientPtr client)
int
ProcXkbGetControls(ClientPtr client)
{
- xkbGetControlsReply rep;
- XkbControlsPtr xkb;
DeviceIntPtr dev;
REQUEST(xkbGetControlsReq);
@@ -687,61 +688,65 @@ ProcXkbGetControls(ClientPtr client)
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
- xkb = dev->key->xkbInfo->desc->ctrls;
- rep.type = X_Reply;
- rep.length = bytes_to_int32(SIZEOF(xkbGetControlsReply) -
- SIZEOF(xGenericReply));
- rep.sequenceNumber = client->sequence;
- rep.deviceID = ((DeviceIntPtr) dev)->id;
- rep.numGroups = xkb->num_groups;
- rep.groupsWrap = xkb->groups_wrap;
- rep.internalMods = xkb->internal.mask;
- rep.ignoreLockMods = xkb->ignore_lock.mask;
- rep.internalRealMods = xkb->internal.real_mods;
- rep.ignoreLockRealMods = xkb->ignore_lock.real_mods;
- rep.internalVMods = xkb->internal.vmods;
- rep.ignoreLockVMods = xkb->ignore_lock.vmods;
- rep.enabledCtrls = xkb->enabled_ctrls;
- rep.repeatDelay = xkb->repeat_delay;
- rep.repeatInterval = xkb->repeat_interval;
- rep.slowKeysDelay = xkb->slow_keys_delay;
- rep.debounceDelay = xkb->debounce_delay;
- rep.mkDelay = xkb->mk_delay;
- rep.mkInterval = xkb->mk_interval;
- rep.mkTimeToMax = xkb->mk_time_to_max;
- rep.mkMaxSpeed = xkb->mk_max_speed;
- rep.mkCurve = xkb->mk_curve;
- rep.mkDfltBtn = xkb->mk_dflt_btn;
- rep.axTimeout = xkb->ax_timeout;
- rep.axtCtrlsMask = xkb->axt_ctrls_mask;
- rep.axtCtrlsValues = xkb->axt_ctrls_values;
- rep.axtOptsMask = xkb->axt_opts_mask;
- rep.axtOptsValues = xkb->axt_opts_values;
- rep.axOptions = xkb->ax_options;
- memcpy(rep.perKeyRepeat, xkb->per_key_repeat, XkbPerKeyBitArraySize);
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.internalVMods);
- swaps(&rep.ignoreLockVMods);
- swapl(&rep.enabledCtrls);
- swaps(&rep.repeatDelay);
- swaps(&rep.repeatInterval);
- swaps(&rep.slowKeysDelay);
- swaps(&rep.debounceDelay);
- swaps(&rep.mkDelay);
- swaps(&rep.mkInterval);
- swaps(&rep.mkTimeToMax);
- swaps(&rep.mkMaxSpeed);
- swaps(&rep.mkCurve);
- swaps(&rep.axTimeout);
- swapl(&rep.axtCtrlsMask);
- swapl(&rep.axtCtrlsValues);
- swaps(&rep.axtOptsMask);
- swaps(&rep.axtOptsValues);
- swaps(&rep.axOptions);
- }
- WriteToClient(client, SIZEOF(xkbGetControlsReply), &rep);
+ {
+ XkbControlsPtr xkb = dev->key->xkbInfo->desc->ctrls;
+ xkbGetControlsReply rep = {
+ .type = X_Reply,
+ .deviceID = ((DeviceIntPtr) dev)->id,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(SIZEOF(xkbGetControlsReply) -
+ SIZEOF(xGenericReply)),
+ .mkDfltBtn = xkb->mk_dflt_btn,
+ .numGroups = xkb->num_groups,
+ .groupsWrap = xkb->groups_wrap,
+ .internalMods = xkb->internal.mask,
+ .ignoreLockMods = xkb->ignore_lock.mask,
+ .internalRealMods = xkb->internal.real_mods,
+ .ignoreLockRealMods = xkb->ignore_lock.real_mods,
+ .internalVMods = xkb->internal.vmods,
+ .ignoreLockVMods = xkb->ignore_lock.vmods,
+ .repeatDelay = xkb->repeat_delay,
+ .repeatInterval = xkb->repeat_interval,
+ .slowKeysDelay = xkb->slow_keys_delay,
+ .debounceDelay = xkb->debounce_delay,
+ .mkDelay = xkb->mk_delay,
+ .mkInterval = xkb->mk_interval,
+ .mkTimeToMax = xkb->mk_time_to_max,
+ .mkMaxSpeed = xkb->mk_max_speed,
+ .mkCurve = xkb->mk_curve,
+ .axOptions = xkb->ax_options,
+ .axTimeout = xkb->ax_timeout,
+ .axtOptsMask = xkb->axt_opts_mask,
+ .axtOptsValues = xkb->axt_opts_values,
+ .axtCtrlsMask = xkb->axt_ctrls_mask,
+ .axtCtrlsValues = xkb->axt_ctrls_values,
+ .enabledCtrls = xkb->enabled_ctrls,
+ };
+ memcpy(rep.perKeyRepeat, xkb->per_key_repeat, XkbPerKeyBitArraySize);
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.internalVMods);
+ swaps(&rep.ignoreLockVMods);
+ swapl(&rep.enabledCtrls);
+ swaps(&rep.repeatDelay);
+ swaps(&rep.repeatInterval);
+ swaps(&rep.slowKeysDelay);
+ swaps(&rep.debounceDelay);
+ swaps(&rep.mkDelay);
+ swaps(&rep.mkInterval);
+ swaps(&rep.mkTimeToMax);
+ swaps(&rep.mkMaxSpeed);
+ swaps(&rep.mkCurve);
+ swaps(&rep.axTimeout);
+ swapl(&rep.axtCtrlsMask);
+ swapl(&rep.axtCtrlsValues);
+ swaps(&rep.axtOptsMask);
+ swaps(&rep.axtOptsValues);
+ swaps(&rep.axOptions);
+ }
+ WriteToClient(client, SIZEOF(xkbGetControlsReply), &rep);
+ }
return Success;
}
@@ -1459,14 +1464,16 @@ ProcXkbGetMap(ClientPtr client)
CHK_MASK_LEGAL(0x03, stuff->partial, XkbAllMapComponentsMask);
xkb = dev->key->xkbInfo->desc;
- memset(&rep, 0, sizeof(xkbGetMapReply));
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2;
- rep.deviceID = dev->id;
- rep.present = stuff->partial | stuff->full;
- rep.minKeyCode = xkb->min_key_code;
- rep.maxKeyCode = xkb->max_key_code;
+ rep = (xkbGetMapReply) {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2,
+ .present = stuff->partial | stuff->full,
+ .minKeyCode = xkb->min_key_code,
+ .maxKeyCode = xkb->max_key_code
+ };
+
if (stuff->full & XkbKeyTypesMask) {
rep.firstType = 0;
rep.nTypes = xkb->map->num_types;
@@ -2771,12 +2778,14 @@ ProcXkbGetCompatMap(ClientPtr client)
xkb = dev->key->xkbInfo->desc;
compat = xkb->compat;
- rep.type = X_Reply;
- rep.deviceID = dev->id;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.firstSI = stuff->firstSI;
- rep.nSI = stuff->nSI;
+ rep = (xkbGetCompatMapReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .deviceID = dev->id,
+ .firstSI = stuff->firstSI,
+ .nSI = stuff->nSI
+ };
if (stuff->getAllSI) {
rep.firstSI = 0;
rep.nSI = compat->num_si;
@@ -3017,7 +3026,6 @@ ProcXkbSetCompatMap(ClientPtr client)
int
ProcXkbGetIndicatorState(ClientPtr client)
{
- xkbGetIndicatorStateReply rep;
XkbSrvLedInfoPtr sli;
DeviceIntPtr dev;
@@ -3033,19 +3041,21 @@ ProcXkbGetIndicatorState(ClientPtr client)
XkbXI_IndicatorStateMask);
if (!sli)
return BadAlloc;
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.deviceID = dev->id;
- rep.state = sli->effectiveState;
-
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.state);
+ else {
+ xkbGetIndicatorStateReply rep = {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .state = sli->effectiveState
+ };
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.state);
+ }
+ WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), &rep);
+ return Success;
}
- WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), &rep);
- return Success;
}
/***====================================================================***/
@@ -3129,10 +3139,7 @@ XkbSendIndicatorMap(ClientPtr client,
int
ProcXkbGetIndicatorMap(ClientPtr client)
{
- xkbGetIndicatorMapReply rep;
DeviceIntPtr dev;
- XkbDescPtr xkb;
- XkbIndicatorPtr leds;
REQUEST(xkbGetIndicatorMapReq);
REQUEST_SIZE_MATCH(xkbGetIndicatorMapReq);
@@ -3142,16 +3149,20 @@ ProcXkbGetIndicatorMap(ClientPtr client)
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
- xkb = dev->key->xkbInfo->desc;
- leds = xkb->indicators;
+ {
+ XkbDescPtr xkb = dev->key->xkbInfo->desc;
+ XkbIndicatorPtr leds = xkb->indicators;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.deviceID = dev->id;
- rep.which = stuff->which;
- XkbComputeGetIndicatorMapReplySize(leds, &rep);
- return XkbSendIndicatorMap(client, leds, &rep);
+ xkbGetIndicatorMapReply rep = {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .which = stuff->which
+ };
+ XkbComputeGetIndicatorMapReplySize(leds, &rep);
+ return XkbSendIndicatorMap(client, leds, &rep);
+ }
}
/**
@@ -3300,11 +3311,13 @@ ProcXkbGetNamedIndicator(ClientPtr client)
}
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.deviceID = dev->id;
- rep.indicator = stuff->indicator;
+ rep = (xkbGetNamedIndicatorReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .deviceID = dev->id,
+ .indicator = stuff->indicator
+ };
if (map != NULL) {
rep.found = TRUE;
rep.on = ((sli->effectiveState & (1 << i)) != 0);
@@ -3867,8 +3880,6 @@ int
ProcXkbGetNames(ClientPtr client)
{
DeviceIntPtr dev;
- XkbDescPtr xkb;
- xkbGetNamesReply rep;
REQUEST(xkbGetNamesReq);
REQUEST_SIZE_MATCH(xkbGetNamesReq);
@@ -3879,25 +3890,23 @@ ProcXkbGetNames(ClientPtr client)
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
CHK_MASK_LEGAL(0x01, stuff->which, XkbAllNamesMask);
- xkb = dev->key->xkbInfo->desc;
- memset(&rep, 0, sizeof(xkbGetNamesReply));
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.deviceID = dev->id;
- rep.which = stuff->which;
- rep.nTypes = xkb->map->num_types;
- rep.firstKey = xkb->min_key_code;
- rep.nKeys = XkbNumKeys(xkb);
- if (xkb->names != NULL) {
- rep.nKeyAliases = xkb->names->num_key_aliases;
- rep.nRadioGroups = xkb->names->num_rg;
+ {
+ XkbDescPtr xkb = dev->key->xkbInfo->desc;
+ xkbGetNamesReply rep = {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .which = stuff->which,
+ .nTypes = xkb->map->num_types,
+ .firstKey = xkb->min_key_code,
+ .nKeys = XkbNumKeys(xkb),
+ .nKeyAliases = xkb->names ? xkb->names->num_key_aliases : 0,
+ .nRadioGroups = xkb->names ? xkb->names->num_rg : 0
+ };
+ XkbComputeGetNamesReplySize(xkb, &rep);
+ return XkbSendNames(client, xkb, &rep);
}
- else {
- rep.nKeyAliases = rep.nRadioGroups = 0;
- }
- XkbComputeGetNamesReplySize(xkb, &rep);
- return XkbSendNames(client, xkb, &rep);
}
/***====================================================================***/
@@ -4918,10 +4927,7 @@ int
ProcXkbGetGeometry(ClientPtr client)
{
DeviceIntPtr dev;
- xkbGetGeometryReply rep;
- XkbGeometryPtr geom;
Bool shouldFree;
- Status status;
REQUEST(xkbGetGeometryReq);
REQUEST_SIZE_MATCH(xkbGetGeometryReq);
@@ -4932,16 +4938,21 @@ ProcXkbGetGeometry(ClientPtr client)
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, DixGetAttrAccess);
CHK_ATOM_OR_NONE(stuff->name);
- geom = XkbLookupNamedGeometry(dev, stuff->name, &shouldFree);
- rep.type = X_Reply;
- rep.deviceID = dev->id;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- status = XkbComputeGetGeometryReplySize(geom, &rep, stuff->name);
- if (status != Success)
- return status;
- else
- return XkbSendGeometry(client, geom, &rep, shouldFree);
+ {
+ XkbGeometryPtr geom =
+ XkbLookupNamedGeometry(dev, stuff->name, &shouldFree);
+ xkbGetGeometryReply rep = {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
+ Status status = XkbComputeGetGeometryReplySize(geom, &rep, stuff->name);
+ if (status != Success)
+ return status;
+ else
+ return XkbSendGeometry(client, geom, &rep, shouldFree);
+ }
}
/***====================================================================***/
@@ -5468,7 +5479,6 @@ int
ProcXkbPerClientFlags(ClientPtr client)
{
DeviceIntPtr dev;
- xkbPerClientFlagsReply rep;
XkbInterestPtr interest;
Mask access_mode = DixGetAttrAccess | DixSetAttrAccess;
@@ -5483,10 +5493,6 @@ ProcXkbPerClientFlags(ClientPtr client)
CHK_MASK_MATCH(0x02, stuff->change, stuff->value);
interest = XkbFindClientResource((DevicePtr) dev, client);
- memset(&rep, 0, sizeof(xkbPerClientFlagsReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
if (stuff->change) {
client->xkbClientFlags &= ~stuff->change;
client->xkbClientFlags |= stuff->value;
@@ -5522,23 +5528,26 @@ ProcXkbPerClientFlags(ClientPtr client)
interest->autoCtrlValues |= stuff->autoCtrlValues & affect;
}
}
- rep.supported = XkbPCF_AllFlagsMask;
- rep.value = client->xkbClientFlags & XkbPCF_AllFlagsMask;
- if (interest) {
- rep.autoCtrls = interest->autoCtrls;
- rep.autoCtrlValues = interest->autoCtrlValues;
- }
- else {
- rep.autoCtrls = rep.autoCtrlValues = 0;
- }
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.supported);
- swapl(&rep.value);
- swapl(&rep.autoCtrls);
- swapl(&rep.autoCtrlValues);
+
+ {
+ xkbPerClientFlagsReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .supported = XkbPCF_AllFlagsMask,
+ .value = client->xkbClientFlags & XkbPCF_AllFlagsMask,
+ .autoCtrls = interest ? interest->autoCtrls : 0,
+ .autoCtrlValues = interest ? interest->autoCtrlValues : 0,
+ };
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.supported);
+ swapl(&rep.value);
+ swapl(&rep.autoCtrls);
+ swapl(&rep.autoCtrlValues);
+ }
+ WriteToClient(client, SIZEOF(xkbPerClientFlagsReply), &rep);
}
- WriteToClient(client, SIZEOF(xkbPerClientFlagsReply), &rep);
return Success;
}
@@ -5609,7 +5618,6 @@ int
ProcXkbListComponents(ClientPtr client)
{
DeviceIntPtr dev;
- xkbListComponentsReply rep;
unsigned len;
int status;
unsigned char *str;
@@ -5642,32 +5650,34 @@ ProcXkbListComponents(ClientPtr client)
list.pool = NULL;
return status;
}
- memset(&rep, 0, sizeof(xkbListComponentsReply));
- rep.type = X_Reply;
- rep.deviceID = dev->id;
- rep.sequenceNumber = client->sequence;
- rep.length = XkbPaddedSize(list.nPool) / 4;
- rep.nKeymaps = 0;
- rep.nKeycodes = list.nFound[_XkbListKeycodes];
- rep.nTypes = list.nFound[_XkbListTypes];
- rep.nCompatMaps = list.nFound[_XkbListCompat];
- rep.nSymbols = list.nFound[_XkbListSymbols];
- rep.nGeometries = list.nFound[_XkbListGeometry];
- rep.extra = 0;
- if (list.nTotal > list.maxRtrn)
- rep.extra = (list.nTotal - list.maxRtrn);
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.length);
- swaps(&rep.nKeymaps);
- swaps(&rep.nKeycodes);
- swaps(&rep.nTypes);
- swaps(&rep.nCompatMaps);
- swaps(&rep.nSymbols);
- swaps(&rep.nGeometries);
- swaps(&rep.extra);
- }
- WriteToClient(client, SIZEOF(xkbListComponentsReply), &rep);
+ else {
+ xkbListComponentsReply rep = {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = XkbPaddedSize(list.nPool) / 4,
+ .nKeymaps = 0,
+ .nKeycodes = list.nFound[_XkbListKeycodes],
+ .nTypes = list.nFound[_XkbListTypes],
+ .nCompatMaps = list.nFound[_XkbListCompat],
+ .nSymbols = list.nFound[_XkbListSymbols],
+ .nGeometries = list.nFound[_XkbListGeometry],
+ .extra = (list.nTotal > list.maxRtrn) ?
+ (list.nTotal - list.maxRtrn) : 0
+ };
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.nKeymaps);
+ swaps(&rep.nKeycodes);
+ swaps(&rep.nTypes);
+ swaps(&rep.nCompatMaps);
+ swaps(&rep.nSymbols);
+ swaps(&rep.nGeometries);
+ swaps(&rep.extra);
+ }
+ WriteToClient(client, SIZEOF(xkbListComponentsReply), &rep);
+ }
if (list.nPool && list.pool) {
WriteToClient(client, XkbPaddedSize(list.nPool), list.pool);
free(list.pool);
@@ -6254,37 +6264,29 @@ ProcXkbGetDeviceInfo(ClientPtr client)
wanted &= ~XkbXI_IndicatorsMask;
nameLen = XkbSizeCountedString(dev->name);
- memset((char *) &rep, 0, SIZEOF(xkbGetDeviceInfoReply));
- rep.type = X_Reply;
- rep.deviceID = dev->id;
- rep.sequenceNumber = client->sequence;
- rep.length = nameLen / 4;
- rep.present = wanted;
- rep.supported = XkbXI_AllDeviceFeaturesMask;
- rep.unsupported = 0;
- rep.firstBtnWanted = rep.nBtnsWanted = 0;
- rep.firstBtnRtrn = rep.nBtnsRtrn = 0;
- if (dev->button)
- rep.totalBtns = dev->button->numButtons;
- else
- rep.totalBtns = 0;
- rep.devType = dev->xinput_type;
- rep.hasOwnState = (dev->key && dev->key->xkbInfo);
- rep.nDeviceLedFBs = 0;
- if (dev->kbdfeed)
- rep.dfltKbdFB = dev->kbdfeed->ctrl.id;
- else
- rep.dfltKbdFB = XkbXINone;
- if (dev->leds)
- rep.dfltLedFB = dev->leds->ctrl.id;
- else
- rep.dfltLedFB = XkbXINone;
+ rep = (xkbGetDeviceInfoReply) {
+ .type = X_Reply,
+ .deviceID = dev->id,
+ .sequenceNumber = client->sequence,
+ .length = nameLen / 4,
+ .present = wanted,
+ .supported = XkbXI_AllDeviceFeaturesMask,
+ .unsupported = 0,
+ .nDeviceLedFBs = 0,
+ .firstBtnWanted = 0,
+ .nBtnsWanted = 0,
+ .firstBtnRtrn = 0,
+ .nBtnsRtrn = 0,
+ .totalBtns = dev->button ? dev->button->numButtons : 0,
+ .hasOwnState = (dev->key && dev->key->xkbInfo),
+ .dfltKbdFB = dev->kbdfeed ? dev->kbdfeed->ctrl.id : XkbXINone,
+ .dfltLedFB = dev->leds ? dev->leds->ctrl.id : XkbXINone,
+ .devType = dev->xinput_type
+ };
ledClass = stuff->ledClass;
ledID = stuff->ledID;
- rep.firstBtnWanted = rep.nBtnsWanted = 0;
- rep.firstBtnRtrn = rep.nBtnsRtrn = 0;
if (wanted & XkbXI_ButtonActionsMask) {
if (stuff->allBtns) {
stuff->firstBtn = 0;
@@ -6704,7 +6706,6 @@ int
ProcXkbSetDebuggingFlags(ClientPtr client)
{
CARD32 newFlags, newCtrls, extraLength;
- xkbSetDebuggingFlagsReply rep;
int rc;
REQUEST(xkbSetDebuggingFlagsReq);
@@ -6746,22 +6747,26 @@ ProcXkbSetDebuggingFlags(ClientPtr client)
xkbDebugFlags = newFlags;
xkbDebugCtrls = newCtrls;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.currentFlags = newFlags;
- rep.currentCtrls = newCtrls;
- rep.supportedFlags = ~0;
- rep.supportedCtrls = ~0;
- if (client->swapped) {
- swaps(&rep.sequenceNumber);
- swapl(&rep.currentFlags);
- swapl(&rep.currentCtrls);
- swapl(&rep.supportedFlags);
- swapl(&rep.supportedCtrls);
+ {
+ xkbSetDebuggingFlagsReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .currentFlags = newFlags,
+ .currentCtrls = newCtrls,
+ .supportedFlags = ~0,
+ .supportedCtrls = ~0
+ };
+ if (client->swapped) {
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.currentFlags);
+ swapl(&rep.currentCtrls);
+ swapl(&rep.supportedFlags);
+ swapl(&rep.supportedCtrls);
+ }
+ WriteToClient(client, SIZEOF(xkbSetDebuggingFlagsReply), &rep);
+ return Success;
}
- WriteToClient(client, SIZEOF(xkbSetDebuggingFlagsReply), &rep);
- return Success;
}
/***====================================================================***/
--
1.7.9.2
More information about the xorg-devel
mailing list