Revert "randr: use struct initializer for reply structs"

This reverts commit 7eff742ef2.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
This commit is contained in:
Alan Coopersmith 2025-06-11 13:43:47 -07:00
parent 9c53c6cf76
commit 160abf285c
12 changed files with 196 additions and 87 deletions

View File

@ -1022,16 +1022,18 @@ static void
RRModeGetScanoutSize(RRModePtr mode, PictTransformPtr transform, RRModeGetScanoutSize(RRModePtr mode, PictTransformPtr transform,
int *width, int *height) int *width, int *height)
{ {
BoxRec box;
if (mode == NULL) { if (mode == NULL) {
*width = 0; *width = 0;
*height = 0; *height = 0;
return; return;
} }
BoxRec box = { box.x1 = 0;
.x2 = mode->mode.width, box.y1 = 0;
.y2 = mode->mode.height, box.x2 = mode->mode.width;
}; box.y2 = mode->mode.height;
pixman_transform_bounds(transform, &box); pixman_transform_bounds(transform, &box);
*width = box.x2 - box.x1; *width = box.x2 - box.x1;
@ -1145,9 +1147,10 @@ int
ProcRRGetCrtcInfo(ClientPtr client) ProcRRGetCrtcInfo(ClientPtr client)
{ {
REQUEST(xRRGetCrtcInfoReq); REQUEST(xRRGetCrtcInfoReq);
xRRGetCrtcInfoReply rep;
RRCrtcPtr crtc; RRCrtcPtr crtc;
CARD8 *extra = NULL; CARD8 *extra = NULL;
unsigned long extraLen = 0; unsigned long extraLen;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
RRModePtr mode; RRModePtr mode;
@ -1171,17 +1174,22 @@ ProcRRGetCrtcInfo(ClientPtr client)
mode = crtc->mode; mode = crtc->mode;
xRRGetCrtcInfoReply rep = { rep = (xRRGetCrtcInfoReply) {
.type = X_Reply, .type = X_Reply,
.status = RRSetConfigSuccess, .status = RRSetConfigSuccess,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.timestamp = pScrPriv->lastSetTime.milliseconds, .length = 0,
.rotation = crtc->rotation, .timestamp = pScrPriv->lastSetTime.milliseconds
.rotations = crtc->rotations,
}; };
if (leased) { if (leased) {
rep.x = rep.y = rep.width = rep.height = 0;
rep.mode = 0;
rep.rotation = RR_Rotate_0; rep.rotation = RR_Rotate_0;
rep.rotations = RR_Rotate_0; rep.rotations = RR_Rotate_0;
rep.nOutput = 0;
rep.nPossibleOutput = 0;
rep.length = 0;
extraLen = 0;
} else { } else {
if (pScrPriv->rrGetPanning && if (pScrPriv->rrGetPanning &&
pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) && pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) &&
@ -1200,18 +1208,23 @@ ProcRRGetCrtcInfo(ClientPtr client)
rep.height = height; rep.height = height;
} }
rep.mode = mode ? mode->mode.id : 0; rep.mode = mode ? mode->mode.id : 0;
rep.rotation = crtc->rotation;
rep.rotations = crtc->rotations;
rep.nOutput = crtc->numOutputs; rep.nOutput = crtc->numOutputs;
k = 0;
for (i = 0; i < pScrPriv->numOutputs; i++) { for (i = 0; i < pScrPriv->numOutputs; i++) {
if (!RROutputIsLeased(pScrPriv->outputs[i])) { if (!RROutputIsLeased(pScrPriv->outputs[i])) {
for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++) for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
if (pScrPriv->outputs[i]->crtcs[j] == crtc) if (pScrPriv->outputs[i]->crtcs[j] == crtc)
rep.nPossibleOutput++; k++;
} }
} }
extraLen = (rep.nOutput + rep.nPossibleOutput) * sizeof(CARD32); rep.nPossibleOutput = k;
rep.length = bytes_to_int32(extraLen);
rep.length = rep.nOutput + rep.nPossibleOutput;
extraLen = rep.length << 2;
if (extraLen) { if (extraLen) {
extra = malloc(extraLen); extra = malloc(extraLen);
if (!extra) if (!extra)
@ -1270,6 +1283,7 @@ int
ProcRRSetCrtcConfig(ClientPtr client) ProcRRSetCrtcConfig(ClientPtr client)
{ {
REQUEST(xRRSetCrtcConfigReq); REQUEST(xRRSetCrtcConfigReq);
xRRSetCrtcConfigReply rep;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
RRCrtcPtr crtc; RRCrtcPtr crtc;
@ -1461,10 +1475,11 @@ ProcRRSetCrtcConfig(ClientPtr client)
sendReply: sendReply:
free(outputs); free(outputs);
xRRSetCrtcConfigReply rep = { rep = (xRRSetCrtcConfigReply) {
.type = X_Reply, .type = X_Reply,
.status = status, .status = status,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.newTimestamp = pScrPriv->lastSetTime.milliseconds .newTimestamp = pScrPriv->lastSetTime.milliseconds
}; };
@ -1482,6 +1497,7 @@ int
ProcRRGetPanning(ClientPtr client) ProcRRGetPanning(ClientPtr client)
{ {
REQUEST(xRRGetPanningReq); REQUEST(xRRGetPanningReq);
xRRGetPanningReply rep;
RRCrtcPtr crtc; RRCrtcPtr crtc;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
@ -1501,7 +1517,7 @@ ProcRRGetPanning(ClientPtr client)
if (!pScrPriv) if (!pScrPriv)
return RRErrorBase + BadRRCrtc; return RRErrorBase + BadRRCrtc;
xRRGetPanningReply rep = { rep = (xRRGetPanningReply) {
.type = X_Reply, .type = X_Reply,
.status = RRSetConfigSuccess, .status = RRSetConfigSuccess,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
@ -1625,6 +1641,7 @@ int
ProcRRGetCrtcGammaSize(ClientPtr client) ProcRRGetCrtcGammaSize(ClientPtr client)
{ {
REQUEST(xRRGetCrtcGammaSizeReq); REQUEST(xRRGetCrtcGammaSizeReq);
xRRGetCrtcGammaSizeReply reply;
RRCrtcPtr crtc; RRCrtcPtr crtc;
REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq); REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
@ -1634,9 +1651,10 @@ ProcRRGetCrtcGammaSize(ClientPtr client)
if (!RRCrtcGammaGet(crtc)) if (!RRCrtcGammaGet(crtc))
return RRErrorBase + BadRRCrtc; return RRErrorBase + BadRRCrtc;
xRRGetCrtcGammaSizeReply reply = { reply = (xRRGetCrtcGammaSizeReply) {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.size = crtc->gammaSize .size = crtc->gammaSize
}; };
if (client->swapped) { if (client->swapped) {
@ -1652,6 +1670,7 @@ int
ProcRRGetCrtcGamma(ClientPtr client) ProcRRGetCrtcGamma(ClientPtr client)
{ {
REQUEST(xRRGetCrtcGammaReq); REQUEST(xRRGetCrtcGammaReq);
xRRGetCrtcGammaReply reply;
RRCrtcPtr crtc; RRCrtcPtr crtc;
unsigned long len; unsigned long len;
char *extra = NULL; char *extra = NULL;
@ -1671,7 +1690,7 @@ ProcRRGetCrtcGamma(ClientPtr client)
return BadAlloc; return BadAlloc;
} }
xRRGetCrtcGammaReply reply = { reply = (xRRGetCrtcGammaReply) {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = bytes_to_int32(len), .length = bytes_to_int32(len),

View File

@ -42,6 +42,7 @@ ProcRRQueryVersion(ClientPtr client)
xRRQueryVersionReply rep = { xRRQueryVersionReply rep = {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0
}; };
REQUEST(xRRQueryVersionReq); REQUEST(xRRQueryVersionReq);
rrClientPriv(client); rrClientPriv(client);

View File

@ -250,18 +250,19 @@ RRRegisterSize(ScreenPtr pScreen,
{ {
rrScrPriv(pScreen); rrScrPriv(pScreen);
int i; int i;
RRScreenSize tmp;
RRScreenSizePtr pNew; RRScreenSizePtr pNew;
if (!pScrPriv) if (!pScrPriv)
return 0; return 0;
RRScreenSize tmp = { tmp.id = 0;
.width = width, tmp.width = width;
.height = height, tmp.height = height;
.mmWidth = mmWidth, tmp.mmWidth = mmWidth;
.mmHeight = mmHeight, tmp.mmHeight = mmHeight;
}; tmp.pRates = 0;
tmp.nRates = 0;
for (i = 0; i < pScrPriv->nSizes; i++) for (i = 0; i < pScrPriv->nSizes; i++)
if (RRScreenSizeMatches(&tmp, &pScrPriv->pSizes[i])) if (RRScreenSizeMatches(&tmp, &pScrPriv->pSizes[i]))
return &pScrPriv->pSizes[i]; return &pScrPriv->pSizes[i];

View File

@ -213,6 +213,7 @@ int
ProcRRCreateLease(ClientPtr client) ProcRRCreateLease(ClientPtr client)
{ {
REQUEST(xRRCreateLeaseReq); REQUEST(xRRCreateLeaseReq);
xRRCreateLeaseReply rep;
WindowPtr window; WindowPtr window;
ScreenPtr screen; ScreenPtr screen;
rrScrPrivPtr scr_priv; rrScrPrivPtr scr_priv;
@ -333,10 +334,11 @@ leaseReturned:
RRLeaseChangeState(lease, RRLeaseCreating, RRLeaseRunning); RRLeaseChangeState(lease, RRLeaseCreating, RRLeaseRunning);
xRRCreateLeaseReply rep = { rep = (xRRCreateLeaseReply) {
.type = X_Reply, .type = X_Reply,
.nfd = 1, .nfd = 1,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
}; };
if (client->swapped) { if (client->swapped) {

View File

@ -286,6 +286,7 @@ int
ProcRRCreateMode(ClientPtr client) ProcRRCreateMode(ClientPtr client)
{ {
REQUEST(xRRCreateModeReq); REQUEST(xRRCreateModeReq);
xRRCreateModeReply rep;
WindowPtr pWin; WindowPtr pWin;
ScreenPtr pScreen; ScreenPtr pScreen;
xRRModeInfo *modeInfo; xRRModeInfo *modeInfo;
@ -313,12 +314,12 @@ ProcRRCreateMode(ClientPtr client)
if (!mode) if (!mode)
return error; return error;
xRRCreateModeReply rep = { rep = (xRRCreateModeReply) {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.mode = mode->mode.id .mode = mode->mode.id
}; };
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
swapl(&rep.length); swapl(&rep.length);

View File

@ -581,6 +581,11 @@ int
ProcRRGetMonitors(ClientPtr client) ProcRRGetMonitors(ClientPtr client)
{ {
REQUEST(xRRGetMonitorsReq); REQUEST(xRRGetMonitorsReq);
xRRGetMonitorsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
};
WindowPtr window; WindowPtr window;
ScreenPtr screen; ScreenPtr screen;
int r; int r;
@ -599,19 +604,17 @@ ProcRRGetMonitors(ClientPtr client)
if (!RRMonitorMakeList(screen, get_active, &monitors, &nmonitors)) if (!RRMonitorMakeList(screen, get_active, &monitors, &nmonitors))
return BadAlloc; return BadAlloc;
rep.timestamp = RRMonitorTimestamp(screen);
noutputs = 0; noutputs = 0;
for (m = 0; m < nmonitors; m++) { for (m = 0; m < nmonitors; m++) {
rep.length += SIZEOF(xRRMonitorInfo) >> 2;
rep.length += monitors[m].numOutputs;
noutputs += monitors[m].numOutputs; noutputs += monitors[m].numOutputs;
} }
xRRGetMonitorsReply rep = { rep.nmonitors = nmonitors;
.type = X_Reply, rep.noutputs = noutputs;
.sequenceNumber = client->sequence,
.timestamp = RRMonitorTimestamp(screen),
.length = noutputs + nmonitors * bytes_to_int32(sizeof(xRRMonitorInfo)),
.nmonitors = nmonitors,
.noutputs = noutputs,
};
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);

View File

@ -481,8 +481,15 @@ ProcRRGetOutputInfo(ClientPtr client)
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = bytes_to_int32(OutputInfoExtra), .length = bytes_to_int32(OutputInfoExtra),
.timestamp = pScrPriv->lastSetTime.milliseconds, .timestamp = pScrPriv->lastSetTime.milliseconds,
.crtc = None,
.mmWidth = 0,
.mmHeight = 0,
.connection = RR_Disconnected, .connection = RR_Disconnected,
.subpixelOrder = SubPixelUnknown, .subpixelOrder = SubPixelUnknown,
.nCrtcs = 0,
.nModes = 0,
.nPreferred = 0,
.nClones = 0,
.nameLength = output->nameLength .nameLength = output->nameLength
}; };
extraLen = bytes_to_int32(rep.nameLength) << 2; extraLen = bytes_to_int32(rep.nameLength) << 2;
@ -651,6 +658,7 @@ ProcRRGetOutputPrimary(ClientPtr client)
REQUEST(xRRGetOutputPrimaryReq); REQUEST(xRRGetOutputPrimaryReq);
WindowPtr pWin; WindowPtr pWin;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
xRRGetOutputPrimaryReply rep;
RROutputPtr primary = NULL; RROutputPtr primary = NULL;
int rc; int rc;
@ -664,7 +672,7 @@ ProcRRGetOutputPrimary(ClientPtr client)
if (pScrPriv) if (pScrPriv)
primary = pScrPriv->primaryOutput; primary = pScrPriv->primaryOutput;
xRRGetOutputPrimaryReply rep = { rep = (xRRGetOutputPrimaryReply) {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.output = primary ? primary->id : None .output = primary ? primary->id : None

View File

@ -417,6 +417,7 @@ ProcRRListOutputProperties(ClientPtr client)
{ {
REQUEST(xRRListOutputPropertiesReq); REQUEST(xRRListOutputPropertiesReq);
Atom *pAtoms = NULL; Atom *pAtoms = NULL;
xRRListOutputPropertiesReply rep;
int numProps = 0; int numProps = 0;
RROutputPtr output; RROutputPtr output;
RRPropertyPtr prop; RRPropertyPtr prop;
@ -431,7 +432,7 @@ ProcRRListOutputProperties(ClientPtr client)
if (!(pAtoms = xallocarray(numProps, sizeof(Atom)))) if (!(pAtoms = xallocarray(numProps, sizeof(Atom))))
return BadAlloc; return BadAlloc;
xRRListOutputPropertiesReply rep = { rep = (xRRListOutputPropertiesReply) {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = bytes_to_int32(numProps * sizeof(Atom)), .length = bytes_to_int32(numProps * sizeof(Atom)),
@ -461,6 +462,7 @@ int
ProcRRQueryOutputProperty(ClientPtr client) ProcRRQueryOutputProperty(ClientPtr client)
{ {
REQUEST(xRRQueryOutputPropertyReq); REQUEST(xRRQueryOutputPropertyReq);
xRRQueryOutputPropertyReply rep;
RROutputPtr output; RROutputPtr output;
RRPropertyPtr prop; RRPropertyPtr prop;
char *extra = NULL; char *extra = NULL;
@ -479,7 +481,7 @@ ProcRRQueryOutputProperty(ClientPtr client)
return BadAlloc; return BadAlloc;
} }
xRRQueryOutputPropertyReply rep = { rep = (xRRQueryOutputPropertyReply) {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = prop->num_valid, .length = prop->num_valid,
@ -618,6 +620,7 @@ ProcRRGetOutputProperty(ClientPtr client)
RRPropertyValuePtr prop_value; RRPropertyValuePtr prop_value;
unsigned long n, len, ind; unsigned long n, len, ind;
RROutputPtr output; RROutputPtr output;
xRRGetOutputPropertyReply reply;
char *extra = NULL; char *extra = NULL;
REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq); REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
@ -643,14 +646,22 @@ ProcRRGetOutputProperty(ClientPtr client)
if (prop->propertyName == stuff->property) if (prop->propertyName == stuff->property)
break; break;
xRRGetOutputPropertyReply reply = { reply = (xRRGetOutputPropertyReply) {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence .sequenceNumber = client->sequence
}; };
if (!prop) { if (!prop) {
reply.nItems = 0;
reply.length = 0;
reply.bytesAfter = 0;
reply.propertyType = None;
reply.format = 0;
if (client->swapped) { if (client->swapped) {
swaps(&reply.sequenceNumber); swaps(&reply.sequenceNumber);
swapl(&reply.length);
swapl(&reply.propertyType);
swapl(&reply.bytesAfter);
swapl(&reply.nItems);
} }
WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply); WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply);
return Success; return Success;
@ -670,11 +681,15 @@ ProcRRGetOutputProperty(ClientPtr client)
) { ) {
reply.bytesAfter = prop_value->size; reply.bytesAfter = prop_value->size;
reply.format = prop_value->format; reply.format = prop_value->format;
reply.length = 0;
reply.nItems = 0;
reply.propertyType = prop_value->type; reply.propertyType = prop_value->type;
if (client->swapped) { if (client->swapped) {
swaps(&reply.sequenceNumber); swaps(&reply.sequenceNumber);
swapl(&reply.length);
swapl(&reply.propertyType); swapl(&reply.propertyType);
swapl(&reply.bytesAfter); swapl(&reply.bytesAfter);
swapl(&reply.nItems);
} }
WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply); WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply);
return Success; return Success;
@ -706,6 +721,8 @@ ProcRRGetOutputProperty(ClientPtr client)
reply.length = bytes_to_int32(len); reply.length = bytes_to_int32(len);
if (prop_value->format) if (prop_value->format)
reply.nItems = len / (prop_value->format / 8); reply.nItems = len / (prop_value->format / 8);
else
reply.nItems = 0;
reply.propertyType = prop_value->type; reply.propertyType = prop_value->type;
if (stuff->delete && (reply.bytesAfter == 0)) { if (stuff->delete && (reply.bytesAfter == 0)) {

View File

@ -56,6 +56,7 @@ int
ProcRRGetProviders (ClientPtr client) ProcRRGetProviders (ClientPtr client)
{ {
REQUEST(xRRGetProvidersReq); REQUEST(xRRGetProvidersReq);
xRRGetProvidersReply rep;
WindowPtr pWin; WindowPtr pWin;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
@ -86,36 +87,36 @@ ProcRRGetProviders (ClientPtr client)
if (!pScrPriv) if (!pScrPriv)
{ {
xRRGetProvidersReply rep = { rep = (xRRGetProvidersReply) {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.timestamp = currentTime.milliseconds, .timestamp = currentTime.milliseconds,
.nProviders = 0
}; };
WriteToClient(client, sizeof(rep), &rep);
return Success;
}
extraLen = total_providers * sizeof(CARD32);
xRRGetProvidersReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.timestamp = pScrPriv->lastSetTime.milliseconds,
.nProviders = total_providers,
.length = bytes_to_int32(extraLen),
};
if (extraLen) {
extra = malloc(extraLen);
if (!extra)
return BadAlloc;
} else
extra = NULL; extra = NULL;
extraLen = 0;
} else {
rep = (xRRGetProvidersReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.timestamp = pScrPriv->lastSetTime.milliseconds,
.nProviders = total_providers,
.length = total_providers
};
extraLen = rep.length << 2;
if (extraLen) {
extra = malloc(extraLen);
if (!extra)
return BadAlloc;
} else
extra = NULL;
providers = (RRProvider *)extra; providers = (RRProvider *)extra;
ADD_PROVIDER(pScreen); ADD_PROVIDER(pScreen);
xorg_list_for_each_entry(iter, &pScreen->secondary_list, secondary_head) { xorg_list_for_each_entry(iter, &pScreen->secondary_list, secondary_head) {
ADD_PROVIDER(iter); ADD_PROVIDER(iter);
}
} }
if (client->swapped) { if (client->swapped) {
@ -137,6 +138,7 @@ int
ProcRRGetProviderInfo (ClientPtr client) ProcRRGetProviderInfo (ClientPtr client)
{ {
REQUEST(xRRGetProviderInfoReq); REQUEST(xRRGetProviderInfoReq);
xRRGetProviderInfoReply rep;
rrScrPrivPtr pScrPriv, pScrProvPriv; rrScrPrivPtr pScrPriv, pScrProvPriv;
RRProviderPtr provider; RRProviderPtr provider;
ScreenPtr pScreen; ScreenPtr pScreen;
@ -156,15 +158,17 @@ ProcRRGetProviderInfo (ClientPtr client)
pScreen = provider->pScreen; pScreen = provider->pScreen;
pScrPriv = rrGetScrPriv(pScreen); pScrPriv = rrGetScrPriv(pScreen);
xRRGetProviderInfoReply rep = { rep = (xRRGetProviderInfoReply) {
.type = X_Reply, .type = X_Reply,
.status = RRSetConfigSuccess, .status = RRSetConfigSuccess,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.capabilities = provider->capabilities, .capabilities = provider->capabilities,
.nameLength = provider->nameLength, .nameLength = provider->nameLength,
.timestamp = pScrPriv->lastSetTime.milliseconds, .timestamp = pScrPriv->lastSetTime.milliseconds,
.nCrtcs = pScrPriv->numCrtcs, .nCrtcs = pScrPriv->numCrtcs,
.nOutputs = pScrPriv->numOutputs, .nOutputs = pScrPriv->numOutputs,
.nAssociatedProviders = 0
}; };
/* count associated providers */ /* count associated providers */

View File

@ -391,6 +391,7 @@ ProcRRListProviderProperties(ClientPtr client)
{ {
REQUEST(xRRListProviderPropertiesReq); REQUEST(xRRListProviderPropertiesReq);
Atom *pAtoms = NULL, *temppAtoms; Atom *pAtoms = NULL, *temppAtoms;
xRRListProviderPropertiesReply rep;
int numProps = 0; int numProps = 0;
RRProviderPtr provider; RRProviderPtr provider;
RRPropertyPtr prop; RRPropertyPtr prop;
@ -405,7 +406,7 @@ ProcRRListProviderProperties(ClientPtr client)
if (!(pAtoms = xallocarray(numProps, sizeof(Atom)))) if (!(pAtoms = xallocarray(numProps, sizeof(Atom))))
return BadAlloc; return BadAlloc;
xRRListProviderPropertiesReply rep = { rep = (xRRListProviderPropertiesReply) {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = bytes_to_int32(numProps * sizeof(Atom)), .length = bytes_to_int32(numProps * sizeof(Atom)),
@ -433,6 +434,7 @@ int
ProcRRQueryProviderProperty(ClientPtr client) ProcRRQueryProviderProperty(ClientPtr client)
{ {
REQUEST(xRRQueryProviderPropertyReq); REQUEST(xRRQueryProviderPropertyReq);
xRRQueryProviderPropertyReply rep;
RRProviderPtr provider; RRProviderPtr provider;
RRPropertyPtr prop; RRPropertyPtr prop;
char *extra = NULL; char *extra = NULL;
@ -450,8 +452,7 @@ ProcRRQueryProviderProperty(ClientPtr client)
if (!extra) if (!extra)
return BadAlloc; return BadAlloc;
} }
rep = (xRRQueryProviderPropertyReply) {
xRRQueryProviderPropertyReply rep = {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = prop->num_valid, .length = prop->num_valid,
@ -613,8 +614,17 @@ ProcRRGetProviderProperty(ClientPtr client)
break; break;
if (!prop) { if (!prop) {
reply.nItems = 0;
reply.length = 0;
reply.bytesAfter = 0;
reply.propertyType = None;
reply.format = 0;
if (client->swapped) { if (client->swapped) {
swaps(&reply.sequenceNumber); swaps(&reply.sequenceNumber);
swapl(&reply.length);
swapl(&reply.propertyType);
swapl(&reply.bytesAfter);
swapl(&reply.nItems);
} }
WriteToClient(client, sizeof(xRRGetProviderPropertyReply), &reply); WriteToClient(client, sizeof(xRRGetProviderPropertyReply), &reply);
return Success; return Success;
@ -634,11 +644,15 @@ ProcRRGetProviderProperty(ClientPtr client)
) { ) {
reply.bytesAfter = prop_value->size; reply.bytesAfter = prop_value->size;
reply.format = prop_value->format; reply.format = prop_value->format;
reply.length = 0;
reply.nItems = 0;
reply.propertyType = prop_value->type; reply.propertyType = prop_value->type;
if (client->swapped) { if (client->swapped) {
swaps(&reply.sequenceNumber); swaps(&reply.sequenceNumber);
swapl(&reply.length);
swapl(&reply.propertyType); swapl(&reply.propertyType);
swapl(&reply.bytesAfter); swapl(&reply.bytesAfter);
swapl(&reply.nItems);
} }
WriteToClient(client, sizeof(xRRGetProviderPropertyReply), &reply); WriteToClient(client, sizeof(xRRGetProviderPropertyReply), &reply);
return Success; return Success;
@ -670,6 +684,8 @@ ProcRRGetProviderProperty(ClientPtr client)
reply.length = bytes_to_int32(len); reply.length = bytes_to_int32(len);
if (prop_value->format) if (prop_value->format)
reply.nItems = len / (prop_value->format / 8); reply.nItems = len / (prop_value->format / 8);
else
reply.nItems = 0;
reply.propertyType = prop_value->type; reply.propertyType = prop_value->type;
if (stuff->delete && (reply.bytesAfter == 0)) { if (stuff->delete && (reply.bytesAfter == 0)) {

View File

@ -76,6 +76,8 @@ RRSendConfigNotify(ScreenPtr pScreen)
xEvent event = { xEvent event = {
.u.configureNotify.window = pWin->drawable.id, .u.configureNotify.window = pWin->drawable.id,
.u.configureNotify.aboveSibling = None, .u.configureNotify.aboveSibling = None,
.u.configureNotify.x = 0,
.u.configureNotify.y = 0,
/* XXX xinerama stuff ? */ /* XXX xinerama stuff ? */
@ -190,6 +192,7 @@ int
ProcRRGetScreenSizeRange(ClientPtr client) ProcRRGetScreenSizeRange(ClientPtr client)
{ {
REQUEST(xRRGetScreenSizeRangeReq); REQUEST(xRRGetScreenSizeRangeReq);
xRRGetScreenSizeRangeReply rep;
WindowPtr pWin; WindowPtr pWin;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
@ -203,9 +206,11 @@ ProcRRGetScreenSizeRange(ClientPtr client)
pScreen = pWin->drawable.pScreen; pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen); pScrPriv = rrGetScrPriv(pScreen);
xRRGetScreenSizeRangeReply rep = { rep = (xRRGetScreenSizeRangeReply) {
.type = X_Reply, .type = X_Reply,
.pad = 0,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0
}; };
if (pScrPriv) { if (pScrPriv) {
@ -367,6 +372,7 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen)
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
int num_modes; int num_modes;
RRModePtr *modes; RRModePtr *modes;
xRRGetScreenResourcesReply rep;
unsigned long extraLen; unsigned long extraLen;
CARD8 *extra; CARD8 *extra;
RRCrtc *crtcs; RRCrtc *crtcs;
@ -403,10 +409,10 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen)
} }
pScrPriv = rrGetScrPriv(pScreen); pScrPriv = rrGetScrPriv(pScreen);
rep = (xRRGetScreenResourcesReply) {
xRRGetScreenResourcesReply rep = {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.timestamp = pScrPriv->lastSetTime.milliseconds, .timestamp = pScrPriv->lastSetTime.milliseconds,
.configTimestamp = pScrPriv->lastConfigTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds,
.nCrtcs = total_crtcs, .nCrtcs = total_crtcs,
@ -485,8 +491,8 @@ rrGetScreenResources(ClientPtr client, Bool query)
WindowPtr pWin; WindowPtr pWin;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
CARD8 *extra = NULL; CARD8 *extra;
unsigned long extraLen = 0; unsigned long extraLen;
int i, rc, has_primary = 0; int i, rc, has_primary = 0;
RRCrtc *crtcs; RRCrtc *crtcs;
RROutput *outputs; RROutput *outputs;
@ -512,9 +518,16 @@ rrGetScreenResources(ClientPtr client, Bool query)
rep = (xRRGetScreenResourcesReply) { rep = (xRRGetScreenResourcesReply) {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.timestamp = currentTime.milliseconds, .timestamp = currentTime.milliseconds,
.configTimestamp = currentTime.milliseconds, .configTimestamp = currentTime.milliseconds,
.nCrtcs = 0,
.nOutputs = 0,
.nModes = 0,
.nbytesNames = 0
}; };
extra = NULL;
extraLen = 0;
} }
else { else {
RRModePtr *modes; RRModePtr *modes;
@ -527,13 +540,16 @@ rrGetScreenResources(ClientPtr client, Bool query)
rep = (xRRGetScreenResourcesReply) { rep = (xRRGetScreenResourcesReply) {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.timestamp = pScrPriv->lastSetTime.milliseconds, .timestamp = pScrPriv->lastSetTime.milliseconds,
.configTimestamp = pScrPriv->lastConfigTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds,
.nCrtcs = pScrPriv->numCrtcs, .nCrtcs = pScrPriv->numCrtcs,
.nOutputs = pScrPriv->numOutputs, .nOutputs = pScrPriv->numOutputs,
.nModes = num_modes, .nModes = num_modes,
.nbytesNames = 0
}; };
for (i = 0; i < num_modes; i++) for (i = 0; i < num_modes; i++)
rep.nbytesNames += modes[i]->mode.nameLength; rep.nbytesNames += modes[i]->mode.nameLength;
@ -746,8 +762,8 @@ ProcRRGetScreenInfo(ClientPtr client)
int rc; int rc;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
CARD8 *extra = NULL; CARD8 *extra;
unsigned long extraLen = 0; unsigned long extraLen;
RROutputPtr output; RROutputPtr output;
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
@ -769,11 +785,18 @@ ProcRRGetScreenInfo(ClientPtr client)
.type = X_Reply, .type = X_Reply,
.setOfRotations = RR_Rotate_0, .setOfRotations = RR_Rotate_0,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.root = pWin->drawable.pScreen->root->drawable.id, .root = pWin->drawable.pScreen->root->drawable.id,
.timestamp = currentTime.milliseconds, .timestamp = currentTime.milliseconds,
.configTimestamp = currentTime.milliseconds, .configTimestamp = currentTime.milliseconds,
.nSizes = 0,
.sizeID = 0,
.rotation = RR_Rotate_0, .rotation = RR_Rotate_0,
.rate = 0,
.nrateEnts = 0
}; };
extra = 0;
extraLen = 0;
} }
else { else {
int i, j; int i, j;
@ -792,6 +815,7 @@ ProcRRGetScreenInfo(ClientPtr client)
.type = X_Reply, .type = X_Reply,
.setOfRotations = output->crtc->rotations, .setOfRotations = output->crtc->rotations,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.root = pWin->drawable.pScreen->root->drawable.id, .root = pWin->drawable.pScreen->root->drawable.id,
.timestamp = pScrPriv->lastSetTime.milliseconds, .timestamp = pScrPriv->lastSetTime.milliseconds,
.configTimestamp = pScrPriv->lastConfigTime.milliseconds, .configTimestamp = pScrPriv->lastConfigTime.milliseconds,
@ -881,6 +905,7 @@ int
ProcRRSetScreenConfig(ClientPtr client) ProcRRSetScreenConfig(ClientPtr client)
{ {
REQUEST(xRRSetScreenConfigReq); REQUEST(xRRSetScreenConfigReq);
xRRSetScreenConfigReply rep;
DrawablePtr pDraw; DrawablePtr pDraw;
int rc; int rc;
ScreenPtr pScreen; ScreenPtr pScreen;
@ -1085,10 +1110,12 @@ ProcRRSetScreenConfig(ClientPtr client)
free(pData); free(pData);
xRRSetScreenConfigReply rep = { rep = (xRRSetScreenConfigReply) {
.type = X_Reply, .type = X_Reply,
.status = status, .status = status,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.newTimestamp = pScrPriv->lastSetTime.milliseconds, .newTimestamp = pScrPriv->lastSetTime.milliseconds,
.newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds, .newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds,
.root = pDraw->pScreen->root->drawable.id, .root = pDraw->pScreen->root->drawable.id,

View File

@ -99,6 +99,7 @@ ProcRRXineramaQueryVersion(ClientPtr client)
xPanoramiXQueryVersionReply rep = { xPanoramiXQueryVersionReply rep = {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION, .majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION,
.minorVersion = SERVER_RRXINERAMA_MINOR_VERSION .minorVersion = SERVER_RRXINERAMA_MINOR_VERSION
}; };
@ -119,6 +120,7 @@ ProcRRXineramaGetState(ClientPtr client)
{ {
REQUEST(xPanoramiXGetStateReq); REQUEST(xPanoramiXGetStateReq);
WindowPtr pWin; WindowPtr pWin;
xPanoramiXGetStateReply rep;
register int rc; register int rc;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
@ -136,10 +138,11 @@ ProcRRXineramaGetState(ClientPtr client)
active = TRUE; active = TRUE;
} }
xPanoramiXGetStateReply rep = { rep = (xPanoramiXGetStateReply) {
.type = X_Reply, .type = X_Reply,
.state = active, .state = active,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.window = stuff->window .window = stuff->window
}; };
if (client->swapped) { if (client->swapped) {
@ -168,6 +171,7 @@ ProcRRXineramaGetScreenCount(ClientPtr client)
{ {
REQUEST(xPanoramiXGetScreenCountReq); REQUEST(xPanoramiXGetScreenCountReq);
WindowPtr pWin; WindowPtr pWin;
xPanoramiXGetScreenCountReply rep;
register int rc; register int rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
@ -175,10 +179,11 @@ ProcRRXineramaGetScreenCount(ClientPtr client)
if (rc != Success) if (rc != Success)
return rc; return rc;
xPanoramiXGetScreenCountReply rep = { rep = (xPanoramiXGetScreenCountReply) {
.type = X_Reply, .type = X_Reply,
.ScreenCount = RRXineramaScreenCount(pWin->drawable.pScreen), .ScreenCount = RRXineramaScreenCount(pWin->drawable.pScreen),
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.window = stuff->window .window = stuff->window
}; };
if (client->swapped) { if (client->swapped) {
@ -196,6 +201,7 @@ ProcRRXineramaGetScreenSize(ClientPtr client)
REQUEST(xPanoramiXGetScreenSizeReq); REQUEST(xPanoramiXGetScreenSizeReq);
WindowPtr pWin, pRoot; WindowPtr pWin, pRoot;
ScreenPtr pScreen; ScreenPtr pScreen;
xPanoramiXGetScreenSizeReply rep;
register int rc; register int rc;
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
@ -206,9 +212,10 @@ ProcRRXineramaGetScreenSize(ClientPtr client)
pScreen = pWin->drawable.pScreen; pScreen = pWin->drawable.pScreen;
pRoot = pScreen->root; pRoot = pScreen->root;
xPanoramiXGetScreenSizeReply rep = { rep = (xPanoramiXGetScreenSizeReply) {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = 0,
.width = pRoot->drawable.width, .width = pRoot->drawable.width,
.height = pRoot->drawable.height, .height = pRoot->drawable.height,
.window = stuff->window, .window = stuff->window,
@ -229,11 +236,13 @@ ProcRRXineramaGetScreenSize(ClientPtr client)
int int
ProcRRXineramaIsActive(ClientPtr client) ProcRRXineramaIsActive(ClientPtr client)
{ {
xXineramaIsActiveReply rep;
REQUEST_SIZE_MATCH(xXineramaIsActiveReq); REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
xXineramaIsActiveReply rep = { rep = (xXineramaIsActiveReply) {
.type = X_Reply, .type = X_Reply,
.length = 0,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN]) .state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN])
}; };
@ -249,12 +258,12 @@ ProcRRXineramaIsActive(ClientPtr client)
static void static void
RRXineramaWriteMonitor(ClientPtr client, RRMonitorPtr monitor) RRXineramaWriteMonitor(ClientPtr client, RRMonitorPtr monitor)
{ {
xXineramaScreenInfo scratch = { xXineramaScreenInfo scratch;
.x_org = monitor->geometry.box.x1,
.y_org = monitor->geometry.box.y1, scratch.x_org = monitor->geometry.box.x1;
.width = monitor->geometry.box.x2 - monitor->geometry.box.x1, scratch.y_org = monitor->geometry.box.y1;
.height = monitor->geometry.box.y2 - monitor->geometry.box.y1, scratch.width = monitor->geometry.box.x2 - monitor->geometry.box.x1;
}; scratch.height = monitor->geometry.box.y2 - monitor->geometry.box.y1;
if (client->swapped) { if (client->swapped) {
swaps(&scratch.x_org); swaps(&scratch.x_org);
@ -269,6 +278,7 @@ RRXineramaWriteMonitor(ClientPtr client, RRMonitorPtr monitor)
int int
ProcRRXineramaQueryScreens(ClientPtr client) ProcRRXineramaQueryScreens(ClientPtr client)
{ {
xXineramaQueryScreensReply rep;
ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN]; ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN];
int m; int m;
RRMonitorPtr monitors = NULL; RRMonitorPtr monitors = NULL;
@ -282,7 +292,7 @@ ProcRRXineramaQueryScreens(ClientPtr client)
return BadAlloc; return BadAlloc;
} }
xXineramaQueryScreensReply rep = { rep = (xXineramaQueryScreensReply) {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.length = bytes_to_int32(nmonitors * sz_XineramaScreenInfo), .length = bytes_to_int32(nmonitors * sz_XineramaScreenInfo),