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