From adefed62268c1fd62b78fe76d459af923d4a9091 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 10 Jul 2024 12:33:31 +0200 Subject: [PATCH] composite: 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 --- composite/compext.c | 49 ++++++++++----------------------------------- 1 file changed, 11 insertions(+), 38 deletions(-) diff --git a/composite/compext.c b/composite/compext.c index 8f599d39a..41505a7da 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -105,11 +105,7 @@ ProcCompositeQueryVersion(ClientPtr client) REQUEST_FIELD_CARD32(minorVersion); CompositeClientPtr pCompositeClient = GetCompositeClient(client); - xCompositeQueryVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0 - }; + xCompositeQueryVersionReply rep = { 0 }; if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR_VERSION) { rep.majorVersion = stuff->majorVersion; @@ -121,14 +117,10 @@ ProcCompositeQueryVersion(ClientPtr client) } pCompositeClient->major_version = rep.majorVersion; pCompositeClient->minor_version = rep.minorVersion; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.majorVersion); - swapl(&rep.minorVersion); - } - WriteToClient(client, sizeof(xCompositeQueryVersionReply), &rep); - return Success; + + REPLY_FIELD_CARD32(majorVersion); + REPLY_FIELD_CARD32(minorVersion); + REPLY_SEND_RET_SUCCESS(); } #define VERIFY_WINDOW(pWindow, wid, client, mode) \ @@ -267,7 +259,6 @@ SingleCompositeNameWindowPixmap(ClientPtr client, xCompositeNameWindowPixmapReq static int SingleCompositeGetOverlayWindow(ClientPtr client, xCompositeGetOverlayWindowReq *stuff) { - xCompositeGetOverlayWindowReply rep; WindowPtr pWin; ScreenPtr pScreen; CompScreenPtr cs; @@ -303,21 +294,12 @@ SingleCompositeGetOverlayWindow(ClientPtr client, xCompositeGetOverlayWindowReq return rc; } - rep = (xCompositeGetOverlayWindowReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, + xCompositeGetOverlayWindowReply rep = { .overlayWin = cs->pOverlayWin->drawable.id }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.overlayWin); - } - WriteToClient(client, sz_xCompositeGetOverlayWindowReply, &rep); - - return Success; + REPLY_FIELD_CARD32(overlayWin); + REPLY_SEND_RET_SUCCESS(); } static int @@ -682,7 +664,6 @@ ProcCompositeGetOverlayWindow(ClientPtr client) if (!compositeUseXinerama) return SingleCompositeGetOverlayWindow(client, stuff); - xCompositeGetOverlayWindowReply rep; WindowPtr pWin; ScreenPtr pScreen; CompScreenPtr cs; @@ -760,20 +741,12 @@ ProcCompositeGetOverlayWindow(ClientPtr client) cs = GetCompScreen(screenInfo.screens[0]); - rep = (xCompositeGetOverlayWindowReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, + xCompositeGetOverlayWindowReply rep = { .overlayWin = cs->pOverlayWin->drawable.id }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.overlayWin); - } - WriteToClient(client, sz_xCompositeGetOverlayWindowReply, &rep); - return Success; + REPLY_FIELD_CARD32(overlayWin); + REPLY_SEND_RET_SUCCESS(); #else return SingleCompositeGetOverlayWindow(client, stuff); #endif /* XINERAMA */