mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
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:
committed by
Enrico Weigelt, metux IT consult .
parent
221e0b0971
commit
4591382bab
@@ -107,7 +107,6 @@ ProcXChangeDeviceControl(ClientPtr client)
|
||||
int i, status, ret = BadValue;
|
||||
DeviceIntPtr dev;
|
||||
xDeviceResolutionCtl *r;
|
||||
xChangeDeviceControlReply rep;
|
||||
AxisInfoPtr a;
|
||||
CARD32 *resolution;
|
||||
xDeviceEnableCtl *e;
|
||||
@@ -126,11 +125,9 @@ ProcXChangeDeviceControl(ClientPtr client)
|
||||
goto out;
|
||||
}
|
||||
|
||||
rep = (xChangeDeviceControlReply) {
|
||||
.repType = X_Reply,
|
||||
xChangeDeviceControlReply rep = {
|
||||
.RepType = X_ChangeDeviceControl,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.status = Success,
|
||||
};
|
||||
|
||||
|
||||
19
Xi/getbmap.c
19
Xi/getbmap.c
@@ -69,21 +69,12 @@ int
|
||||
ProcXGetDeviceButtonMapping(ClientPtr client)
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
xGetDeviceButtonMappingReply rep;
|
||||
ButtonClassPtr b;
|
||||
int rc;
|
||||
|
||||
REQUEST(xGetDeviceButtonMappingReq);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq);
|
||||
|
||||
rep = (xGetDeviceButtonMappingReply) {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_GetDeviceButtonMapping,
|
||||
.sequenceNumber = client->sequence,
|
||||
.nElts = 0,
|
||||
.length = 0
|
||||
};
|
||||
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
@@ -92,8 +83,14 @@ ProcXGetDeviceButtonMapping(ClientPtr client)
|
||||
if (b == NULL)
|
||||
return BadMatch;
|
||||
|
||||
rep.nElts = b->numButtons;
|
||||
rep.length = bytes_to_int32(rep.nElts);
|
||||
xGetDeviceButtonMappingReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_GetDeviceButtonMapping,
|
||||
.sequenceNumber = client->sequence,
|
||||
.nElts = b->numButtons,
|
||||
.length = bytes_to_int32(rep.nElts),
|
||||
};
|
||||
|
||||
WriteReplyToClient(client, sizeof(xGetDeviceButtonMappingReply), &rep);
|
||||
WriteToClient(client, rep.nElts, &b->map[1]);
|
||||
return Success;
|
||||
|
||||
15
Xi/getdctl.c
15
Xi/getdctl.c
@@ -170,7 +170,6 @@ ProcXGetDeviceControl(ClientPtr client)
|
||||
int rc, total_length = 0;
|
||||
char *buf, *savbuf;
|
||||
DeviceIntPtr dev;
|
||||
xGetDeviceControlReply rep;
|
||||
|
||||
REQUEST(xGetDeviceControlReq);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
|
||||
@@ -179,12 +178,6 @@ ProcXGetDeviceControl(ClientPtr client)
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
rep = (xGetDeviceControlReply) {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_GetDeviceControl,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
};
|
||||
|
||||
switch (stuff->control) {
|
||||
case DEVICE_RESOLUTION:
|
||||
@@ -225,7 +218,13 @@ ProcXGetDeviceControl(ClientPtr client)
|
||||
break;
|
||||
}
|
||||
|
||||
rep.length = bytes_to_int32(total_length);
|
||||
xGetDeviceControlReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_GetDeviceControl,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(total_length),
|
||||
};
|
||||
|
||||
WriteReplyToClient(client, sizeof(xGetDeviceControlReply), &rep);
|
||||
WriteToClient(client, total_length, savbuf);
|
||||
free(savbuf);
|
||||
|
||||
@@ -269,7 +269,6 @@ ProcXGetFeedbackControl(ClientPtr client)
|
||||
StringFeedbackPtr s;
|
||||
BellFeedbackPtr b;
|
||||
LedFeedbackPtr l;
|
||||
xGetFeedbackControlReply rep;
|
||||
|
||||
REQUEST(xGetFeedbackControlReq);
|
||||
REQUEST_SIZE_MATCH(xGetFeedbackControlReq);
|
||||
@@ -278,12 +277,10 @@ ProcXGetFeedbackControl(ClientPtr client)
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
rep = (xGetFeedbackControlReply) {
|
||||
xGetFeedbackControlReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_GetFeedbackControl,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.num_feedbacks = 0
|
||||
};
|
||||
|
||||
for (k = dev->kbdfeed; k; k = k->next) {
|
||||
|
||||
@@ -71,7 +71,6 @@ ProcXGetDeviceFocus(ClientPtr client)
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
FocusClassPtr focus;
|
||||
xGetDeviceFocusReply rep;
|
||||
int rc;
|
||||
|
||||
REQUEST(xGetDeviceFocusReq);
|
||||
@@ -83,15 +82,16 @@ ProcXGetDeviceFocus(ClientPtr client)
|
||||
if (!dev->focus)
|
||||
return BadDevice;
|
||||
|
||||
rep = (xGetDeviceFocusReply) {
|
||||
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)
|
||||
@@ -101,8 +101,6 @@ ProcXGetDeviceFocus(ClientPtr client)
|
||||
else
|
||||
rep.focus = focus->win->drawable.id;
|
||||
|
||||
rep.time = focus->time.milliseconds;
|
||||
rep.revertTo = focus->revert;
|
||||
WriteReplyToClient(client, sizeof(xGetDeviceFocusReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,6 @@ SOFTWARE.
|
||||
int
|
||||
ProcXGetDeviceKeyMapping(ClientPtr client)
|
||||
{
|
||||
xGetDeviceKeyMappingReply rep;
|
||||
DeviceIntPtr dev;
|
||||
XkbDescPtr xkb;
|
||||
KeySymsPtr syms;
|
||||
@@ -102,7 +101,7 @@ ProcXGetDeviceKeyMapping(ClientPtr client)
|
||||
if (!syms)
|
||||
return BadAlloc;
|
||||
|
||||
rep = (xGetDeviceKeyMappingReply) {
|
||||
xGetDeviceKeyMappingReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_GetDeviceKeyMapping,
|
||||
.sequenceNumber = client->sequence,
|
||||
|
||||
@@ -69,7 +69,6 @@ int
|
||||
ProcXGetDeviceModifierMapping(ClientPtr client)
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
xGetDeviceModifierMappingReply rep;
|
||||
KeyCode *modkeymap = NULL;
|
||||
int ret, max_keys_per_mod;
|
||||
|
||||
@@ -84,12 +83,12 @@ ProcXGetDeviceModifierMapping(ClientPtr client)
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
|
||||
rep = (xGetDeviceModifierMappingReply) {
|
||||
xGetDeviceModifierMappingReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_GetDeviceModifierMapping,
|
||||
.sequenceNumber = client->sequence,
|
||||
.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
|
||||
};
|
||||
|
||||
|
||||
@@ -94,18 +94,15 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
|
||||
int i, rc;
|
||||
XEventClass *buf = NULL, *tbuf;
|
||||
WindowPtr pWin;
|
||||
xGetDeviceDontPropagateListReply rep;
|
||||
OtherInputMasks *others;
|
||||
|
||||
REQUEST(xGetDeviceDontPropagateListReq);
|
||||
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
|
||||
|
||||
rep = (xGetDeviceDontPropagateListReply) {
|
||||
xGetDeviceDontPropagateListReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_GetDeviceDontPropagateList,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.count = 0
|
||||
};
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
|
||||
@@ -90,7 +90,6 @@ int
|
||||
ProcXGetSelectedExtensionEvents(ClientPtr client)
|
||||
{
|
||||
int i, rc, total_length = 0;
|
||||
xGetSelectedExtensionEventsReply rep;
|
||||
WindowPtr pWin;
|
||||
XEventClass *buf = NULL;
|
||||
XEventClass *tclient;
|
||||
@@ -101,13 +100,10 @@ ProcXGetSelectedExtensionEvents(ClientPtr client)
|
||||
REQUEST(xGetSelectedExtensionEventsReq);
|
||||
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
|
||||
|
||||
rep = (xGetSelectedExtensionEventsReply) {
|
||||
xGetSelectedExtensionEventsReply rep = {
|
||||
.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);
|
||||
|
||||
@@ -86,7 +86,6 @@ SProcXGetExtensionVersion(ClientPtr client)
|
||||
int
|
||||
ProcXGetExtensionVersion(ClientPtr client)
|
||||
{
|
||||
xGetExtensionVersionReply rep;
|
||||
|
||||
REQUEST(xGetExtensionVersionReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
|
||||
@@ -95,11 +94,10 @@ ProcXGetExtensionVersion(ClientPtr client)
|
||||
stuff->nbytes))
|
||||
return BadLength;
|
||||
|
||||
rep = (xGetExtensionVersionReply) {
|
||||
xGetExtensionVersionReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_GetExtensionVersion,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.major_version = XIVersion.major_version,
|
||||
.minor_version = XIVersion.minor_version,
|
||||
.present = TRUE
|
||||
|
||||
@@ -101,7 +101,6 @@ int
|
||||
ProcXGrabDevice(ClientPtr client)
|
||||
{
|
||||
int rc;
|
||||
xGrabDeviceReply rep;
|
||||
DeviceIntPtr dev;
|
||||
GrabMask mask;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
@@ -113,11 +112,10 @@ ProcXGrabDevice(ClientPtr client)
|
||||
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
|
||||
return BadLength;
|
||||
|
||||
rep = (xGrabDeviceReply) {
|
||||
xGrabDeviceReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_GrabDevice,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
};
|
||||
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
||||
|
||||
@@ -99,7 +99,6 @@ ProcXGrabDeviceButton(ClientPtr client)
|
||||
DeviceIntPtr mdev;
|
||||
XEventClass *class;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
GrabParameters param;
|
||||
GrabMask mask;
|
||||
|
||||
REQUEST(xGrabDeviceButtonReq);
|
||||
@@ -135,7 +134,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,
|
||||
|
||||
@@ -97,7 +97,6 @@ ProcXGrabDeviceKey(ClientPtr client)
|
||||
DeviceIntPtr mdev;
|
||||
XEventClass *class;
|
||||
struct tmask tmp[EMASKSIZE];
|
||||
GrabParameters param;
|
||||
GrabMask mask;
|
||||
|
||||
REQUEST(xGrabDeviceKeyReq);
|
||||
@@ -133,7 +132,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,
|
||||
|
||||
@@ -87,7 +87,6 @@ int
|
||||
ProcXGetDeviceMotionEvents(ClientPtr client)
|
||||
{
|
||||
INT32 *coords = NULL, *bufptr;
|
||||
xGetDeviceMotionEventsReply rep;
|
||||
unsigned long i;
|
||||
int rc, num_events, axes, size = 0;
|
||||
unsigned long nEvents;
|
||||
@@ -108,7 +107,8 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
|
||||
if (dev->valuator->motionHintWindow)
|
||||
MaybeStopDeviceHint(dev, client);
|
||||
axes = v->numAxes;
|
||||
rep = (xGetDeviceMotionEventsReply) {
|
||||
|
||||
xGetDeviceMotionEventsReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_GetDeviceMotionEvents,
|
||||
.sequenceNumber = client->sequence,
|
||||
|
||||
19
Xi/listdev.c
19
Xi/listdev.c
@@ -316,7 +316,6 @@ ShouldSkipDevice(ClientPtr client, DeviceIntPtr d)
|
||||
int
|
||||
ProcXListInputDevices(ClientPtr client)
|
||||
{
|
||||
xListInputDevicesReply rep;
|
||||
int numdevs = 0;
|
||||
int namesize = 1; /* need 1 extra byte for strcpy */
|
||||
int i = 0, size = 0;
|
||||
@@ -328,13 +327,6 @@ ProcXListInputDevices(ClientPtr client)
|
||||
|
||||
REQUEST_SIZE_MATCH(xListInputDevicesReq);
|
||||
|
||||
rep = (xListInputDevicesReply) {
|
||||
.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)
|
||||
@@ -383,8 +375,15 @@ 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),
|
||||
};
|
||||
|
||||
WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
|
||||
WriteToClient(client, total_length, savbuf);
|
||||
free(savbuf);
|
||||
|
||||
@@ -76,7 +76,6 @@ ProcXOpenDevice(ClientPtr client)
|
||||
xInputClassInfo evbase[numInputClasses];
|
||||
int j = 0;
|
||||
int status = Success;
|
||||
xOpenDeviceReply rep;
|
||||
DeviceIntPtr dev;
|
||||
|
||||
REQUEST(xOpenDeviceReq);
|
||||
@@ -127,7 +126,8 @@ ProcXOpenDevice(ClientPtr client)
|
||||
}
|
||||
evbase[j].class = OtherClass;
|
||||
evbase[j++].event_type_base = event_base[OtherClass];
|
||||
rep = (xOpenDeviceReply) {
|
||||
|
||||
xOpenDeviceReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_OpenDevice,
|
||||
.sequenceNumber = client->sequence,
|
||||
|
||||
@@ -66,7 +66,6 @@ ProcXQueryDeviceState(ClientPtr client)
|
||||
xButtonState *tb;
|
||||
ValuatorClassPtr v;
|
||||
xValuatorState *tv;
|
||||
xQueryDeviceStateReply rep;
|
||||
DeviceIntPtr dev;
|
||||
double *values;
|
||||
|
||||
@@ -144,7 +143,7 @@ ProcXQueryDeviceState(ClientPtr client)
|
||||
}
|
||||
}
|
||||
|
||||
rep = (xQueryDeviceStateReply) {
|
||||
xQueryDeviceStateReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_QueryDeviceState,
|
||||
.sequenceNumber = client->sequence,
|
||||
|
||||
@@ -72,7 +72,6 @@ int
|
||||
ProcXSetDeviceButtonMapping(ClientPtr client)
|
||||
{
|
||||
int ret;
|
||||
xSetDeviceButtonMappingReply rep;
|
||||
DeviceIntPtr dev;
|
||||
|
||||
REQUEST(xSetDeviceButtonMappingReq);
|
||||
@@ -86,11 +85,10 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
|
||||
rep = (xSetDeviceButtonMappingReply) {
|
||||
xSetDeviceButtonMappingReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_SetDeviceButtonMapping,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.status = MappingSuccess
|
||||
};
|
||||
|
||||
|
||||
@@ -72,17 +72,15 @@ int
|
||||
ProcXSetDeviceValuators(ClientPtr client)
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
xSetDeviceValuatorsReply rep;
|
||||
int rc;
|
||||
|
||||
REQUEST(xSetDeviceValuatorsReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSetDeviceValuatorsReq);
|
||||
|
||||
rep = (xSetDeviceValuatorsReply) {
|
||||
xSetDeviceValuatorsReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_SetDeviceValuators,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.status = Success
|
||||
};
|
||||
|
||||
|
||||
@@ -73,7 +73,6 @@ int
|
||||
ProcXSetDeviceModifierMapping(ClientPtr client)
|
||||
{
|
||||
int ret;
|
||||
xSetDeviceModifierMappingReply rep;
|
||||
DeviceIntPtr dev;
|
||||
|
||||
REQUEST(xSetDeviceModifierMappingReq);
|
||||
@@ -83,11 +82,10 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
|
||||
(stuff->numKeyPerModifier << 1))
|
||||
return BadLength;
|
||||
|
||||
rep = (xSetDeviceModifierMappingReply) {
|
||||
xSetDeviceModifierMappingReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_SetDeviceModifierMapping,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
};
|
||||
|
||||
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess);
|
||||
|
||||
@@ -72,17 +72,15 @@ int
|
||||
ProcXSetDeviceMode(ClientPtr client)
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
xSetDeviceModeReply rep;
|
||||
int rc;
|
||||
|
||||
REQUEST(xSetDeviceModeReq);
|
||||
REQUEST_SIZE_MATCH(xSetDeviceModeReq);
|
||||
|
||||
rep = (xSetDeviceModeReply) {
|
||||
xSetDeviceModeReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_SetDeviceMode,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
};
|
||||
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess);
|
||||
|
||||
@@ -61,7 +61,6 @@ ProcXIGetClientPointer(ClientPtr client)
|
||||
{
|
||||
int rc;
|
||||
ClientPtr winclient;
|
||||
xXIGetClientPointerReply rep;
|
||||
|
||||
REQUEST(xXIGetClientPointerReq);
|
||||
REQUEST_SIZE_MATCH(xXIGetClientPointerReq);
|
||||
@@ -75,11 +74,10 @@ ProcXIGetClientPointer(ClientPtr client)
|
||||
else
|
||||
winclient = client;
|
||||
|
||||
rep = (xXIGetClientPointerReply) {
|
||||
xXIGetClientPointerReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_XIGetClientPointer,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.set = (winclient->clientPtr != NULL),
|
||||
.deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0
|
||||
};
|
||||
|
||||
@@ -66,7 +66,6 @@ int
|
||||
ProcXIGrabDevice(ClientPtr client)
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
xXIGrabDeviceReply rep;
|
||||
int ret = Success;
|
||||
uint8_t status;
|
||||
GrabMask mask = { 0 };
|
||||
@@ -119,11 +118,10 @@ ProcXIGrabDevice(ClientPtr client)
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
|
||||
rep = (xXIGrabDeviceReply) {
|
||||
xXIGrabDeviceReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_XIGrabDevice,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.status = status
|
||||
};
|
||||
|
||||
|
||||
@@ -851,7 +851,6 @@ int
|
||||
ProcXListDeviceProperties(ClientPtr client)
|
||||
{
|
||||
Atom *atoms;
|
||||
xListDevicePropertiesReply rep;
|
||||
int natoms;
|
||||
DeviceIntPtr dev;
|
||||
int rc = Success;
|
||||
@@ -867,7 +866,7 @@ ProcXListDeviceProperties(ClientPtr client)
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
rep = (xListDevicePropertiesReply) {
|
||||
xListDevicePropertiesReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_ListDeviceProperties,
|
||||
.sequenceNumber = client->sequence,
|
||||
@@ -948,7 +947,6 @@ ProcXGetDeviceProperty(ClientPtr client)
|
||||
int rc, format, nitems, bytes_after;
|
||||
char *data;
|
||||
Atom type;
|
||||
xGetDevicePropertyReply reply;
|
||||
|
||||
REQUEST_SIZE_MATCH(xGetDevicePropertyReq);
|
||||
if (stuff->delete)
|
||||
@@ -965,7 +963,7 @@ ProcXGetDeviceProperty(ClientPtr client)
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
reply = (xGetDevicePropertyReply) {
|
||||
xGetDevicePropertyReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_GetDeviceProperty,
|
||||
.sequenceNumber = client->sequence,
|
||||
@@ -977,13 +975,13 @@ ProcXGetDeviceProperty(ClientPtr client)
|
||||
.deviceid = dev->id
|
||||
};
|
||||
|
||||
if (stuff->delete && (reply.bytesAfter == 0))
|
||||
if (stuff->delete && (rep.bytesAfter == 0))
|
||||
send_property_event(dev, stuff->property, XIPropertyDeleted);
|
||||
|
||||
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
|
||||
WriteReplyToClient(client, sizeof(xGenericReply), &rep);
|
||||
|
||||
if (length) {
|
||||
switch (reply.format) {
|
||||
switch (rep.format) {
|
||||
case 32:
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
|
||||
break;
|
||||
@@ -998,7 +996,7 @@ ProcXGetDeviceProperty(ClientPtr client)
|
||||
}
|
||||
|
||||
/* delete the Property */
|
||||
if (stuff->delete && (reply.bytesAfter == 0)) {
|
||||
if (stuff->delete && (rep.bytesAfter == 0)) {
|
||||
XIPropertyPtr prop, *prev;
|
||||
|
||||
for (prev = &dev->properties.properties; (prop = *prev);
|
||||
@@ -1079,7 +1077,6 @@ int
|
||||
ProcXIListProperties(ClientPtr client)
|
||||
{
|
||||
Atom *atoms;
|
||||
xXIListPropertiesReply rep;
|
||||
int natoms;
|
||||
DeviceIntPtr dev;
|
||||
int rc = Success;
|
||||
@@ -1095,7 +1092,7 @@ ProcXIListProperties(ClientPtr client)
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
rep = (xXIListPropertiesReply) {
|
||||
xXIListPropertiesReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_XIListProperties,
|
||||
.sequenceNumber = client->sequence,
|
||||
@@ -1173,7 +1170,6 @@ ProcXIGetProperty(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXIGetPropertyReq);
|
||||
DeviceIntPtr dev;
|
||||
xXIGetPropertyReply reply;
|
||||
int length;
|
||||
int rc, format, nitems, bytes_after;
|
||||
char *data;
|
||||
@@ -1194,7 +1190,7 @@ ProcXIGetProperty(ClientPtr client)
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
reply = (xXIGetPropertyReply) {
|
||||
xXIGetPropertyReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_XIGetProperty,
|
||||
.sequenceNumber = client->sequence,
|
||||
@@ -1205,13 +1201,13 @@ ProcXIGetProperty(ClientPtr client)
|
||||
.format = format
|
||||
};
|
||||
|
||||
if (length && stuff->delete && (reply.bytes_after == 0))
|
||||
if (length && stuff->delete && (rep.bytes_after == 0))
|
||||
send_property_event(dev, stuff->property, XIPropertyDeleted);
|
||||
|
||||
WriteReplyToClient(client, sizeof(xXIGetPropertyReply), &reply);
|
||||
WriteReplyToClient(client, sizeof(xXIGetPropertyReply), &rep);
|
||||
|
||||
if (length) {
|
||||
switch (reply.format) {
|
||||
switch (rep.format) {
|
||||
case 32:
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
|
||||
break;
|
||||
@@ -1226,7 +1222,7 @@ ProcXIGetProperty(ClientPtr client)
|
||||
}
|
||||
|
||||
/* delete the Property */
|
||||
if (stuff->delete && (reply.bytes_after == 0)) {
|
||||
if (stuff->delete && (rep.bytes_after == 0)) {
|
||||
XIPropertyPtr prop, *prev;
|
||||
|
||||
for (prev = &dev->properties.properties; (prop = *prev);
|
||||
|
||||
@@ -67,7 +67,6 @@ SProcXIQueryDevice(ClientPtr client)
|
||||
int
|
||||
ProcXIQueryDevice(ClientPtr client)
|
||||
{
|
||||
xXIQueryDeviceReply rep;
|
||||
DeviceIntPtr dev = NULL;
|
||||
int rc = Success;
|
||||
int i = 0, len = 0;
|
||||
@@ -110,12 +109,11 @@ ProcXIQueryDevice(ClientPtr client)
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
rep = (xXIQueryDeviceReply) {
|
||||
xXIQueryDeviceReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_XIQueryDevice,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = len / 4,
|
||||
.num_devices = 0
|
||||
};
|
||||
|
||||
ptr = info;
|
||||
|
||||
@@ -77,7 +77,6 @@ int
|
||||
ProcXIQueryPointer(ClientPtr client)
|
||||
{
|
||||
int rc;
|
||||
xXIQueryPointerReply rep;
|
||||
DeviceIntPtr pDev, kbd;
|
||||
WindowPtr pWin, t;
|
||||
SpritePtr pSprite;
|
||||
@@ -126,7 +125,7 @@ ProcXIQueryPointer(ClientPtr client)
|
||||
|
||||
pSprite = pDev->spriteInfo->sprite;
|
||||
|
||||
rep = (xXIQueryPointerReply) {
|
||||
xXIQueryPointerReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_XIQueryPointer,
|
||||
.sequenceNumber = client->sequence,
|
||||
|
||||
@@ -54,7 +54,6 @@ extern XExtensionVersion XIVersion; /* defined in getvers.c */
|
||||
int
|
||||
ProcXIQueryVersion(ClientPtr client)
|
||||
{
|
||||
xXIQueryVersionReply rep;
|
||||
XIClientPtr pXIClient;
|
||||
int major, minor;
|
||||
|
||||
@@ -113,11 +112,10 @@ ProcXIQueryVersion(ClientPtr client)
|
||||
pXIClient->minor_version = minor;
|
||||
}
|
||||
|
||||
rep = (xXIQueryVersionReply) {
|
||||
xXIQueryVersionReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_XIQueryVersion,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.major_version = major,
|
||||
.minor_version = minor
|
||||
};
|
||||
|
||||
@@ -342,7 +342,6 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||
int rc, i;
|
||||
WindowPtr win;
|
||||
char *buffer = NULL;
|
||||
xXIGetSelectedEventsReply reply;
|
||||
OtherInputMasks *masks;
|
||||
InputClientsPtr others = NULL;
|
||||
xXIEventMask *evmask = NULL;
|
||||
@@ -356,12 +355,10 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
reply = (xXIGetSelectedEventsReply) {
|
||||
xXIGetSelectedEventsReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_XIGetSelectedEvents,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.num_masks = 0
|
||||
};
|
||||
|
||||
masks = wOtherInputMasks(win);
|
||||
@@ -375,7 +372,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||
}
|
||||
|
||||
if (!others) {
|
||||
WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
|
||||
WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &rep);
|
||||
return Success;
|
||||
}
|
||||
|
||||
@@ -401,8 +398,8 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||
|
||||
evmask->deviceid = i;
|
||||
evmask->mask_len = mask_len;
|
||||
reply.num_masks++;
|
||||
reply.length += sizeof(xXIEventMask) / 4 + evmask->mask_len;
|
||||
rep.num_masks++;
|
||||
rep.length += sizeof(xXIEventMask) / 4 + evmask->mask_len;
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&evmask->deviceid);
|
||||
@@ -418,10 +415,10 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||
}
|
||||
|
||||
/* save the value before SRepXIGetSelectedEvents swaps it */
|
||||
length = reply.length;
|
||||
WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
|
||||
length = rep.length;
|
||||
WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &rep);
|
||||
|
||||
if (reply.num_masks)
|
||||
if (rep.num_masks)
|
||||
WriteToClient(client, length * 4, buffer);
|
||||
|
||||
free(buffer);
|
||||
|
||||
@@ -86,7 +86,6 @@ ProcXISetFocus(ClientPtr client)
|
||||
int
|
||||
ProcXIGetFocus(ClientPtr client)
|
||||
{
|
||||
xXIGetFocusReply rep;
|
||||
DeviceIntPtr dev;
|
||||
int ret;
|
||||
|
||||
@@ -99,11 +98,10 @@ ProcXIGetFocus(ClientPtr client)
|
||||
if (!dev->focus)
|
||||
return BadDevice;
|
||||
|
||||
rep = (xXIGetFocusReply) {
|
||||
xXIGetFocusReply rep = {
|
||||
.repType = X_Reply,
|
||||
.RepType = X_XIGetFocus,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
};
|
||||
|
||||
if (dev->focus->win == NoneWin)
|
||||
|
||||
Reference in New Issue
Block a user