From 7a0885bad6119172be6a3385285ec9c73496f9fe Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 11 Jul 2024 19:54:43 +0200 Subject: [PATCH] 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 --- Xext/panoramiX.c | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index f2a5c5d0ec..38e0db8ef4 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -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); }