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 = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_ChangeDeviceControl,
|
||||
.sequenceNumber = client->sequence,
|
||||
.status = Success,
|
||||
|
|
|
@ -264,7 +264,6 @@ ProcXGetFeedbackControl(ClientPtr client)
|
|||
.repType = X_Reply,
|
||||
.RepType = X_GetFeedbackControl,
|
||||
.sequenceNumber = client->sequence,
|
||||
.num_feedbacks = 0
|
||||
};
|
||||
|
||||
for (k = dev->kbdfeed; k; k = k->next) {
|
||||
|
|
|
@ -82,15 +82,16 @@ ProcXGetDeviceFocus(ClientPtr client)
|
|||
if (!dev->focus)
|
||||
return BadDevice;
|
||||
|
||||
focus = dev->focus;
|
||||
|
||||
xGetDeviceFocusReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_GetDeviceFocus,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
.time = focus->time.milliseconds,
|
||||
.revertTo = focus->revert,
|
||||
};
|
||||
|
||||
focus = dev->focus;
|
||||
|
||||
if (focus->win == NoneWin)
|
||||
rep.focus = None;
|
||||
else if (focus->win == PointerRootWin)
|
||||
|
@ -100,9 +101,6 @@ ProcXGetDeviceFocus(ClientPtr client)
|
|||
else
|
||||
rep.focus = focus->win->drawable.id;
|
||||
|
||||
rep.time = focus->time.milliseconds;
|
||||
rep.revertTo = focus->revert;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
|
|
|
@ -103,8 +103,6 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
|
|||
.repType = X_Reply,
|
||||
.RepType = X_GetDeviceDontPropagateList,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.count = 0
|
||||
};
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
|
|
|
@ -104,9 +104,6 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
|
|||
.repType = X_Reply,
|
||||
.RepType = X_GetSelectedExtensionEvents,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.this_client_count = 0,
|
||||
.all_clients_count = 0
|
||||
};
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
|
|
|
@ -97,7 +97,6 @@ ProcXGetExtensionVersion(ClientPtr client)
|
|||
.repType = X_Reply,
|
||||
.RepType = X_GetExtensionVersion,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.major_version = XIVersion.major_version,
|
||||
.minor_version = XIVersion.minor_version,
|
||||
.present = TRUE
|
||||
|
|
|
@ -115,7 +115,6 @@ ProcXGrabDevice(ClientPtr client)
|
|||
.repType = X_Reply,
|
||||
.RepType = X_GrabDevice,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
};
|
||||
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
||||
|
|
|
@ -100,7 +100,6 @@ ProcXGrabDeviceButton(ClientPtr client)
|
|||
DeviceIntPtr mdev;
|
||||
XEventClass *class;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
GrabParameters param;
|
||||
GrabMask mask;
|
||||
|
||||
REQUEST(xGrabDeviceButtonReq);
|
||||
|
@ -136,7 +135,7 @@ ProcXGrabDeviceButton(ClientPtr client)
|
|||
X_GrabDeviceButton)) != Success)
|
||||
return ret;
|
||||
|
||||
param = (GrabParameters) {
|
||||
GrabParameters param = {
|
||||
.grabtype = XI,
|
||||
.ownerEvents = stuff->ownerEvents,
|
||||
.this_device_mode = stuff->this_device_mode,
|
||||
|
|
|
@ -98,7 +98,6 @@ ProcXGrabDeviceKey(ClientPtr client)
|
|||
DeviceIntPtr mdev;
|
||||
XEventClass *class;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
GrabParameters param;
|
||||
GrabMask mask;
|
||||
|
||||
REQUEST(xGrabDeviceKeyReq);
|
||||
|
@ -134,7 +133,7 @@ ProcXGrabDeviceKey(ClientPtr client)
|
|||
X_GrabDeviceKey)) != Success)
|
||||
return ret;
|
||||
|
||||
param = (GrabParameters) {
|
||||
GrabParameters param = {
|
||||
.grabtype = XI,
|
||||
.ownerEvents = stuff->ownerEvents,
|
||||
.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);
|
||||
|
||||
xListInputDevicesReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_ListInputDevices,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
};
|
||||
|
||||
/* allocate space for saving skip value */
|
||||
skip = calloc(inputInfo.numDevices, sizeof(Bool));
|
||||
if (!skip)
|
||||
|
@ -382,8 +375,14 @@ ProcXListInputDevices(ClientPtr client)
|
|||
|
||||
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) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
|
|
|
@ -82,7 +82,6 @@ ProcXSetDeviceMode(ClientPtr client)
|
|||
.repType = X_Reply,
|
||||
.RepType = X_SetDeviceMode,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
};
|
||||
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
|
||||
|
|
|
@ -78,7 +78,6 @@ ProcXIGetClientPointer(ClientPtr client)
|
|||
.repType = X_Reply,
|
||||
.RepType = X_XIGetClientPointer,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.set = (winclient->clientPtr != NULL),
|
||||
.deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0
|
||||
};
|
||||
|
|
|
@ -114,7 +114,6 @@ ProcXIQueryDevice(ClientPtr client)
|
|||
.RepType = X_XIQueryDevice,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = len / 4,
|
||||
.num_devices = 0
|
||||
};
|
||||
|
||||
ptr = info;
|
||||
|
|
|
@ -359,8 +359,6 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
|||
.repType = X_Reply,
|
||||
.RepType = X_XIGetSelectedEvents,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.num_masks = 0
|
||||
};
|
||||
|
||||
masks = wOtherInputMasks(win);
|
||||
|
|
|
@ -102,7 +102,6 @@ ProcXIGetFocus(ClientPtr client)
|
|||
.repType = X_Reply,
|
||||
.RepType = X_XIGetFocus,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
};
|
||||
|
||||
if (dev->focus->win == NoneWin)
|
||||
|
|
Loading…
Reference in New Issue