diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index c9ff42c190..37275ca24e 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -1436,20 +1436,15 @@ ProcRRSetCrtcConfig(ClientPtr client) free(outputs); xRRSetCrtcConfigReply rep = { - .type = X_Reply, .status = status, - .sequenceNumber = client->sequence, .newTimestamp = pScrPriv->lastSetTime.milliseconds }; if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); swapl(&rep.newTimestamp); } - WriteToClient(client, sizeof(xRRSetCrtcConfigReply), &rep); - return Success; + return X_SEND_REPLY_SIMPLE(client, rep); } int @@ -1476,10 +1471,7 @@ ProcRRGetPanning(ClientPtr client) return RRErrorBase + BadRRCrtc; xRRGetPanningReply rep = { - .type = X_Reply, .status = RRSetConfigSuccess, - .sequenceNumber = client->sequence, - .length = 1, .timestamp = pScrPriv->lastSetTime.milliseconds }; @@ -1500,8 +1492,6 @@ ProcRRGetPanning(ClientPtr client) } if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); swapl(&rep.timestamp); swaps(&rep.left); swaps(&rep.top); @@ -1516,8 +1506,7 @@ ProcRRGetPanning(ClientPtr client) swaps(&rep.border_right); swaps(&rep.border_bottom); } - WriteToClient(client, sizeof(xRRGetPanningReply), &rep); - return Success; + return X_SEND_REPLY_SIMPLE(client, rep); } int @@ -1578,18 +1567,14 @@ ProcRRSetPanning(ClientPtr client) sendReply: ; xRRSetPanningReply rep = { - .type = X_Reply, .status = status, - .sequenceNumber = client->sequence, .newTimestamp = pScrPriv->lastSetTime.milliseconds }; if (client->swapped) { - swaps(&rep.sequenceNumber); swapl(&rep.newTimestamp); } - WriteToClient(client, sizeof(xRRSetPanningReply), &rep); - return Success; + return X_SEND_REPLY_SIMPLE(client, rep); } int @@ -1606,17 +1591,12 @@ ProcRRGetCrtcGammaSize(ClientPtr client) return RRErrorBase + BadRRCrtc; xRRGetCrtcGammaSizeReply reply = { - .type = X_Reply, - .sequenceNumber = client->sequence, .size = crtc->gammaSize }; if (client->swapped) { - swaps(&reply.sequenceNumber); - swapl(&reply.length); swaps(&reply.size); } - WriteToClient(client, sizeof(xRRGetCrtcGammaSizeReply), &reply); - return Success; + return X_SEND_REPLY_SIMPLE(client, reply); } int diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c index 3586fe0167..6c1cc8fa78 100644 --- a/randr/rrdispatch.c +++ b/randr/rrdispatch.c @@ -40,10 +40,6 @@ RRClientKnowsRates(ClientPtr pClient) int ProcRRQueryVersion(ClientPtr client) { - xRRQueryVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - }; REQUEST(xRRQueryVersionReq); rrClientPriv(client); @@ -51,25 +47,24 @@ ProcRRQueryVersion(ClientPtr client) pRRClient->major_version = stuff->majorVersion; pRRClient->minor_version = stuff->minorVersion; + xRRQueryVersionReply rep = { + .majorVersion = SERVER_RANDR_MAJOR_VERSION, + .minorVersion = SERVER_RANDR_MINOR_VERSION + }; + if (version_compare(stuff->majorVersion, stuff->minorVersion, SERVER_RANDR_MAJOR_VERSION, SERVER_RANDR_MINOR_VERSION) < 0) { rep.majorVersion = stuff->majorVersion; rep.minorVersion = stuff->minorVersion; } - else { - rep.majorVersion = SERVER_RANDR_MAJOR_VERSION; - rep.minorVersion = SERVER_RANDR_MINOR_VERSION; - } if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); swapl(&rep.majorVersion); swapl(&rep.minorVersion); } - WriteToClient(client, sizeof(xRRQueryVersionReply), &rep); - return Success; + + return X_SEND_REPLY_SIMPLE(client, rep); } int diff --git a/randr/rrlease.c b/randr/rrlease.c index fec2a9ac5b..442c7389bb 100644 --- a/randr/rrlease.c +++ b/randr/rrlease.c @@ -335,19 +335,10 @@ leaseReturned: RRLeaseChangeState(lease, RRLeaseCreating, RRLeaseRunning); xRRCreateLeaseReply rep = { - .type = X_Reply, .nfd = 1, - .sequenceNumber = client->sequence, }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - } - - WriteToClient(client, sizeof (rep), &rep); - - return Success; + return X_SEND_REPLY_SIMPLE(client, rep); bail_lease: free(lease); diff --git a/randr/rrmode.c b/randr/rrmode.c index 1a0633f02a..f0590e4bd8 100644 --- a/randr/rrmode.c +++ b/randr/rrmode.c @@ -315,20 +315,17 @@ ProcRRCreateMode(ClientPtr client) return error; xRRCreateModeReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, .mode = mode->mode.id }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.mode); - } - WriteToClient(client, sizeof(xRRCreateModeReply), &rep); /* Drop out reference to this mode */ RRModeDestroy(mode); - return Success; + + if (client->swapped) { + swapl(&rep.mode); + } + + return X_SEND_REPLY_SIMPLE(client, rep); } int diff --git a/randr/rroutput.c b/randr/rroutput.c index 4b783c1543..ac28fd0745 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -604,17 +604,12 @@ ProcRRGetOutputPrimary(ClientPtr client) primary = pScrPriv->primaryOutput; xRRGetOutputPrimaryReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, .output = primary ? primary->id : None }; if (client->swapped) { - swaps(&rep.sequenceNumber); swapl(&rep.output); } - WriteToClient(client, sizeof(xRRGetOutputPrimaryReply), &rep); - - return Success; + return X_SEND_REPLY_SIMPLE(client, rep); } diff --git a/randr/rrprovider.c b/randr/rrprovider.c index bbbeed76ed..b3de27bb29 100644 --- a/randr/rrprovider.c +++ b/randr/rrprovider.c @@ -87,13 +87,12 @@ ProcRRGetProviders (ClientPtr client) if (!pScrPriv) { - xRRGetProvidersReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, + xRRGetProvidersReply reply = { .timestamp = currentTime.milliseconds, }; - WriteToClient(client, sizeof(rep), &rep); - return Success; + if (client->swapped) + swapl(&reply.timestamp); + return X_SEND_REPLY_SIMPLE(client, reply); } extraLen = total_providers * sizeof(CARD32); diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 3aaab5f4df..2bb8e08613 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -204,10 +204,7 @@ ProcRRGetScreenSizeRange(ClientPtr client) pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); - xRRGetScreenSizeRangeReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - }; + xRRGetScreenSizeRangeReply rep = { 0 }; if (pScrPriv) { if (!RRGetInfo(pScreen, FALSE)) @@ -222,15 +219,12 @@ ProcRRGetScreenSizeRange(ClientPtr client) rep.maxHeight = rep.minHeight = pScreen->height; } if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); swaps(&rep.minWidth); swaps(&rep.minHeight); swaps(&rep.maxWidth); swaps(&rep.maxHeight); } - WriteToClient(client, sizeof(xRRGetScreenSizeRangeReply), &rep); - return Success; + return X_SEND_REPLY_SIMPLE(client, rep); } int @@ -1081,9 +1075,7 @@ ProcRRSetScreenConfig(ClientPtr client) free(pData); xRRSetScreenConfigReply rep = { - .type = X_Reply, .status = status, - .sequenceNumber = client->sequence, .newTimestamp = pScrPriv->lastSetTime.milliseconds, .newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds, .root = pDraw->pScreen->root->drawable.id, @@ -1091,15 +1083,11 @@ ProcRRSetScreenConfig(ClientPtr client) }; if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); swapl(&rep.newTimestamp); swapl(&rep.newConfigTimestamp); swapl(&rep.root); } - WriteToClient(client, sizeof(xRRSetScreenConfigReply), &rep); - - return Success; + return X_SEND_REPLY_SIMPLE(client, rep); } static CARD16 diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c index 22c23a0e91..34c2894250 100644 --- a/randr/rrxinerama.c +++ b/randr/rrxinerama.c @@ -97,21 +97,16 @@ int ProcRRXineramaQueryVersion(ClientPtr client) { xPanoramiXQueryVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, .majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION, .minorVersion = SERVER_RRXINERAMA_MINOR_VERSION }; REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); swaps(&rep.majorVersion); swaps(&rep.minorVersion); } - WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), &rep); - return Success; + return X_SEND_REPLY_SIMPLE(client, rep); } int @@ -137,18 +132,13 @@ ProcRRXineramaGetState(ClientPtr client) } xPanoramiXGetStateReply rep = { - .type = X_Reply, .state = active, - .sequenceNumber = client->sequence, .window = stuff->window }; if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); swapl(&rep.window); } - WriteToClient(client, sizeof(xPanoramiXGetStateReply), &rep); - return Success; + return X_SEND_REPLY_SIMPLE(client, rep); } static int @@ -176,18 +166,13 @@ ProcRRXineramaGetScreenCount(ClientPtr client) return rc; xPanoramiXGetScreenCountReply rep = { - .type = X_Reply, .ScreenCount = RRXineramaScreenCount(pWin->drawable.pScreen), - .sequenceNumber = client->sequence, .window = stuff->window }; if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); swapl(&rep.window); } - WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), &rep); - return Success; + return X_SEND_REPLY_SIMPLE(client, rep); } int @@ -207,43 +192,32 @@ ProcRRXineramaGetScreenSize(ClientPtr client) pRoot = pScreen->root; xPanoramiXGetScreenSizeReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, .width = pRoot->drawable.width, .height = pRoot->drawable.height, .window = stuff->window, .screen = stuff->screen }; if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); swapl(&rep.width); swapl(&rep.height); swapl(&rep.window); swapl(&rep.screen); } - WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), &rep); - return Success; + return X_SEND_REPLY_SIMPLE(client, rep); } int ProcRRXineramaIsActive(ClientPtr client) { - REQUEST_SIZE_MATCH(xXineramaIsActiveReq); xXineramaIsActiveReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, .state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN]) }; if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); swapl(&rep.state); } - WriteToClient(client, sizeof(xXineramaIsActiveReply), &rep); - return Success; + return X_SEND_REPLY_SIMPLE(client, rep); } static void