Xi: use static reply struct init on declaration
Make the code a bit easier to read by using initialization of the reply structs, at the point of declaration. Most of them aren't written to later, just passed into WriteReplyToClient(). Also dropping some useless zero assignments (struct initializers automatically zero-out unmentioned fields). Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
8d47dc3b57
commit
1dbd46b21b
|
@ -127,7 +127,6 @@ ProcXChangeDeviceControl(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
xChangeDeviceControlReply rep = {
|
xChangeDeviceControlReply rep = {
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_ChangeDeviceControl,
|
.RepType = X_ChangeDeviceControl,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.status = Success,
|
.status = Success,
|
||||||
|
|
|
@ -264,7 +264,6 @@ ProcXGetFeedbackControl(ClientPtr client)
|
||||||
.repType = X_Reply,
|
.repType = X_Reply,
|
||||||
.RepType = X_GetFeedbackControl,
|
.RepType = X_GetFeedbackControl,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.num_feedbacks = 0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (k = dev->kbdfeed; k; k = k->next) {
|
for (k = dev->kbdfeed; k; k = k->next) {
|
||||||
|
|
|
@ -82,15 +82,16 @@ ProcXGetDeviceFocus(ClientPtr client)
|
||||||
if (!dev->focus)
|
if (!dev->focus)
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
|
|
||||||
|
focus = dev->focus;
|
||||||
|
|
||||||
xGetDeviceFocusReply rep = {
|
xGetDeviceFocusReply rep = {
|
||||||
.repType = X_Reply,
|
.repType = X_Reply,
|
||||||
.RepType = X_GetDeviceFocus,
|
.RepType = X_GetDeviceFocus,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0
|
.time = focus->time.milliseconds,
|
||||||
|
.revertTo = focus->revert,
|
||||||
};
|
};
|
||||||
|
|
||||||
focus = dev->focus;
|
|
||||||
|
|
||||||
if (focus->win == NoneWin)
|
if (focus->win == NoneWin)
|
||||||
rep.focus = None;
|
rep.focus = None;
|
||||||
else if (focus->win == PointerRootWin)
|
else if (focus->win == PointerRootWin)
|
||||||
|
@ -100,9 +101,6 @@ ProcXGetDeviceFocus(ClientPtr client)
|
||||||
else
|
else
|
||||||
rep.focus = focus->win->drawable.id;
|
rep.focus = focus->win->drawable.id;
|
||||||
|
|
||||||
rep.time = focus->time.milliseconds;
|
|
||||||
rep.revertTo = focus->revert;
|
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
|
|
|
@ -88,7 +88,7 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
|
||||||
.RepType = X_GetDeviceModifierMapping,
|
.RepType = X_GetDeviceModifierMapping,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.numKeyPerModifier = max_keys_per_mod,
|
.numKeyPerModifier = max_keys_per_mod,
|
||||||
/* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
|
/* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
|
||||||
.length = max_keys_per_mod << 1
|
.length = max_keys_per_mod << 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -103,8 +103,6 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
|
||||||
.repType = X_Reply,
|
.repType = X_Reply,
|
||||||
.RepType = X_GetDeviceDontPropagateList,
|
.RepType = X_GetDeviceDontPropagateList,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0,
|
|
||||||
.count = 0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
|
|
|
@ -104,9 +104,6 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
|
||||||
.repType = X_Reply,
|
.repType = X_Reply,
|
||||||
.RepType = X_GetSelectedExtensionEvents,
|
.RepType = X_GetSelectedExtensionEvents,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0,
|
|
||||||
.this_client_count = 0,
|
|
||||||
.all_clients_count = 0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
|
|
|
@ -97,7 +97,6 @@ ProcXGetExtensionVersion(ClientPtr client)
|
||||||
.repType = X_Reply,
|
.repType = X_Reply,
|
||||||
.RepType = X_GetExtensionVersion,
|
.RepType = X_GetExtensionVersion,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0,
|
|
||||||
.major_version = XIVersion.major_version,
|
.major_version = XIVersion.major_version,
|
||||||
.minor_version = XIVersion.minor_version,
|
.minor_version = XIVersion.minor_version,
|
||||||
.present = TRUE
|
.present = TRUE
|
||||||
|
|
|
@ -115,7 +115,6 @@ ProcXGrabDevice(ClientPtr client)
|
||||||
.repType = X_Reply,
|
.repType = X_Reply,
|
||||||
.RepType = X_GrabDevice,
|
.RepType = X_GrabDevice,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
||||||
|
|
|
@ -100,7 +100,6 @@ ProcXGrabDeviceButton(ClientPtr client)
|
||||||
DeviceIntPtr mdev;
|
DeviceIntPtr mdev;
|
||||||
XEventClass *class;
|
XEventClass *class;
|
||||||
struct tmask tmp[EMASKSIZE];
|
struct tmask tmp[EMASKSIZE];
|
||||||
GrabParameters param;
|
|
||||||
GrabMask mask;
|
GrabMask mask;
|
||||||
|
|
||||||
REQUEST(xGrabDeviceButtonReq);
|
REQUEST(xGrabDeviceButtonReq);
|
||||||
|
@ -136,7 +135,7 @@ ProcXGrabDeviceButton(ClientPtr client)
|
||||||
X_GrabDeviceButton)) != Success)
|
X_GrabDeviceButton)) != Success)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
param = (GrabParameters) {
|
GrabParameters param = {
|
||||||
.grabtype = XI,
|
.grabtype = XI,
|
||||||
.ownerEvents = stuff->ownerEvents,
|
.ownerEvents = stuff->ownerEvents,
|
||||||
.this_device_mode = stuff->this_device_mode,
|
.this_device_mode = stuff->this_device_mode,
|
||||||
|
|
|
@ -98,7 +98,6 @@ ProcXGrabDeviceKey(ClientPtr client)
|
||||||
DeviceIntPtr mdev;
|
DeviceIntPtr mdev;
|
||||||
XEventClass *class;
|
XEventClass *class;
|
||||||
struct tmask tmp[EMASKSIZE];
|
struct tmask tmp[EMASKSIZE];
|
||||||
GrabParameters param;
|
|
||||||
GrabMask mask;
|
GrabMask mask;
|
||||||
|
|
||||||
REQUEST(xGrabDeviceKeyReq);
|
REQUEST(xGrabDeviceKeyReq);
|
||||||
|
@ -134,7 +133,7 @@ ProcXGrabDeviceKey(ClientPtr client)
|
||||||
X_GrabDeviceKey)) != Success)
|
X_GrabDeviceKey)) != Success)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
param = (GrabParameters) {
|
GrabParameters param = {
|
||||||
.grabtype = XI,
|
.grabtype = XI,
|
||||||
.ownerEvents = stuff->ownerEvents,
|
.ownerEvents = stuff->ownerEvents,
|
||||||
.this_device_mode = stuff->this_device_mode,
|
.this_device_mode = stuff->this_device_mode,
|
||||||
|
|
17
Xi/listdev.c
17
Xi/listdev.c
|
@ -327,13 +327,6 @@ ProcXListInputDevices(ClientPtr client)
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xListInputDevicesReq);
|
REQUEST_SIZE_MATCH(xListInputDevicesReq);
|
||||||
|
|
||||||
xListInputDevicesReply rep = {
|
|
||||||
.repType = X_Reply,
|
|
||||||
.RepType = X_ListInputDevices,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
/* allocate space for saving skip value */
|
/* allocate space for saving skip value */
|
||||||
skip = calloc(inputInfo.numDevices, sizeof(Bool));
|
skip = calloc(inputInfo.numDevices, sizeof(Bool));
|
||||||
if (!skip)
|
if (!skip)
|
||||||
|
@ -382,8 +375,14 @@ ProcXListInputDevices(ClientPtr client)
|
||||||
|
|
||||||
ListDeviceInfo(client, d, dev++, &devbuf, &classbuf, &namebuf);
|
ListDeviceInfo(client, d, dev++, &devbuf, &classbuf, &namebuf);
|
||||||
}
|
}
|
||||||
rep.ndevices = numdevs;
|
|
||||||
rep.length = bytes_to_int32(total_length);
|
xListInputDevicesReply rep = {
|
||||||
|
.repType = X_Reply,
|
||||||
|
.RepType = X_ListInputDevices,
|
||||||
|
.sequenceNumber = client->sequence,
|
||||||
|
.ndevices = numdevs,
|
||||||
|
.length = bytes_to_int32(total_length),
|
||||||
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
|
|
|
@ -82,7 +82,6 @@ ProcXSetDeviceMode(ClientPtr client)
|
||||||
.repType = X_Reply,
|
.repType = X_Reply,
|
||||||
.RepType = X_SetDeviceMode,
|
.RepType = X_SetDeviceMode,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
|
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
|
||||||
|
|
|
@ -78,7 +78,6 @@ ProcXIGetClientPointer(ClientPtr client)
|
||||||
.repType = X_Reply,
|
.repType = X_Reply,
|
||||||
.RepType = X_XIGetClientPointer,
|
.RepType = X_XIGetClientPointer,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0,
|
|
||||||
.set = (winclient->clientPtr != NULL),
|
.set = (winclient->clientPtr != NULL),
|
||||||
.deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0
|
.deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0
|
||||||
};
|
};
|
||||||
|
|
|
@ -114,7 +114,6 @@ ProcXIQueryDevice(ClientPtr client)
|
||||||
.RepType = X_XIQueryDevice,
|
.RepType = X_XIQueryDevice,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = len / 4,
|
.length = len / 4,
|
||||||
.num_devices = 0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ptr = info;
|
ptr = info;
|
||||||
|
|
|
@ -359,8 +359,6 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||||
.repType = X_Reply,
|
.repType = X_Reply,
|
||||||
.RepType = X_XIGetSelectedEvents,
|
.RepType = X_XIGetSelectedEvents,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0,
|
|
||||||
.num_masks = 0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
masks = wOtherInputMasks(win);
|
masks = wOtherInputMasks(win);
|
||||||
|
|
|
@ -102,7 +102,6 @@ ProcXIGetFocus(ClientPtr client)
|
||||||
.repType = X_Reply,
|
.repType = X_Reply,
|
||||||
.RepType = X_XIGetFocus,
|
.RepType = X_XIGetFocus,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (dev->focus->win == NoneWin)
|
if (dev->focus->win == NoneWin)
|
||||||
|
|
Loading…
Reference in New Issue