randr: use struct initializer for reply structs
Improve readability, move the declarations to where they're needed first and get rid of extra individual assignments. In some cases this should also allow the compiler to produce a bit more efficient code. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
This commit is contained in:
parent
6d2c42d0c8
commit
7eff742ef2
|
@ -1022,18 +1022,16 @@ static void
|
|||
RRModeGetScanoutSize(RRModePtr mode, PictTransformPtr transform,
|
||||
int *width, int *height)
|
||||
{
|
||||
BoxRec box;
|
||||
|
||||
if (mode == NULL) {
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
box.x1 = 0;
|
||||
box.y1 = 0;
|
||||
box.x2 = mode->mode.width;
|
||||
box.y2 = mode->mode.height;
|
||||
BoxRec box = {
|
||||
.x2 = mode->mode.width,
|
||||
.y2 = mode->mode.height,
|
||||
};
|
||||
|
||||
pixman_transform_bounds(transform, &box);
|
||||
*width = box.x2 - box.x1;
|
||||
|
@ -1147,10 +1145,9 @@ int
|
|||
ProcRRGetCrtcInfo(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRGetCrtcInfoReq);
|
||||
xRRGetCrtcInfoReply rep;
|
||||
RRCrtcPtr crtc;
|
||||
CARD8 *extra = NULL;
|
||||
unsigned long extraLen;
|
||||
unsigned long extraLen = 0;
|
||||
ScreenPtr pScreen;
|
||||
rrScrPrivPtr pScrPriv;
|
||||
RRModePtr mode;
|
||||
|
@ -1174,22 +1171,17 @@ ProcRRGetCrtcInfo(ClientPtr client)
|
|||
|
||||
mode = crtc->mode;
|
||||
|
||||
rep = (xRRGetCrtcInfoReply) {
|
||||
xRRGetCrtcInfoReply rep = {
|
||||
.type = X_Reply,
|
||||
.status = RRSetConfigSuccess,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.timestamp = pScrPriv->lastSetTime.milliseconds
|
||||
.timestamp = pScrPriv->lastSetTime.milliseconds,
|
||||
.rotation = crtc->rotation,
|
||||
.rotations = crtc->rotations,
|
||||
};
|
||||
if (leased) {
|
||||
rep.x = rep.y = rep.width = rep.height = 0;
|
||||
rep.mode = 0;
|
||||
rep.rotation = RR_Rotate_0;
|
||||
rep.rotations = RR_Rotate_0;
|
||||
rep.nOutput = 0;
|
||||
rep.nPossibleOutput = 0;
|
||||
rep.length = 0;
|
||||
extraLen = 0;
|
||||
} else {
|
||||
if (pScrPriv->rrGetPanning &&
|
||||
pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) &&
|
||||
|
@ -1208,23 +1200,18 @@ ProcRRGetCrtcInfo(ClientPtr client)
|
|||
rep.height = height;
|
||||
}
|
||||
rep.mode = mode ? mode->mode.id : 0;
|
||||
rep.rotation = crtc->rotation;
|
||||
rep.rotations = crtc->rotations;
|
||||
rep.nOutput = crtc->numOutputs;
|
||||
k = 0;
|
||||
for (i = 0; i < pScrPriv->numOutputs; i++) {
|
||||
if (!RROutputIsLeased(pScrPriv->outputs[i])) {
|
||||
for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
|
||||
if (pScrPriv->outputs[i]->crtcs[j] == crtc)
|
||||
k++;
|
||||
rep.nPossibleOutput++;
|
||||
}
|
||||
}
|
||||
|
||||
rep.nPossibleOutput = k;
|
||||
extraLen = (rep.nOutput + rep.nPossibleOutput) * sizeof(CARD32);
|
||||
rep.length = bytes_to_int32(extraLen);
|
||||
|
||||
rep.length = rep.nOutput + rep.nPossibleOutput;
|
||||
|
||||
extraLen = rep.length << 2;
|
||||
if (extraLen) {
|
||||
extra = malloc(extraLen);
|
||||
if (!extra)
|
||||
|
@ -1283,7 +1270,6 @@ int
|
|||
ProcRRSetCrtcConfig(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRSetCrtcConfigReq);
|
||||
xRRSetCrtcConfigReply rep;
|
||||
ScreenPtr pScreen;
|
||||
rrScrPrivPtr pScrPriv;
|
||||
RRCrtcPtr crtc;
|
||||
|
@ -1475,11 +1461,10 @@ ProcRRSetCrtcConfig(ClientPtr client)
|
|||
sendReply:
|
||||
free(outputs);
|
||||
|
||||
rep = (xRRSetCrtcConfigReply) {
|
||||
xRRSetCrtcConfigReply rep = {
|
||||
.type = X_Reply,
|
||||
.status = status,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.newTimestamp = pScrPriv->lastSetTime.milliseconds
|
||||
};
|
||||
|
||||
|
@ -1497,7 +1482,6 @@ int
|
|||
ProcRRGetPanning(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRGetPanningReq);
|
||||
xRRGetPanningReply rep;
|
||||
RRCrtcPtr crtc;
|
||||
ScreenPtr pScreen;
|
||||
rrScrPrivPtr pScrPriv;
|
||||
|
@ -1517,7 +1501,7 @@ ProcRRGetPanning(ClientPtr client)
|
|||
if (!pScrPriv)
|
||||
return RRErrorBase + BadRRCrtc;
|
||||
|
||||
rep = (xRRGetPanningReply) {
|
||||
xRRGetPanningReply rep = {
|
||||
.type = X_Reply,
|
||||
.status = RRSetConfigSuccess,
|
||||
.sequenceNumber = client->sequence,
|
||||
|
@ -1641,7 +1625,6 @@ int
|
|||
ProcRRGetCrtcGammaSize(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRGetCrtcGammaSizeReq);
|
||||
xRRGetCrtcGammaSizeReply reply;
|
||||
RRCrtcPtr crtc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
|
||||
|
@ -1651,10 +1634,9 @@ ProcRRGetCrtcGammaSize(ClientPtr client)
|
|||
if (!RRCrtcGammaGet(crtc))
|
||||
return RRErrorBase + BadRRCrtc;
|
||||
|
||||
reply = (xRRGetCrtcGammaSizeReply) {
|
||||
xRRGetCrtcGammaSizeReply reply = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.size = crtc->gammaSize
|
||||
};
|
||||
if (client->swapped) {
|
||||
|
@ -1670,7 +1652,6 @@ int
|
|||
ProcRRGetCrtcGamma(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRGetCrtcGammaReq);
|
||||
xRRGetCrtcGammaReply reply;
|
||||
RRCrtcPtr crtc;
|
||||
unsigned long len;
|
||||
char *extra = NULL;
|
||||
|
@ -1690,7 +1671,7 @@ ProcRRGetCrtcGamma(ClientPtr client)
|
|||
return BadAlloc;
|
||||
}
|
||||
|
||||
reply = (xRRGetCrtcGammaReply) {
|
||||
xRRGetCrtcGammaReply reply = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(len),
|
||||
|
|
|
@ -42,7 +42,6 @@ ProcRRQueryVersion(ClientPtr client)
|
|||
xRRQueryVersionReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
};
|
||||
REQUEST(xRRQueryVersionReq);
|
||||
rrClientPriv(client);
|
||||
|
|
|
@ -250,19 +250,18 @@ RRRegisterSize(ScreenPtr pScreen,
|
|||
{
|
||||
rrScrPriv(pScreen);
|
||||
int i;
|
||||
RRScreenSize tmp;
|
||||
RRScreenSizePtr pNew;
|
||||
|
||||
if (!pScrPriv)
|
||||
return 0;
|
||||
|
||||
tmp.id = 0;
|
||||
tmp.width = width;
|
||||
tmp.height = height;
|
||||
tmp.mmWidth = mmWidth;
|
||||
tmp.mmHeight = mmHeight;
|
||||
tmp.pRates = 0;
|
||||
tmp.nRates = 0;
|
||||
RRScreenSize tmp = {
|
||||
.width = width,
|
||||
.height = height,
|
||||
.mmWidth = mmWidth,
|
||||
.mmHeight = mmHeight,
|
||||
};
|
||||
|
||||
for (i = 0; i < pScrPriv->nSizes; i++)
|
||||
if (RRScreenSizeMatches(&tmp, &pScrPriv->pSizes[i]))
|
||||
return &pScrPriv->pSizes[i];
|
||||
|
|
|
@ -213,7 +213,6 @@ int
|
|||
ProcRRCreateLease(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRCreateLeaseReq);
|
||||
xRRCreateLeaseReply rep;
|
||||
WindowPtr window;
|
||||
ScreenPtr screen;
|
||||
rrScrPrivPtr scr_priv;
|
||||
|
@ -334,11 +333,10 @@ leaseReturned:
|
|||
|
||||
RRLeaseChangeState(lease, RRLeaseCreating, RRLeaseRunning);
|
||||
|
||||
rep = (xRRCreateLeaseReply) {
|
||||
xRRCreateLeaseReply rep = {
|
||||
.type = X_Reply,
|
||||
.nfd = 1,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
|
|
|
@ -286,7 +286,6 @@ int
|
|||
ProcRRCreateMode(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRCreateModeReq);
|
||||
xRRCreateModeReply rep;
|
||||
WindowPtr pWin;
|
||||
ScreenPtr pScreen;
|
||||
xRRModeInfo *modeInfo;
|
||||
|
@ -314,12 +313,12 @@ ProcRRCreateMode(ClientPtr client)
|
|||
if (!mode)
|
||||
return error;
|
||||
|
||||
rep = (xRRCreateModeReply) {
|
||||
xRRCreateModeReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.mode = mode->mode.id
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
|
|
|
@ -581,11 +581,6 @@ int
|
|||
ProcRRGetMonitors(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRGetMonitorsReq);
|
||||
xRRGetMonitorsReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
};
|
||||
WindowPtr window;
|
||||
ScreenPtr screen;
|
||||
int r;
|
||||
|
@ -604,17 +599,19 @@ ProcRRGetMonitors(ClientPtr client)
|
|||
if (!RRMonitorMakeList(screen, get_active, &monitors, &nmonitors))
|
||||
return BadAlloc;
|
||||
|
||||
rep.timestamp = RRMonitorTimestamp(screen);
|
||||
|
||||
noutputs = 0;
|
||||
for (m = 0; m < nmonitors; m++) {
|
||||
rep.length += SIZEOF(xRRMonitorInfo) >> 2;
|
||||
rep.length += monitors[m].numOutputs;
|
||||
noutputs += monitors[m].numOutputs;
|
||||
}
|
||||
|
||||
rep.nmonitors = nmonitors;
|
||||
rep.noutputs = noutputs;
|
||||
xRRGetMonitorsReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.timestamp = RRMonitorTimestamp(screen),
|
||||
.length = noutputs + nmonitors * bytes_to_int32(sizeof(xRRMonitorInfo)),
|
||||
.nmonitors = nmonitors,
|
||||
.noutputs = noutputs,
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
|
|
|
@ -481,15 +481,8 @@ ProcRRGetOutputInfo(ClientPtr client)
|
|||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(OutputInfoExtra),
|
||||
.timestamp = pScrPriv->lastSetTime.milliseconds,
|
||||
.crtc = None,
|
||||
.mmWidth = 0,
|
||||
.mmHeight = 0,
|
||||
.connection = RR_Disconnected,
|
||||
.subpixelOrder = SubPixelUnknown,
|
||||
.nCrtcs = 0,
|
||||
.nModes = 0,
|
||||
.nPreferred = 0,
|
||||
.nClones = 0,
|
||||
.nameLength = output->nameLength
|
||||
};
|
||||
extraLen = bytes_to_int32(rep.nameLength) << 2;
|
||||
|
@ -658,7 +651,6 @@ ProcRRGetOutputPrimary(ClientPtr client)
|
|||
REQUEST(xRRGetOutputPrimaryReq);
|
||||
WindowPtr pWin;
|
||||
rrScrPrivPtr pScrPriv;
|
||||
xRRGetOutputPrimaryReply rep;
|
||||
RROutputPtr primary = NULL;
|
||||
int rc;
|
||||
|
||||
|
@ -672,7 +664,7 @@ ProcRRGetOutputPrimary(ClientPtr client)
|
|||
if (pScrPriv)
|
||||
primary = pScrPriv->primaryOutput;
|
||||
|
||||
rep = (xRRGetOutputPrimaryReply) {
|
||||
xRRGetOutputPrimaryReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.output = primary ? primary->id : None
|
||||
|
|
|
@ -417,7 +417,6 @@ ProcRRListOutputProperties(ClientPtr client)
|
|||
{
|
||||
REQUEST(xRRListOutputPropertiesReq);
|
||||
Atom *pAtoms = NULL;
|
||||
xRRListOutputPropertiesReply rep;
|
||||
int numProps = 0;
|
||||
RROutputPtr output;
|
||||
RRPropertyPtr prop;
|
||||
|
@ -432,7 +431,7 @@ ProcRRListOutputProperties(ClientPtr client)
|
|||
if (!(pAtoms = xallocarray(numProps, sizeof(Atom))))
|
||||
return BadAlloc;
|
||||
|
||||
rep = (xRRListOutputPropertiesReply) {
|
||||
xRRListOutputPropertiesReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(numProps * sizeof(Atom)),
|
||||
|
@ -462,7 +461,6 @@ int
|
|||
ProcRRQueryOutputProperty(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRQueryOutputPropertyReq);
|
||||
xRRQueryOutputPropertyReply rep;
|
||||
RROutputPtr output;
|
||||
RRPropertyPtr prop;
|
||||
char *extra = NULL;
|
||||
|
@ -481,7 +479,7 @@ ProcRRQueryOutputProperty(ClientPtr client)
|
|||
return BadAlloc;
|
||||
}
|
||||
|
||||
rep = (xRRQueryOutputPropertyReply) {
|
||||
xRRQueryOutputPropertyReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = prop->num_valid,
|
||||
|
@ -620,7 +618,6 @@ ProcRRGetOutputProperty(ClientPtr client)
|
|||
RRPropertyValuePtr prop_value;
|
||||
unsigned long n, len, ind;
|
||||
RROutputPtr output;
|
||||
xRRGetOutputPropertyReply reply;
|
||||
char *extra = NULL;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
|
||||
|
@ -646,22 +643,14 @@ ProcRRGetOutputProperty(ClientPtr client)
|
|||
if (prop->propertyName == stuff->property)
|
||||
break;
|
||||
|
||||
reply = (xRRGetOutputPropertyReply) {
|
||||
xRRGetOutputPropertyReply reply = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence
|
||||
};
|
||||
|
||||
if (!prop) {
|
||||
reply.nItems = 0;
|
||||
reply.length = 0;
|
||||
reply.bytesAfter = 0;
|
||||
reply.propertyType = None;
|
||||
reply.format = 0;
|
||||
if (client->swapped) {
|
||||
swaps(&reply.sequenceNumber);
|
||||
swapl(&reply.length);
|
||||
swapl(&reply.propertyType);
|
||||
swapl(&reply.bytesAfter);
|
||||
swapl(&reply.nItems);
|
||||
}
|
||||
WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply);
|
||||
return Success;
|
||||
|
@ -681,15 +670,11 @@ ProcRRGetOutputProperty(ClientPtr client)
|
|||
) {
|
||||
reply.bytesAfter = prop_value->size;
|
||||
reply.format = prop_value->format;
|
||||
reply.length = 0;
|
||||
reply.nItems = 0;
|
||||
reply.propertyType = prop_value->type;
|
||||
if (client->swapped) {
|
||||
swaps(&reply.sequenceNumber);
|
||||
swapl(&reply.length);
|
||||
swapl(&reply.propertyType);
|
||||
swapl(&reply.bytesAfter);
|
||||
swapl(&reply.nItems);
|
||||
}
|
||||
WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply);
|
||||
return Success;
|
||||
|
@ -721,8 +706,6 @@ ProcRRGetOutputProperty(ClientPtr client)
|
|||
reply.length = bytes_to_int32(len);
|
||||
if (prop_value->format)
|
||||
reply.nItems = len / (prop_value->format / 8);
|
||||
else
|
||||
reply.nItems = 0;
|
||||
reply.propertyType = prop_value->type;
|
||||
|
||||
if (stuff->delete && (reply.bytesAfter == 0)) {
|
||||
|
|
|
@ -56,7 +56,6 @@ int
|
|||
ProcRRGetProviders (ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRGetProvidersReq);
|
||||
xRRGetProvidersReply rep;
|
||||
WindowPtr pWin;
|
||||
ScreenPtr pScreen;
|
||||
rrScrPrivPtr pScrPriv;
|
||||
|
@ -87,24 +86,25 @@ ProcRRGetProviders (ClientPtr client)
|
|||
|
||||
if (!pScrPriv)
|
||||
{
|
||||
rep = (xRRGetProvidersReply) {
|
||||
xRRGetProvidersReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.timestamp = currentTime.milliseconds,
|
||||
.nProviders = 0
|
||||
};
|
||||
extra = NULL;
|
||||
extraLen = 0;
|
||||
} else {
|
||||
rep = (xRRGetProvidersReply) {
|
||||
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 = total_providers
|
||||
.length = bytes_to_int32(extraLen),
|
||||
};
|
||||
extraLen = rep.length << 2;
|
||||
|
||||
if (extraLen) {
|
||||
extra = malloc(extraLen);
|
||||
if (!extra)
|
||||
|
@ -117,7 +117,6 @@ ProcRRGetProviders (ClientPtr client)
|
|||
xorg_list_for_each_entry(iter, &pScreen->secondary_list, secondary_head) {
|
||||
ADD_PROVIDER(iter);
|
||||
}
|
||||
}
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
|
@ -138,7 +137,6 @@ int
|
|||
ProcRRGetProviderInfo (ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRGetProviderInfoReq);
|
||||
xRRGetProviderInfoReply rep;
|
||||
rrScrPrivPtr pScrPriv, pScrProvPriv;
|
||||
RRProviderPtr provider;
|
||||
ScreenPtr pScreen;
|
||||
|
@ -158,17 +156,15 @@ ProcRRGetProviderInfo (ClientPtr client)
|
|||
pScreen = provider->pScreen;
|
||||
pScrPriv = rrGetScrPriv(pScreen);
|
||||
|
||||
rep = (xRRGetProviderInfoReply) {
|
||||
xRRGetProviderInfoReply rep = {
|
||||
.type = X_Reply,
|
||||
.status = RRSetConfigSuccess,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.capabilities = provider->capabilities,
|
||||
.nameLength = provider->nameLength,
|
||||
.timestamp = pScrPriv->lastSetTime.milliseconds,
|
||||
.nCrtcs = pScrPriv->numCrtcs,
|
||||
.nOutputs = pScrPriv->numOutputs,
|
||||
.nAssociatedProviders = 0
|
||||
};
|
||||
|
||||
/* count associated providers */
|
||||
|
|
|
@ -391,7 +391,6 @@ ProcRRListProviderProperties(ClientPtr client)
|
|||
{
|
||||
REQUEST(xRRListProviderPropertiesReq);
|
||||
Atom *pAtoms = NULL, *temppAtoms;
|
||||
xRRListProviderPropertiesReply rep;
|
||||
int numProps = 0;
|
||||
RRProviderPtr provider;
|
||||
RRPropertyPtr prop;
|
||||
|
@ -406,7 +405,7 @@ ProcRRListProviderProperties(ClientPtr client)
|
|||
if (!(pAtoms = xallocarray(numProps, sizeof(Atom))))
|
||||
return BadAlloc;
|
||||
|
||||
rep = (xRRListProviderPropertiesReply) {
|
||||
xRRListProviderPropertiesReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(numProps * sizeof(Atom)),
|
||||
|
@ -434,7 +433,6 @@ int
|
|||
ProcRRQueryProviderProperty(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRQueryProviderPropertyReq);
|
||||
xRRQueryProviderPropertyReply rep;
|
||||
RRProviderPtr provider;
|
||||
RRPropertyPtr prop;
|
||||
char *extra = NULL;
|
||||
|
@ -452,7 +450,8 @@ ProcRRQueryProviderProperty(ClientPtr client)
|
|||
if (!extra)
|
||||
return BadAlloc;
|
||||
}
|
||||
rep = (xRRQueryProviderPropertyReply) {
|
||||
|
||||
xRRQueryProviderPropertyReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = prop->num_valid,
|
||||
|
@ -614,17 +613,8 @@ ProcRRGetProviderProperty(ClientPtr client)
|
|||
break;
|
||||
|
||||
if (!prop) {
|
||||
reply.nItems = 0;
|
||||
reply.length = 0;
|
||||
reply.bytesAfter = 0;
|
||||
reply.propertyType = None;
|
||||
reply.format = 0;
|
||||
if (client->swapped) {
|
||||
swaps(&reply.sequenceNumber);
|
||||
swapl(&reply.length);
|
||||
swapl(&reply.propertyType);
|
||||
swapl(&reply.bytesAfter);
|
||||
swapl(&reply.nItems);
|
||||
}
|
||||
WriteToClient(client, sizeof(xRRGetProviderPropertyReply), &reply);
|
||||
return Success;
|
||||
|
@ -644,15 +634,11 @@ ProcRRGetProviderProperty(ClientPtr client)
|
|||
) {
|
||||
reply.bytesAfter = prop_value->size;
|
||||
reply.format = prop_value->format;
|
||||
reply.length = 0;
|
||||
reply.nItems = 0;
|
||||
reply.propertyType = prop_value->type;
|
||||
if (client->swapped) {
|
||||
swaps(&reply.sequenceNumber);
|
||||
swapl(&reply.length);
|
||||
swapl(&reply.propertyType);
|
||||
swapl(&reply.bytesAfter);
|
||||
swapl(&reply.nItems);
|
||||
}
|
||||
WriteToClient(client, sizeof(xRRGetProviderPropertyReply), &reply);
|
||||
return Success;
|
||||
|
@ -684,8 +670,6 @@ ProcRRGetProviderProperty(ClientPtr client)
|
|||
reply.length = bytes_to_int32(len);
|
||||
if (prop_value->format)
|
||||
reply.nItems = len / (prop_value->format / 8);
|
||||
else
|
||||
reply.nItems = 0;
|
||||
reply.propertyType = prop_value->type;
|
||||
|
||||
if (stuff->delete && (reply.bytesAfter == 0)) {
|
||||
|
|
|
@ -76,8 +76,6 @@ RRSendConfigNotify(ScreenPtr pScreen)
|
|||
xEvent event = {
|
||||
.u.configureNotify.window = pWin->drawable.id,
|
||||
.u.configureNotify.aboveSibling = None,
|
||||
.u.configureNotify.x = 0,
|
||||
.u.configureNotify.y = 0,
|
||||
|
||||
/* XXX xinerama stuff ? */
|
||||
|
||||
|
@ -192,7 +190,6 @@ int
|
|||
ProcRRGetScreenSizeRange(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRGetScreenSizeRangeReq);
|
||||
xRRGetScreenSizeRangeReply rep;
|
||||
WindowPtr pWin;
|
||||
ScreenPtr pScreen;
|
||||
rrScrPrivPtr pScrPriv;
|
||||
|
@ -206,11 +203,9 @@ ProcRRGetScreenSizeRange(ClientPtr client)
|
|||
pScreen = pWin->drawable.pScreen;
|
||||
pScrPriv = rrGetScrPriv(pScreen);
|
||||
|
||||
rep = (xRRGetScreenSizeRangeReply) {
|
||||
xRRGetScreenSizeRangeReply rep = {
|
||||
.type = X_Reply,
|
||||
.pad = 0,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0
|
||||
};
|
||||
|
||||
if (pScrPriv) {
|
||||
|
@ -372,7 +367,6 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen)
|
|||
rrScrPrivPtr pScrPriv;
|
||||
int num_modes;
|
||||
RRModePtr *modes;
|
||||
xRRGetScreenResourcesReply rep;
|
||||
unsigned long extraLen;
|
||||
CARD8 *extra;
|
||||
RRCrtc *crtcs;
|
||||
|
@ -409,10 +403,10 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
pScrPriv = rrGetScrPriv(pScreen);
|
||||
rep = (xRRGetScreenResourcesReply) {
|
||||
|
||||
xRRGetScreenResourcesReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.timestamp = pScrPriv->lastSetTime.milliseconds,
|
||||
.configTimestamp = pScrPriv->lastConfigTime.milliseconds,
|
||||
.nCrtcs = total_crtcs,
|
||||
|
@ -491,8 +485,8 @@ rrGetScreenResources(ClientPtr client, Bool query)
|
|||
WindowPtr pWin;
|
||||
ScreenPtr pScreen;
|
||||
rrScrPrivPtr pScrPriv;
|
||||
CARD8 *extra;
|
||||
unsigned long extraLen;
|
||||
CARD8 *extra = NULL;
|
||||
unsigned long extraLen = 0;
|
||||
int i, rc, has_primary = 0;
|
||||
RRCrtc *crtcs;
|
||||
RROutput *outputs;
|
||||
|
@ -518,16 +512,9 @@ rrGetScreenResources(ClientPtr client, Bool query)
|
|||
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;
|
||||
}
|
||||
else {
|
||||
RRModePtr *modes;
|
||||
|
@ -540,16 +527,13 @@ rrGetScreenResources(ClientPtr client, Bool query)
|
|||
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;
|
||||
|
||||
|
@ -762,8 +746,8 @@ ProcRRGetScreenInfo(ClientPtr client)
|
|||
int rc;
|
||||
ScreenPtr pScreen;
|
||||
rrScrPrivPtr pScrPriv;
|
||||
CARD8 *extra;
|
||||
unsigned long extraLen;
|
||||
CARD8 *extra = NULL;
|
||||
unsigned long extraLen = 0;
|
||||
RROutputPtr output;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
|
||||
|
@ -785,18 +769,11 @@ ProcRRGetScreenInfo(ClientPtr client)
|
|||
.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;
|
||||
}
|
||||
else {
|
||||
int i, j;
|
||||
|
@ -815,7 +792,6 @@ ProcRRGetScreenInfo(ClientPtr client)
|
|||
.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,
|
||||
|
@ -905,7 +881,6 @@ int
|
|||
ProcRRSetScreenConfig(ClientPtr client)
|
||||
{
|
||||
REQUEST(xRRSetScreenConfigReq);
|
||||
xRRSetScreenConfigReply rep;
|
||||
DrawablePtr pDraw;
|
||||
int rc;
|
||||
ScreenPtr pScreen;
|
||||
|
@ -1110,12 +1085,10 @@ ProcRRSetScreenConfig(ClientPtr client)
|
|||
|
||||
free(pData);
|
||||
|
||||
rep = (xRRSetScreenConfigReply) {
|
||||
xRRSetScreenConfigReply rep = {
|
||||
.type = X_Reply,
|
||||
.status = status,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
|
||||
.newTimestamp = pScrPriv->lastSetTime.milliseconds,
|
||||
.newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds,
|
||||
.root = pDraw->pScreen->root->drawable.id,
|
||||
|
|
|
@ -99,7 +99,6 @@ ProcRRXineramaQueryVersion(ClientPtr client)
|
|||
xPanoramiXQueryVersionReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.majorVersion = SERVER_RRXINERAMA_MAJOR_VERSION,
|
||||
.minorVersion = SERVER_RRXINERAMA_MINOR_VERSION
|
||||
};
|
||||
|
@ -120,7 +119,6 @@ ProcRRXineramaGetState(ClientPtr client)
|
|||
{
|
||||
REQUEST(xPanoramiXGetStateReq);
|
||||
WindowPtr pWin;
|
||||
xPanoramiXGetStateReply rep;
|
||||
register int rc;
|
||||
ScreenPtr pScreen;
|
||||
rrScrPrivPtr pScrPriv;
|
||||
|
@ -138,11 +136,10 @@ ProcRRXineramaGetState(ClientPtr client)
|
|||
active = TRUE;
|
||||
}
|
||||
|
||||
rep = (xPanoramiXGetStateReply) {
|
||||
xPanoramiXGetStateReply rep = {
|
||||
.type = X_Reply,
|
||||
.state = active,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.window = stuff->window
|
||||
};
|
||||
if (client->swapped) {
|
||||
|
@ -171,7 +168,6 @@ ProcRRXineramaGetScreenCount(ClientPtr client)
|
|||
{
|
||||
REQUEST(xPanoramiXGetScreenCountReq);
|
||||
WindowPtr pWin;
|
||||
xPanoramiXGetScreenCountReply rep;
|
||||
register int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq);
|
||||
|
@ -179,11 +175,10 @@ ProcRRXineramaGetScreenCount(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
rep = (xPanoramiXGetScreenCountReply) {
|
||||
xPanoramiXGetScreenCountReply rep = {
|
||||
.type = X_Reply,
|
||||
.ScreenCount = RRXineramaScreenCount(pWin->drawable.pScreen),
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.window = stuff->window
|
||||
};
|
||||
if (client->swapped) {
|
||||
|
@ -201,7 +196,6 @@ ProcRRXineramaGetScreenSize(ClientPtr client)
|
|||
REQUEST(xPanoramiXGetScreenSizeReq);
|
||||
WindowPtr pWin, pRoot;
|
||||
ScreenPtr pScreen;
|
||||
xPanoramiXGetScreenSizeReply rep;
|
||||
register int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq);
|
||||
|
@ -212,10 +206,9 @@ ProcRRXineramaGetScreenSize(ClientPtr client)
|
|||
pScreen = pWin->drawable.pScreen;
|
||||
pRoot = pScreen->root;
|
||||
|
||||
rep = (xPanoramiXGetScreenSizeReply) {
|
||||
xPanoramiXGetScreenSizeReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = 0,
|
||||
.width = pRoot->drawable.width,
|
||||
.height = pRoot->drawable.height,
|
||||
.window = stuff->window,
|
||||
|
@ -236,13 +229,11 @@ ProcRRXineramaGetScreenSize(ClientPtr client)
|
|||
int
|
||||
ProcRRXineramaIsActive(ClientPtr client)
|
||||
{
|
||||
xXineramaIsActiveReply rep;
|
||||
|
||||
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
|
||||
|
||||
rep = (xXineramaIsActiveReply) {
|
||||
xXineramaIsActiveReply rep = {
|
||||
.type = X_Reply,
|
||||
.length = 0,
|
||||
.sequenceNumber = client->sequence,
|
||||
.state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN])
|
||||
};
|
||||
|
@ -258,12 +249,12 @@ ProcRRXineramaIsActive(ClientPtr client)
|
|||
static void
|
||||
RRXineramaWriteMonitor(ClientPtr client, RRMonitorPtr monitor)
|
||||
{
|
||||
xXineramaScreenInfo scratch;
|
||||
|
||||
scratch.x_org = monitor->geometry.box.x1;
|
||||
scratch.y_org = monitor->geometry.box.y1;
|
||||
scratch.width = monitor->geometry.box.x2 - monitor->geometry.box.x1;
|
||||
scratch.height = monitor->geometry.box.y2 - monitor->geometry.box.y1;
|
||||
xXineramaScreenInfo scratch = {
|
||||
.x_org = monitor->geometry.box.x1,
|
||||
.y_org = monitor->geometry.box.y1,
|
||||
.width = monitor->geometry.box.x2 - monitor->geometry.box.x1,
|
||||
.height = monitor->geometry.box.y2 - monitor->geometry.box.y1,
|
||||
};
|
||||
|
||||
if (client->swapped) {
|
||||
swaps(&scratch.x_org);
|
||||
|
@ -278,7 +269,6 @@ RRXineramaWriteMonitor(ClientPtr client, RRMonitorPtr monitor)
|
|||
int
|
||||
ProcRRXineramaQueryScreens(ClientPtr client)
|
||||
{
|
||||
xXineramaQueryScreensReply rep;
|
||||
ScreenPtr pScreen = screenInfo.screens[RR_XINERAMA_SCREEN];
|
||||
int m;
|
||||
RRMonitorPtr monitors = NULL;
|
||||
|
@ -292,7 +282,7 @@ ProcRRXineramaQueryScreens(ClientPtr client)
|
|||
return BadAlloc;
|
||||
}
|
||||
|
||||
rep = (xXineramaQueryScreensReply) {
|
||||
xXineramaQueryScreensReply rep = {
|
||||
.type = X_Reply,
|
||||
.sequenceNumber = client->sequence,
|
||||
.length = bytes_to_int32(nmonitors * sz_XineramaScreenInfo),
|
||||
|
|
Loading…
Reference in New Issue