WIP Xext: panoramiX: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros

Use the new macros to make request struct parsing / field swapping
much easier.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2024-07-11 19:54:43 +02:00
parent 5069e8d93e
commit 7a0885bad6

View File

@@ -877,13 +877,13 @@ PanoramiXResetProc(ExtensionEntry * extEntry)
int
ProcPanoramiXQueryVersion(ClientPtr client)
{
/* REQUEST(xPanoramiXQueryVersionReq); */
X_REQUEST_HEAD_STRUCT(xPanoramiXQueryVersionReq);
xPanoramiXQueryVersionReply reply = {
.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION,
.minorVersion = SERVER_PANORAMIX_MINOR_VERSION
};
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
if (client->swapped) {
swaps(&reply.majorVersion);
swaps(&reply.minorVersion);
@@ -895,11 +895,8 @@ ProcPanoramiXQueryVersion(ClientPtr client)
int
ProcPanoramiXGetState(ClientPtr client)
{
REQUEST(xPanoramiXGetStateReq);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
if (client->swapped)
swapl(&stuff->window);
X_REQUEST_HEAD_STRUCT(xPanoramiXGetStateReq);
X_REQUEST_FIELD_CARD32(window);
WindowPtr pWin;
int rc;
@@ -923,11 +920,8 @@ ProcPanoramiXGetState(ClientPtr client)
int
ProcPanoramiXGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
if (client->swapped)
swapl(&stuff->window);
X_REQUEST_HEAD_STRUCT(xPanoramiXGetScreenCountReq);
X_REQUEST_FIELD_CARD32(window);
WindowPtr pWin;
int rc;
@@ -951,13 +945,9 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
int
ProcPanoramiXGetScreenSize(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenSizeReq);
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
if (client->swapped) {
swapl(&stuff->window);
swapl(&stuff->screen);
}
X_REQUEST_HEAD_STRUCT(xPanoramiXGetScreenSizeReq);
X_REQUEST_FIELD_CARD32(window);
X_REQUEST_FIELD_CARD32(screen);
WindowPtr pWin;
int rc;
@@ -992,8 +982,7 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
int
ProcXineramaIsActive(ClientPtr client)
{
/* REQUEST(xXineramaIsActiveReq); */
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
X_REQUEST_HEAD_STRUCT(xXineramaIsActiveReq);
xXineramaIsActiveReply reply = {
#if 1
@@ -1015,14 +1004,13 @@ ProcXineramaIsActive(ClientPtr client)
int
ProcXineramaQueryScreens(ClientPtr client)
{
/* REQUEST(xXineramaQueryScreensReq); */
X_REQUEST_HEAD_STRUCT(xXineramaQueryScreensReq);
CARD32 number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
xXineramaQueryScreensReply reply = {
.number = number
};
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
if (client->swapped) {
swapl(&reply.number);
}