diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-07-09 19:12:43 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-07-09 19:58:30 -0700 |
commit | bd6f948c41865c2c9d3fba1000bf5f7458d3afc1 (patch) | |
tree | e2560b521406b16c9ecc87602845991d27e35073 /randr/rrscreen.c | |
parent | a406bd07593edb69285cf2fd91a6af4a5d956817 (diff) |
Use C99 designated initializers in randr Replies
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'randr/rrscreen.c')
-rw-r--r-- | randr/rrscreen.c | 124 |
1 files changed, 68 insertions, 56 deletions
diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 6fd24e02d..774f8be52 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -203,10 +203,12 @@ ProcRRGetScreenSizeRange(ClientPtr client) pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); - rep.type = X_Reply; - rep.pad = 0; - rep.sequenceNumber = client->sequence; - rep.length = 0; + rep = (xRRGetScreenSizeRangeReply) { + .type = X_Reply, + .pad = 0, + .sequenceNumber = client->sequence, + .length = 0 + }; if (pScrPriv) { if (!RRGetInfo(pScreen, FALSE)) @@ -481,7 +483,6 @@ rrGetScreenResources(ClientPtr client, Bool query) pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); - rep.pad = 0; if (query && pScrPriv) if (!RRGetInfo(pScreen, query)) @@ -491,15 +492,17 @@ rrGetScreenResources(ClientPtr client, Bool query) return rrGetMultiScreenResources(client, query, pScreen); if (!pScrPriv) { - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = 0; - rep.timestamp = currentTime.milliseconds; - rep.configTimestamp = currentTime.milliseconds; - rep.nCrtcs = 0; - rep.nOutputs = 0; - rep.nModes = 0; - rep.nbytesNames = 0; + rep = (xRRGetScreenResourcesReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .timestamp = currentTime.milliseconds, + .configTimestamp = currentTime.milliseconds, + .nCrtcs = 0, + .nOutputs = 0, + .nModes = 0, + .nbytesNames = 0 + }; extra = NULL; extraLen = 0; } @@ -511,15 +514,18 @@ rrGetScreenResources(ClientPtr client, Bool query) if (!modes) return BadAlloc; - rep.type = X_Reply; - rep.sequenceNumber = client->sequence; - rep.length = 0; - rep.timestamp = pScrPriv->lastSetTime.milliseconds; - rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds; - rep.nCrtcs = pScrPriv->numCrtcs; - rep.nOutputs = pScrPriv->numOutputs; - rep.nModes = num_modes; - rep.nbytesNames = 0; + rep = (xRRGetScreenResourcesReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .timestamp = pScrPriv->lastSetTime.milliseconds, + .configTimestamp = pScrPriv->lastConfigTime.milliseconds, + .nCrtcs = pScrPriv->numCrtcs, + .nOutputs = pScrPriv->numOutputs, + .nModes = num_modes, + .nbytesNames = 0 + }; + for (i = 0; i < num_modes; i++) rep.nbytesNames += modes[i]->mode.nameLength; @@ -744,7 +750,6 @@ ProcRRGetScreenInfo(ClientPtr client) pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); - rep.pad = 0; if (pScrPriv) if (!RRGetInfo(pScreen, TRUE)) @@ -753,18 +758,20 @@ ProcRRGetScreenInfo(ClientPtr client) output = RRFirstOutput(pScreen); if (!pScrPriv || !output) { - rep.type = X_Reply; - rep.setOfRotations = RR_Rotate_0; - rep.sequenceNumber = client->sequence; - rep.length = 0; - rep.root = pWin->drawable.pScreen->root->drawable.id; - rep.timestamp = currentTime.milliseconds; - rep.configTimestamp = currentTime.milliseconds; - rep.nSizes = 0; - rep.sizeID = 0; - rep.rotation = RR_Rotate_0; - rep.rate = 0; - rep.nrateEnts = 0; + rep = (xRRGetScreenInfoReply) { + .type = X_Reply, + .setOfRotations = RR_Rotate_0, + .sequenceNumber = client->sequence, + .length = 0, + .root = pWin->drawable.pScreen->root->drawable.id, + .timestamp = currentTime.milliseconds, + .configTimestamp = currentTime.milliseconds, + .nSizes = 0, + .sizeID = 0, + .rotation = RR_Rotate_0, + .rate = 0, + .nrateEnts = 0 + }; extra = 0; extraLen = 0; } @@ -781,18 +788,20 @@ ProcRRGetScreenInfo(ClientPtr client) if (!pData) return BadAlloc; - rep.type = X_Reply; - rep.setOfRotations = output->crtc->rotations; - rep.sequenceNumber = client->sequence; - rep.length = 0; - rep.root = pWin->drawable.pScreen->root->drawable.id; - rep.timestamp = pScrPriv->lastSetTime.milliseconds; - rep.configTimestamp = pScrPriv->lastConfigTime.milliseconds; - rep.rotation = output->crtc->rotation; - rep.nSizes = pData->nsize; - rep.nrateEnts = pData->nrefresh + pData->nsize; - rep.sizeID = pData->size; - rep.rate = pData->refresh; + rep = (xRRGetScreenInfoReply) { + .type = X_Reply, + .setOfRotations = output->crtc->rotations, + .sequenceNumber = client->sequence, + .length = 0, + .root = pWin->drawable.pScreen->root->drawable.id, + .timestamp = pScrPriv->lastSetTime.milliseconds, + .configTimestamp = pScrPriv->lastConfigTime.milliseconds, + .rotation = output->crtc->rotation, + .nSizes = pData->nsize, + .nrateEnts = pData->nrefresh + pData->nsize, + .sizeID = pData->size, + .rate = pData->refresh + }; extraLen = rep.nSizes * sizeof(xScreenSizes); if (has_rate) @@ -1078,14 +1087,17 @@ ProcRRSetScreenConfig(ClientPtr client) free(pData); - rep.type = X_Reply; - rep.status = status; - rep.length = 0; - rep.sequenceNumber = client->sequence; - - rep.newTimestamp = pScrPriv->lastSetTime.milliseconds; - rep.newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds; - rep.root = pDraw->pScreen->root->drawable.id; + rep = (xRRSetScreenConfigReply) { + .type = X_Reply, + .status = status, + .sequenceNumber = client->sequence, + .length = 0, + + .newTimestamp = pScrPriv->lastSetTime.milliseconds, + .newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds, + .root = pDraw->pScreen->root->drawable.id, + /* .subpixelOrder = ?? */ + }; if (client->swapped) { swaps(&rep.sequenceNumber); |