xfixes: 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
9b8638da17
commit
67292b02e3
|
|
@ -367,8 +367,6 @@ ProcXFixesGetCursorImage(ClientPtr client)
|
|||
CopyCursorToImage(pCursor, image);
|
||||
|
||||
xXFixesGetCursorImageReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = npixels,
|
||||
.width = width,
|
||||
.height = height,
|
||||
|
|
@ -379,20 +377,15 @@ ProcXFixesGetCursorImage(ClientPtr client)
|
|||
.cursorSerial = pCursor->serialNumber,
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swaps(&rep.x);
|
||||
swaps(&rep.y);
|
||||
swaps(&rep.width);
|
||||
swaps(&rep.height);
|
||||
swaps(&rep.xhot);
|
||||
swaps(&rep.yhot);
|
||||
swapl(&rep.cursorSerial);
|
||||
SwapLongs(image, npixels);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXFixesGetCursorImageReply), &rep);
|
||||
WriteToClient(client, sizeof(image), image);
|
||||
REPLY_FIELD_CARD16(x);
|
||||
REPLY_FIELD_CARD16(y);
|
||||
REPLY_FIELD_CARD16(width);
|
||||
REPLY_FIELD_CARD16(height);
|
||||
REPLY_FIELD_CARD16(xhot);
|
||||
REPLY_FIELD_CARD16(yhot);
|
||||
REPLY_FIELD_CARD32(cursorSerial);
|
||||
REPLY_BUF_CARD32(image, npixels);
|
||||
REPLY_SEND_EXTRA(image, sizeof(image));
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
@ -436,21 +429,12 @@ ProcXFixesGetCursorName(ClientPtr client)
|
|||
len = strlen(str);
|
||||
|
||||
xXFixesGetCursorNameReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(len),
|
||||
.atom = pCursor->name,
|
||||
.nbytes = len
|
||||
};
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.atom);
|
||||
swaps(&rep.nbytes);
|
||||
}
|
||||
WriteToClient(client, sizeof(rep), &rep);
|
||||
WriteToClient(client, len, str);
|
||||
|
||||
REPLY_FIELD_CARD32(atom);
|
||||
REPLY_FIELD_CARD16(nbytes);
|
||||
REPLY_SEND_EXTRA(str, len);
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
@ -488,9 +472,6 @@ ProcXFixesGetCursorImageAndName(ClientPtr client)
|
|||
memcpy((image + npixels), name, nbytes);
|
||||
|
||||
xXFixesGetCursorImageAndNameReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(sizeof(image)),
|
||||
.width = width,
|
||||
.height = height,
|
||||
.x = x,
|
||||
|
|
@ -502,22 +483,17 @@ ProcXFixesGetCursorImageAndName(ClientPtr client)
|
|||
.nbytes = nbytes,
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swaps(&rep.x);
|
||||
swaps(&rep.y);
|
||||
swaps(&rep.width);
|
||||
swaps(&rep.height);
|
||||
swaps(&rep.xhot);
|
||||
swaps(&rep.yhot);
|
||||
swapl(&rep.cursorSerial);
|
||||
swapl(&rep.cursorName);
|
||||
swaps(&rep.nbytes);
|
||||
SwapLongs(image, npixels);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXFixesGetCursorImageAndNameReply), &rep);
|
||||
WriteToClient(client, sizeof(image), image);
|
||||
REPLY_FIELD_CARD16(x);
|
||||
REPLY_FIELD_CARD16(y);
|
||||
REPLY_FIELD_CARD16(width);
|
||||
REPLY_FIELD_CARD16(height);
|
||||
REPLY_FIELD_CARD16(xhot);
|
||||
REPLY_FIELD_CARD16(yhot);
|
||||
REPLY_FIELD_CARD32(cursorSerial);
|
||||
REPLY_FIELD_CARD32(cursorName);
|
||||
REPLY_FIELD_CARD16(nbytes);
|
||||
REPLY_BUF_CARD32(image, npixels);
|
||||
REPLY_SEND_EXTRA(image, sizeof(image));
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,18 +81,11 @@ ProcXFixesGetClientDisconnectMode(ClientPtr client)
|
|||
ClientDisconnectPtr pDisconnect = GetClientDisconnect(client);
|
||||
|
||||
xXFixesGetClientDisconnectModeReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.disconnect_mode = pDisconnect->disconnect_mode,
|
||||
};
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.disconnect_mode);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXFixesGetClientDisconnectModeReply), &rep);
|
||||
|
||||
return Success;
|
||||
REPLY_FIELD_CARD32(disconnect_mode);
|
||||
REPLY_SEND_RET_SUCCESS();
|
||||
}
|
||||
|
||||
Bool
|
||||
|
|
|
|||
|
|
@ -427,26 +427,18 @@ ProcXFixesFetchRegion(ClientPtr client)
|
|||
}
|
||||
|
||||
xXFixesFetchRegionReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = nBox << 1,
|
||||
.x = pExtent->x1,
|
||||
.y = pExtent->y1,
|
||||
.width = pExtent->x2 - pExtent->x1,
|
||||
.height = pExtent->y2 - pExtent->y1,
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swaps(&rep.x);
|
||||
swaps(&rep.y);
|
||||
swaps(&rep.width);
|
||||
swaps(&rep.height);
|
||||
SwapShorts((INT16 *) pRect, nBox * 4);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXFixesFetchRegionReply), &rep);
|
||||
WriteToClient(client, sizeof(pRect), pRect);
|
||||
REPLY_FIELD_CARD16(x);
|
||||
REPLY_FIELD_CARD16(y);
|
||||
REPLY_FIELD_CARD16(width);
|
||||
REPLY_FIELD_CARD16(height);
|
||||
REPLY_BUF_CARD16(pRect, nBox * 4);
|
||||
REPLY_SEND_EXTRA(pRect, sizeof(pRect));
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,11 +70,7 @@ ProcXFixesQueryVersion(ClientPtr client)
|
|||
|
||||
int major, minor;
|
||||
XFixesClientPtr pXFixesClient = GetXFixesClient(client);
|
||||
xXFixesQueryVersionReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
};
|
||||
xXFixesQueryVersionReply rep = { 0 };
|
||||
|
||||
if (version_compare(stuff->majorVersion, stuff->minorVersion,
|
||||
SERVER_XFIXES_MAJOR_VERSION,
|
||||
|
|
@ -90,14 +86,10 @@ ProcXFixesQueryVersion(ClientPtr client)
|
|||
pXFixesClient->major_version = major;
|
||||
rep.majorVersion = min(stuff->majorVersion, major);
|
||||
rep.minorVersion = minor;
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.majorVersion);
|
||||
swapl(&rep.minorVersion);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXFixesQueryVersionReply), &rep);
|
||||
return Success;
|
||||
|
||||
REPLY_FIELD_CARD32(majorVersion);
|
||||
REPLY_FIELD_CARD32(minorVersion);
|
||||
REPLY_SEND_RET_SUCCESS();
|
||||
}
|
||||
|
||||
/* Major version controls available requests */
|
||||
|
|
|
|||
Loading…
Reference in New Issue