Merge branch 'xrandr-reverts' into 'master'

Revert "randr cleanups"

See merge request xorg/xserver!2012
This commit is contained in:
Marge Bot 2025-06-13 21:58:15 +00:00
commit ff8d250589
15 changed files with 535 additions and 402 deletions

View File

@ -50,6 +50,9 @@ static int RRNScreens;
real->mem = priv->mem; \ real->mem = priv->mem; \
} }
static int ProcRRDispatch(ClientPtr pClient);
static int SProcRRDispatch(ClientPtr pClient);
int RREventBase; int RREventBase;
int RRErrorBase; int RRErrorBase;
RESTYPE RRClientType, RREventType; /* resource types for event masks */ RESTYPE RRClientType, RREventType; /* resource types for event masks */
@ -315,6 +318,7 @@ RRScreenInit(ScreenPtr pScreen)
/* /*
* Calling function best set these function vectors * Calling function best set these function vectors
*/ */
pScrPriv->rrGetInfo = 0;
pScrPriv->maxWidth = pScrPriv->minWidth = pScreen->width; pScrPriv->maxWidth = pScrPriv->minWidth = pScreen->width;
pScrPriv->maxHeight = pScrPriv->minHeight = pScreen->height; pScrPriv->maxHeight = pScrPriv->minHeight = pScreen->height;
@ -322,11 +326,21 @@ RRScreenInit(ScreenPtr pScreen)
pScrPriv->height = pScreen->height; pScrPriv->height = pScreen->height;
pScrPriv->mmWidth = pScreen->mmWidth; pScrPriv->mmWidth = pScreen->mmWidth;
pScrPriv->mmHeight = pScreen->mmHeight; pScrPriv->mmHeight = pScreen->mmHeight;
#if RANDR_12_INTERFACE
pScrPriv->rrScreenSetSize = NULL;
pScrPriv->rrCrtcSet = NULL;
pScrPriv->rrCrtcSetGamma = NULL;
#endif
#if RANDR_10_INTERFACE #if RANDR_10_INTERFACE
pScrPriv->rrSetConfig = 0;
pScrPriv->rotations = RR_Rotate_0; pScrPriv->rotations = RR_Rotate_0;
pScrPriv->reqWidth = pScreen->width; pScrPriv->reqWidth = pScreen->width;
pScrPriv->reqHeight = pScreen->height; pScrPriv->reqHeight = pScreen->height;
pScrPriv->nSizes = 0;
pScrPriv->pSizes = NULL;
pScrPriv->rotation = RR_Rotate_0; pScrPriv->rotation = RR_Rotate_0;
pScrPriv->rate = 0;
pScrPriv->size = 0;
#endif #endif
/* /*
@ -341,6 +355,10 @@ RRScreenInit(ScreenPtr pScreen)
pScreen->ConstrainCursorHarder = RRConstrainCursorHarder; pScreen->ConstrainCursorHarder = RRConstrainCursorHarder;
pScreen->ReplaceScanoutPixmap = RRReplaceScanoutPixmap; pScreen->ReplaceScanoutPixmap = RRReplaceScanoutPixmap;
pScrPriv->numOutputs = 0;
pScrPriv->outputs = NULL;
pScrPriv->numCrtcs = 0;
pScrPriv->crtcs = NULL;
xorg_list_init(&pScrPriv->leases); xorg_list_init(&pScrPriv->leases);
@ -719,3 +737,23 @@ RRVerticalRefresh(xRRModeInfo * mode)
refresh = 0xffff; refresh = 0xffff;
return (CARD16) refresh; return (CARD16) refresh;
} }
static int
ProcRRDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data >= RRNumberRequests || !ProcRandrVector[stuff->data])
return BadRequest;
UpdateCurrentTimeIf();
return (*ProcRandrVector[stuff->data]) (client);
}
static int _X_COLD
SProcRRDispatch(ClientPtr client)
{
REQUEST(xReq);
if (stuff->data >= RRNumberRequests || !SProcRandrVector[stuff->data])
return BadRequest;
UpdateCurrentTimeIf();
return (*SProcRandrVector[stuff->data]) (client);
}

View File

@ -33,6 +33,9 @@
extern int RREventBase, RRErrorBase; extern int RREventBase, RRErrorBase;
extern int (*ProcRandrVector[RRNumberRequests]) (ClientPtr);
extern int (*SProcRandrVector[RRNumberRequests]) (ClientPtr);
extern RESTYPE RRClientType, RREventType; /* resource types for event masks */ extern RESTYPE RRClientType, RREventType; /* resource types for event masks */
extern DevPrivateKeyRec RRClientPrivateKeyRec; extern DevPrivateKeyRec RRClientPrivateKeyRec;
@ -133,12 +136,4 @@ int ProcRRCreateLease(ClientPtr client);
int ProcRRFreeLease(ClientPtr client); int ProcRRFreeLease(ClientPtr client);
int ProcRRQueryVersion(ClientPtr client);
int ProcRRSelectInput(ClientPtr client);
int ProcRRDispatch(ClientPtr client);
int SProcRRDispatch(ClientPtr client);
#endif /* _XSERVER_RANDRSTR_PRIV_H_ */ #endif /* _XSERVER_RANDRSTR_PRIV_H_ */

View File

@ -77,8 +77,16 @@ RRCrtcCreate(ScreenPtr pScreen, void *devPrivate)
return NULL; return NULL;
crtc->id = FakeClientID(0); crtc->id = FakeClientID(0);
crtc->pScreen = pScreen; crtc->pScreen = pScreen;
crtc->mode = NULL;
crtc->x = 0;
crtc->y = 0;
crtc->rotation = RR_Rotate_0; crtc->rotation = RR_Rotate_0;
crtc->rotations = RR_Rotate_0; crtc->rotations = RR_Rotate_0;
crtc->outputs = NULL;
crtc->numOutputs = 0;
crtc->gammaSize = 0;
crtc->gammaRed = crtc->gammaBlue = crtc->gammaGreen = NULL;
crtc->changed = FALSE;
crtc->devPrivate = devPrivate; crtc->devPrivate = devPrivate;
RRTransformInit(&crtc->client_pending_transform); RRTransformInit(&crtc->client_pending_transform);
RRTransformInit(&crtc->client_current_transform); RRTransformInit(&crtc->client_current_transform);
@ -1022,16 +1030,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,36 +1155,50 @@ 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;
rrScrPrivPtr pScrPriv;
RRModePtr mode;
RROutput *outputs;
RROutput *possible;
int i, j, k;
int width, height;
BoxRec panned_area;
Bool leased;
REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
Bool leased = RRCrtcIsLeased(crtc); leased = RRCrtcIsLeased(crtc);
/* All crtcs must be associated with screens before client /* All crtcs must be associated with screens before client
* requests are processed * requests are processed
*/ */
ScreenPtr pScreen = crtc->pScreen; pScreen = crtc->pScreen;
rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen); pScrPriv = rrGetScrPriv(pScreen);
RRModePtr 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 {
BoxRec panned_area;
if (pScrPriv->rrGetPanning && if (pScrPriv->rrGetPanning &&
pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) && pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) &&
(panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1)) (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))
@ -1185,7 +1209,6 @@ ProcRRGetCrtcInfo(ClientPtr client)
rep.height = panned_area.y2 - panned_area.y1; rep.height = panned_area.y2 - panned_area.y1;
} }
else { else {
int width, height;
RRCrtcGetScanoutSize(crtc, &width, &height); RRCrtcGetScanoutSize(crtc, &width, &height);
rep.x = crtc->x; rep.x = crtc->x;
rep.y = crtc->y; rep.y = crtc->y;
@ -1193,37 +1216,41 @@ 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;
for (int i = 0; i < pScrPriv->numOutputs; i++) { k = 0;
for (i = 0; i < pScrPriv->numOutputs; i++) {
if (!RROutputIsLeased(pScrPriv->outputs[i])) { if (!RROutputIsLeased(pScrPriv->outputs[i])) {
for (int 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)
return BadAlloc; return BadAlloc;
} }
RROutput *outputs = (RROutput *) extra; outputs = (RROutput *) extra;
RROutput *possible = (RROutput *) (outputs + rep.nOutput); possible = (RROutput *) (outputs + rep.nOutput);
for (int i = 0; i < crtc->numOutputs; i++) { for (i = 0; i < crtc->numOutputs; i++) {
outputs[i] = crtc->outputs[i]->id; outputs[i] = crtc->outputs[i]->id;
if (client->swapped) if (client->swapped)
swapl(&outputs[i]); swapl(&outputs[i]);
} }
k = 0;
int k = 0; for (i = 0; i < pScrPriv->numOutputs; i++) {
for (int i = 0; i < pScrPriv->numOutputs; i++) {
if (!RROutputIsLeased(pScrPriv->outputs[i])) { if (!RROutputIsLeased(pScrPriv->outputs[i])) {
for (int 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) {
possible[k] = pScrPriv->outputs[i]->id; possible[k] = pScrPriv->outputs[i]->id;
if (client->swapped) if (client->swapped)
@ -1264,6 +1291,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;
@ -1455,10 +1483,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
}; };
@ -1476,6 +1505,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;
@ -1495,7 +1525,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,
@ -1619,6 +1649,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);
@ -1628,9 +1659,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) {
@ -1646,6 +1678,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;
@ -1665,7 +1698,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),
@ -1676,16 +1709,13 @@ ProcRRGetCrtcGamma(ClientPtr client)
swapl(&reply.length); swapl(&reply.length);
swaps(&reply.size); swaps(&reply.size);
} }
WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &reply);
if (crtc->gammaSize) { if (crtc->gammaSize) {
memcpy(extra, crtc->gammaRed, len); memcpy(extra, crtc->gammaRed, len);
if (client->swapped) client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
SwapShorts((short*)extra, len/sizeof(CARD16)); WriteSwappedDataToClient(client, len, extra);
}
WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &reply);
WriteToClient(client, len, extra);
free(extra); free(extra);
}
return Success; return Success;
} }
@ -1755,6 +1785,8 @@ ProcRRSetCrtcTransform(ClientPtr client)
filter, nbytes, params, nparams); filter, nbytes, params, nparams);
} }
#define CrtcTransformExtra (SIZEOF(xRRGetCrtcTransformReply) - 32)
static int static int
transform_filter_length(RRTransformPtr transform) transform_filter_length(RRTransformPtr transform)
{ {
@ -1809,9 +1841,11 @@ int
ProcRRGetCrtcTransform(ClientPtr client) ProcRRGetCrtcTransform(ClientPtr client)
{ {
REQUEST(xRRGetCrtcTransformReq); REQUEST(xRRGetCrtcTransformReq);
xRRGetCrtcTransformReply *reply;
RRCrtcPtr crtc; RRCrtcPtr crtc;
int nextra; int nextra;
RRTransformPtr current, pending; RRTransformPtr current, pending;
char *extra;
REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq); REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq);
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
@ -1822,36 +1856,33 @@ ProcRRGetCrtcTransform(ClientPtr client)
nextra = (transform_filter_length(pending) + nextra = (transform_filter_length(pending) +
transform_filter_length(current)); transform_filter_length(current));
char *extra_buf = calloc(1, nextra); reply = calloc(1, sizeof(xRRGetCrtcTransformReply) + nextra);
if (!extra_buf) if (!reply)
return BadAlloc; return BadAlloc;
char *extra = extra_buf; extra = (char *) (reply + 1);
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
reply->length = bytes_to_int32(CrtcTransformExtra + nextra);
xRRGetCrtcTransformReply rep = { reply->hasTransforms = crtc->transforms;
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(sizeof(xRRGetCrtcTransformReply) - sizeof(xGenericReply) + nextra),
.hasTransforms = crtc->transforms,
};
transform_encode(client, &rep.pendingTransform, &pending->transform); transform_encode(client, &reply->pendingTransform, &pending->transform);
extra += transform_filter_encode(client, extra, extra += transform_filter_encode(client, extra,
&rep.pendingNbytesFilter, &reply->pendingNbytesFilter,
&rep.pendingNparamsFilter, pending); &reply->pendingNparamsFilter, pending);
transform_encode(client, &rep.currentTransform, &current->transform); transform_encode(client, &reply->currentTransform, &current->transform);
extra += transform_filter_encode(client, extra, extra += transform_filter_encode(client, extra,
&rep.currentNbytesFilter, &reply->currentNbytesFilter,
&rep.currentNparamsFilter, current); &reply->currentNparamsFilter, current);
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&reply->sequenceNumber);
swapl(&rep.length); swapl(&reply->length);
} }
WriteToClient(client, sizeof(xRRGetCrtcTransformReply), &rep); WriteToClient(client, sizeof(xRRGetCrtcTransformReply) + nextra, reply);
WriteToClient(client, nextra, extra_buf); free(reply);
free(extra_buf);
return Success; return Success;
} }

View File

@ -36,12 +36,13 @@ RRClientKnowsRates(ClientPtr pClient)
1, 1) >= 0; 1, 1) >= 0;
} }
int static int
ProcRRQueryVersion(ClientPtr client) 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);
@ -71,7 +72,7 @@ ProcRRQueryVersion(ClientPtr client)
return Success; return Success;
} }
int static int
ProcRRSelectInput(ClientPtr client) ProcRRSelectInput(ClientPtr client)
{ {
REQUEST(xRRSelectInputReq); REQUEST(xRRSelectInputReq);
@ -210,69 +211,60 @@ ProcRRSelectInput(ClientPtr client)
return Success; return Success;
} }
int int (*ProcRandrVector[RRNumberRequests]) (ClientPtr) = {
ProcRRDispatch(ClientPtr client) ProcRRQueryVersion, /* 0 */
{ /* we skip 1 to make old clients fail pretty immediately */
REQUEST(xReq); NULL, /* 1 ProcRandrOldGetScreenInfo */
UpdateCurrentTimeIf(); /* V1.0 apps share the same set screen config request id */
ProcRRSetScreenConfig, /* 2 */
switch (stuff->data) { NULL, /* 3 ProcRandrOldScreenChangeSelectInput */
case X_RRQueryVersion: return ProcRRQueryVersion(client); /* 3 used to be ScreenChangeSelectInput; deprecated */
case X_RRSetScreenConfig: return ProcRRSetScreenConfig(client); ProcRRSelectInput, /* 4 */
case X_RRSelectInput: return ProcRRSelectInput(client); ProcRRGetScreenInfo, /* 5 */
case X_RRGetScreenInfo: return ProcRRGetScreenInfo(client);
/* V1.2 additions */ /* V1.2 additions */
case X_RRGetScreenSizeRange: return ProcRRGetScreenSizeRange(client); ProcRRGetScreenSizeRange, /* 6 */
case X_RRSetScreenSize: return ProcRRSetScreenSize(client); ProcRRSetScreenSize, /* 7 */
case X_RRGetScreenResources: return ProcRRGetScreenResources(client); ProcRRGetScreenResources, /* 8 */
case X_RRGetOutputInfo: return ProcRRGetOutputInfo(client); ProcRRGetOutputInfo, /* 9 */
case X_RRListOutputProperties: return ProcRRListOutputProperties(client); ProcRRListOutputProperties, /* 10 */
case X_RRQueryOutputProperty: return ProcRRQueryOutputProperty(client); ProcRRQueryOutputProperty, /* 11 */
case X_RRConfigureOutputProperty: return ProcRRConfigureOutputProperty(client); ProcRRConfigureOutputProperty, /* 12 */
case X_RRChangeOutputProperty: return ProcRRChangeOutputProperty(client); ProcRRChangeOutputProperty, /* 13 */
case X_RRDeleteOutputProperty: return ProcRRDeleteOutputProperty(client); ProcRRDeleteOutputProperty, /* 14 */
case X_RRGetOutputProperty: return ProcRRGetOutputProperty(client); ProcRRGetOutputProperty, /* 15 */
case X_RRCreateMode: return ProcRRCreateMode(client); ProcRRCreateMode, /* 16 */
case X_RRDestroyMode: return ProcRRDestroyMode(client); ProcRRDestroyMode, /* 17 */
case X_RRAddOutputMode: return ProcRRAddOutputMode(client); ProcRRAddOutputMode, /* 18 */
case X_RRDeleteOutputMode: return ProcRRDeleteOutputMode(client); ProcRRDeleteOutputMode, /* 19 */
case X_RRGetCrtcInfo: return ProcRRGetCrtcInfo(client); ProcRRGetCrtcInfo, /* 20 */
case X_RRSetCrtcConfig: return ProcRRSetCrtcConfig(client); ProcRRSetCrtcConfig, /* 21 */
case X_RRGetCrtcGammaSize: return ProcRRGetCrtcGammaSize(client); ProcRRGetCrtcGammaSize, /* 22 */
case X_RRGetCrtcGamma: return ProcRRGetCrtcGamma(client); ProcRRGetCrtcGamma, /* 23 */
case X_RRSetCrtcGamma: return ProcRRSetCrtcGamma(client); ProcRRSetCrtcGamma, /* 24 */
/* V1.3 additions */ /* V1.3 additions */
case X_RRGetScreenResourcesCurrent: return ProcRRGetScreenResourcesCurrent(client); ProcRRGetScreenResourcesCurrent, /* 25 */
case X_RRSetCrtcTransform: return ProcRRSetCrtcTransform(client); ProcRRSetCrtcTransform, /* 26 */
case X_RRGetCrtcTransform: return ProcRRGetCrtcTransform(client); ProcRRGetCrtcTransform, /* 27 */
case X_RRGetPanning: return ProcRRGetPanning(client); ProcRRGetPanning, /* 28 */
case X_RRSetPanning: return ProcRRSetPanning(client); ProcRRSetPanning, /* 29 */
case X_RRSetOutputPrimary: return ProcRRSetOutputPrimary(client); ProcRRSetOutputPrimary, /* 30 */
case X_RRGetOutputPrimary: return ProcRRGetOutputPrimary(client); ProcRRGetOutputPrimary, /* 31 */
/* V1.4 additions */ /* V1.4 additions */
case X_RRGetProviders: return ProcRRGetProviders(client); ProcRRGetProviders, /* 32 */
case X_RRGetProviderInfo: return ProcRRGetProviderInfo(client); ProcRRGetProviderInfo, /* 33 */
case X_RRSetProviderOffloadSink: return ProcRRSetProviderOffloadSink(client); ProcRRSetProviderOffloadSink, /* 34 */
case X_RRSetProviderOutputSource: return ProcRRSetProviderOutputSource(client); ProcRRSetProviderOutputSource, /* 35 */
case X_RRListProviderProperties: return ProcRRListProviderProperties(client); ProcRRListProviderProperties, /* 36 */
case X_RRQueryProviderProperty: return ProcRRQueryProviderProperty(client); ProcRRQueryProviderProperty, /* 37 */
case X_RRConfigureProviderProperty: return ProcRRConfigureProviderProperty(client); ProcRRConfigureProviderProperty, /* 38 */
case X_RRChangeProviderProperty: return ProcRRChangeProviderProperty(client); ProcRRChangeProviderProperty, /* 39 */
case X_RRDeleteProviderProperty: return ProcRRDeleteProviderProperty(client); ProcRRDeleteProviderProperty, /* 40 */
case X_RRGetProviderProperty: return ProcRRGetProviderProperty(client); ProcRRGetProviderProperty, /* 41 */
/* V1.5 additions */ /* V1.5 additions */
case X_RRGetMonitors: return ProcRRGetMonitors(client); ProcRRGetMonitors, /* 42 */
case X_RRSetMonitor: return ProcRRSetMonitor(client); ProcRRSetMonitor, /* 43 */
case X_RRDeleteMonitor: return ProcRRDeleteMonitor(client); ProcRRDeleteMonitor, /* 44 */
/* V1.6 additions */ /* V1.6 additions */
case X_RRCreateLease: return ProcRRCreateLease(client); ProcRRCreateLease, /* 45 */
case X_RRFreeLease: return ProcRRFreeLease(client); ProcRRFreeLease, /* 46 */
} };
return BadRequest;
}

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,21 +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;
} }
int payload_len = noutputs * sizeof(CARD32) + nmonitors * sizeof(xRRMonitorInfo); rep.nmonitors = nmonitors;
rep.noutputs = noutputs;
xRRGetMonitorsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.timestamp = RRMonitorTimestamp(screen),
.length = bytes_to_int32(payload_len),
.nmonitors = nmonitors,
.noutputs = noutputs,
};
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
@ -624,18 +625,11 @@ ProcRRGetMonitors(ClientPtr client)
} }
WriteToClient(client, sizeof(xRRGetMonitorsReply), &rep); WriteToClient(client, sizeof(xRRGetMonitorsReply), &rep);
char *payload_buf = calloc(1, payload_len); client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
if (!payload_buf) {
RRMonitorFreeList(monitors, nmonitors);
return BadAlloc;
}
char *walk = payload_buf;
for (m = 0; m < nmonitors; m++) { for (m = 0; m < nmonitors; m++) {
RRMonitorPtr monitor = &monitors[m]; RRMonitorPtr monitor = &monitors[m];
xRRMonitorInfo *info = (xRRMonitorInfo*) walk; xRRMonitorInfo info = {
*info = (xRRMonitorInfo) {
.name = monitor->name, .name = monitor->name,
.primary = monitor->primary, .primary = monitor->primary,
.automatic = monitor->automatic, .automatic = monitor->automatic,
@ -648,27 +642,20 @@ ProcRRGetMonitors(ClientPtr client)
.heightInMillimeters = monitor->geometry.mmHeight, .heightInMillimeters = monitor->geometry.mmHeight,
}; };
if (client->swapped) { if (client->swapped) {
swapl(&info->name); swapl(&info.name);
swaps(&info->noutput); swaps(&info.noutput);
swaps(&info->x); swaps(&info.x);
swaps(&info->y); swaps(&info.y);
swaps(&info->width); swaps(&info.width);
swaps(&info->height); swaps(&info.height);
swapl(&info->widthInMillimeters); swapl(&info.widthInMillimeters);
swapl(&info->heightInMillimeters); swapl(&info.heightInMillimeters);
} }
walk += sizeof(xRRMonitorInfo); WriteToClient(client, sizeof(xRRMonitorInfo), &info);
memcpy(walk, monitor->outputs, monitor->numOutputs * sizeof (RROutput)); WriteSwappedDataToClient(client, monitor->numOutputs * sizeof (RROutput), monitor->outputs);
if (client->swapped)
SwapLongs((CARD32*)walk, monitor->numOutputs);
walk += monitor->numOutputs * sizeof (RROutput);
} }
WriteToClient(client, payload_len, payload_buf);
free(payload_buf);
RRMonitorFreeList(monitors, nmonitors); RRMonitorFreeList(monitors, nmonitors);
return Success; return Success;

View File

@ -83,7 +83,7 @@ RROutputCreate(ScreenPtr pScreen,
pScrPriv->outputs = outputs; pScrPriv->outputs = outputs;
output = calloc(1, sizeof(RROutputRec) + nameLength + 1); output = malloc(sizeof(RROutputRec) + nameLength + 1);
if (!output) if (!output)
return NULL; return NULL;
output->id = FakeClientID(0); output->id = FakeClientID(0);
@ -94,6 +94,22 @@ RROutputCreate(ScreenPtr pScreen,
output->name[nameLength] = '\0'; output->name[nameLength] = '\0';
output->connection = RR_UnknownConnection; output->connection = RR_UnknownConnection;
output->subpixelOrder = SubPixelUnknown; output->subpixelOrder = SubPixelUnknown;
output->mmWidth = 0;
output->mmHeight = 0;
output->crtc = NULL;
output->numCrtcs = 0;
output->crtcs = NULL;
output->numClones = 0;
output->clones = NULL;
output->numModes = 0;
output->numPreferred = 0;
output->modes = NULL;
output->numUserModes = 0;
output->userModes = NULL;
output->properties = NULL;
output->pendingProperties = FALSE;
output->changed = FALSE;
output->nonDesktop = FALSE;
output->devPrivate = devPrivate; output->devPrivate = devPrivate;
if (!AddResource(output->id, RROutputType, (void *) output)) if (!AddResource(output->id, RROutputType, (void *) output))
@ -465,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;
@ -635,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;
@ -648,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

@ -416,6 +416,8 @@ int
ProcRRListOutputProperties(ClientPtr client) ProcRRListOutputProperties(ClientPtr client)
{ {
REQUEST(xRRListOutputPropertiesReq); REQUEST(xRRListOutputPropertiesReq);
Atom *pAtoms = NULL;
xRRListOutputPropertiesReply rep;
int numProps = 0; int numProps = 0;
RROutputPtr output; RROutputPtr output;
RRPropertyPtr prop; RRPropertyPtr prop;
@ -426,8 +428,11 @@ ProcRRListOutputProperties(ClientPtr client)
for (prop = output->properties; prop; prop = prop->next) for (prop = output->properties; prop; prop = prop->next)
numProps++; numProps++;
if (numProps)
if (!(pAtoms = xallocarray(numProps, sizeof(Atom))))
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)),
@ -438,25 +443,18 @@ ProcRRListOutputProperties(ClientPtr client)
swapl(&rep.length); swapl(&rep.length);
swaps(&rep.nAtoms); swaps(&rep.nAtoms);
} }
WriteToClient(client, sizeof(xRRListOutputPropertiesReply), &rep);
Atom* pAtoms = calloc(sizeof(Atom), numProps);
if (numProps) { if (numProps) {
if (!pAtoms)
return BadAlloc;
/* Copy property name atoms to reply buffer */ /* Copy property name atoms to reply buffer */
Atom *temppAtoms = pAtoms; Atom *temppAtoms = pAtoms;
for (prop = output->properties; prop; prop = prop->next) for (prop = output->properties; prop; prop = prop->next)
*temppAtoms++ = prop->propertyName; *temppAtoms++ = prop->propertyName;
if (client->swapped) client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
SwapLongs(pAtoms, numProps); WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
}
WriteToClient(client, sizeof(xRRListOutputPropertiesReply), &rep);
WriteToClient(client, sizeof(Atom) * numProps, pAtoms);
free(pAtoms); free(pAtoms);
}
return Success; return Success;
} }
@ -464,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;
@ -482,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,
@ -495,16 +494,14 @@ ProcRRQueryOutputProperty(ClientPtr client)
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
swapl(&rep.length); swapl(&rep.length);
} }
WriteToClient(client, sizeof(xRRQueryOutputPropertyReply), &rep);
if (prop->num_valid) { if (prop->num_valid) {
memcpy(extra, prop->valid_values, prop->num_valid * sizeof(INT32)); memcpy(extra, prop->valid_values, prop->num_valid * sizeof(INT32));
if (client->swapped) client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
SwapLongs((CARD32*)extra, prop->num_valid); WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32),
} extra);
WriteToClient(client, sizeof(xRRQueryOutputPropertyReply), &rep);
WriteToClient(client, prop->num_valid * sizeof(INT32), extra);
free(extra); free(extra);
}
return Success; return Success;
} }
@ -623,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);
@ -648,16 +646,24 @@ ProcRRGetOutputProperty(ClientPtr client)
if (prop->propertyName == stuff->property) if (prop->propertyName == stuff->property)
break; break;
xRRGetOutputPropertyReply rep = { 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(&rep.sequenceNumber); swaps(&reply.sequenceNumber);
swapl(&reply.length);
swapl(&reply.propertyType);
swapl(&reply.bytesAfter);
swapl(&reply.nItems);
} }
WriteToClient(client, sizeof(rep), &rep); WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply);
return Success; return Success;
} }
@ -673,15 +679,19 @@ ProcRRGetOutputProperty(ClientPtr client)
if (((stuff->type != prop_value->type) && (stuff->type != AnyPropertyType)) if (((stuff->type != prop_value->type) && (stuff->type != AnyPropertyType))
) { ) {
rep.bytesAfter = prop_value->size; reply.bytesAfter = prop_value->size;
rep.format = prop_value->format; reply.format = prop_value->format;
rep.propertyType = prop_value->type; reply.length = 0;
reply.nItems = 0;
reply.propertyType = prop_value->type;
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&reply.sequenceNumber);
swapl(&rep.propertyType); swapl(&reply.length);
swapl(&rep.bytesAfter); swapl(&reply.propertyType);
swapl(&reply.bytesAfter);
swapl(&reply.nItems);
} }
WriteToClient(client, sizeof(rep), &rep); WriteToClient(client, sizeof(xRRGetOutputPropertyReply), &reply);
return Success; return Success;
} }
@ -706,14 +716,16 @@ ProcRRGetOutputProperty(ClientPtr client)
if (!extra) if (!extra)
return BadAlloc; return BadAlloc;
} }
rep.bytesAfter = n - (ind + len); reply.bytesAfter = n - (ind + len);
rep.format = prop_value->format; reply.format = prop_value->format;
rep.length = bytes_to_int32(len); reply.length = bytes_to_int32(len);
if (prop_value->format) if (prop_value->format)
rep.nItems = len / (prop_value->format / 8); reply.nItems = len / (prop_value->format / 8);
rep.propertyType = prop_value->type; else
reply.nItems = 0;
reply.propertyType = prop_value->type;
if (stuff->delete && (rep.bytesAfter == 0)) { if (stuff->delete && (reply.bytesAfter == 0)) {
xRROutputPropertyNotifyEvent event = { xRROutputPropertyNotifyEvent event = {
.type = RREventBase + RRNotify, .type = RREventBase + RRNotify,
.subCode = RRNotify_OutputProperty, .subCode = RRNotify_OutputProperty,
@ -726,33 +738,31 @@ ProcRRGetOutputProperty(ClientPtr client)
} }
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&reply.sequenceNumber);
swapl(&rep.length); swapl(&reply.length);
swapl(&rep.propertyType); swapl(&reply.propertyType);
swapl(&rep.bytesAfter); swapl(&reply.bytesAfter);
swapl(&rep.nItems); swapl(&reply.nItems);
} }
WriteToClient(client, sizeof(xGenericReply), &reply);
if (len) { if (len) {
memcpy(extra, (char *) prop_value->data + ind, len); memcpy(extra, (char *) prop_value->data + ind, len);
switch (rep.format) { switch (reply.format) {
case 32: case 32:
if (client->swapped) client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
SwapLongs((CARD32*)extra, len / sizeof(CARD32));
break; break;
case 16: case 16:
if (client->swapped) client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
SwapShorts((short*)extra, len / sizeof(CARD16));
break; break;
default: default:
client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
break; break;
} }
WriteSwappedDataToClient(client, len, extra);
free(extra);
} }
WriteToClient(client, sizeof(rep), &rep); if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */
WriteToClient(client, len, extra);
free(extra);
if (stuff->delete && (rep.bytesAfter == 0)) { /* delete the Property */
*prev = prop->next; *prev = prop->next;
RRDestroyOutputProperty(prop); RRDestroyOutputProperty(prop);
} }

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,25 +87,24 @@ 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); extra = NULL;
return Success; extraLen = 0;
} } else {
rep = (xRRGetProvidersReply) {
extraLen = total_providers * sizeof(CARD32);
xRRGetProvidersReply rep = {
.type = X_Reply, .type = X_Reply,
.sequenceNumber = client->sequence, .sequenceNumber = client->sequence,
.timestamp = pScrPriv->lastSetTime.milliseconds, .timestamp = pScrPriv->lastSetTime.milliseconds,
.nProviders = total_providers, .nProviders = total_providers,
.length = bytes_to_int32(extraLen), .length = total_providers
}; };
extraLen = rep.length << 2;
if (extraLen) { if (extraLen) {
extra = malloc(extraLen); extra = malloc(extraLen);
if (!extra) if (!extra)
@ -117,6 +117,7 @@ ProcRRGetProviders (ClientPtr client)
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) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
@ -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

@ -107,10 +107,16 @@ RRCreateProviderProperty(Atom property)
{ {
RRPropertyPtr prop; RRPropertyPtr prop;
prop = (RRPropertyPtr) calloc(1, sizeof(RRPropertyRec)); prop = (RRPropertyPtr) malloc(sizeof(RRPropertyRec));
if (!prop) if (!prop)
return NULL; return NULL;
prop->next = NULL;
prop->propertyName = property; prop->propertyName = property;
prop->is_pending = FALSE;
prop->range = FALSE;
prop->immutable = FALSE;
prop->num_valid = 0;
prop->valid_values = NULL;
RRInitProviderPropertyValue(&prop->current); RRInitProviderPropertyValue(&prop->current);
RRInitProviderPropertyValue(&prop->pending); RRInitProviderPropertyValue(&prop->pending);
return prop; return prop;
@ -385,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;
@ -399,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)),
@ -427,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;
@ -444,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,
@ -607,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;
@ -628,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;
@ -664,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)) {
@ -685,25 +707,23 @@ ProcRRGetProviderProperty(ClientPtr client)
swapl(&reply.bytesAfter); swapl(&reply.bytesAfter);
swapl(&reply.nItems); swapl(&reply.nItems);
} }
WriteToClient(client, sizeof(xGenericReply), &reply);
if (len) { if (len) {
memcpy(extra, (char *) prop_value->data + ind, len); memcpy(extra, (char *) prop_value->data + ind, len);
switch (reply.format) { switch (reply.format) {
case 32: case 32:
if (client->swapped) client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
SwapLongs((CARD32*) extra, len/sizeof(CARD32));
break; break;
case 16: case 16:
if (client->swapped) client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
SwapShorts((short*) extra, len/sizeof(CARD16));
break; break;
default: default:
client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
break; break;
} }
} WriteSwappedDataToClient(client, len, extra);
WriteToClient(client, sizeof(xGenericReply), &reply);
WriteToClient(client, len, extra);
free(extra); free(extra);
}
if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */ if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */
*prev = prop->next; *prev = prop->next;

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

@ -30,7 +30,7 @@ SProcRRQueryVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xRRQueryVersionReq); REQUEST_SIZE_MATCH(xRRQueryVersionReq);
swapl(&stuff->majorVersion); swapl(&stuff->majorVersion);
swapl(&stuff->minorVersion); swapl(&stuff->minorVersion);
return ProcRRQueryVersion(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -40,7 +40,7 @@ SProcRRGetScreenInfo(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
swapl(&stuff->window); swapl(&stuff->window);
return ProcRRGetScreenInfo(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -60,7 +60,7 @@ SProcRRSetScreenConfig(ClientPtr client)
swapl(&stuff->timestamp); swapl(&stuff->timestamp);
swaps(&stuff->sizeID); swaps(&stuff->sizeID);
swaps(&stuff->rotation); swaps(&stuff->rotation);
return ProcRRSetScreenConfig(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -71,7 +71,7 @@ SProcRRSelectInput(ClientPtr client)
REQUEST_SIZE_MATCH(xRRSelectInputReq); REQUEST_SIZE_MATCH(xRRSelectInputReq);
swapl(&stuff->window); swapl(&stuff->window);
swaps(&stuff->enable); swaps(&stuff->enable);
return ProcRRSelectInput(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -81,7 +81,7 @@ SProcRRGetScreenSizeRange(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq); REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq);
swapl(&stuff->window); swapl(&stuff->window);
return ProcRRGetScreenSizeRange(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -95,7 +95,7 @@ SProcRRSetScreenSize(ClientPtr client)
swaps(&stuff->height); swaps(&stuff->height);
swapl(&stuff->widthInMillimeters); swapl(&stuff->widthInMillimeters);
swapl(&stuff->heightInMillimeters); swapl(&stuff->heightInMillimeters);
return ProcRRSetScreenSize(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -105,7 +105,7 @@ SProcRRGetScreenResources(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq); REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
swapl(&stuff->window); swapl(&stuff->window);
return ProcRRGetScreenResources(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -116,7 +116,7 @@ SProcRRGetScreenResourcesCurrent(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetScreenResourcesCurrentReq); REQUEST_SIZE_MATCH(xRRGetScreenResourcesCurrentReq);
swaps(&stuff->length); swaps(&stuff->length);
swapl(&stuff->window); swapl(&stuff->window);
return ProcRRGetScreenResourcesCurrent(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -127,7 +127,7 @@ SProcRRGetOutputInfo(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetOutputInfoReq); REQUEST_SIZE_MATCH(xRRGetOutputInfoReq);
swapl(&stuff->output); swapl(&stuff->output);
swapl(&stuff->configTimestamp); swapl(&stuff->configTimestamp);
return ProcRRGetScreenResources(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -137,7 +137,7 @@ SProcRRListOutputProperties(ClientPtr client)
REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq); REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq);
swapl(&stuff->output); swapl(&stuff->output);
return ProcRRListOutputProperties(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -148,7 +148,7 @@ SProcRRQueryOutputProperty(ClientPtr client)
REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq); REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq);
swapl(&stuff->output); swapl(&stuff->output);
swapl(&stuff->property); swapl(&stuff->property);
return ProcRRQueryOutputProperty(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -160,7 +160,7 @@ SProcRRConfigureOutputProperty(ClientPtr client)
swapl(&stuff->output); swapl(&stuff->output);
swapl(&stuff->property); swapl(&stuff->property);
SwapRestL(stuff); SwapRestL(stuff);
return ProcRRConfigureOutputProperty(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -186,7 +186,7 @@ SProcRRChangeOutputProperty(ClientPtr client)
client->errorValue = stuff->format; client->errorValue = stuff->format;
return BadValue; return BadValue;
} }
return ProcRRChangeOutputProperty(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -197,7 +197,7 @@ SProcRRDeleteOutputProperty(ClientPtr client)
REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq); REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq);
swapl(&stuff->output); swapl(&stuff->output);
swapl(&stuff->property); swapl(&stuff->property);
return ProcRRDeleteOutputProperty(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -211,7 +211,7 @@ SProcRRGetOutputProperty(ClientPtr client)
swapl(&stuff->type); swapl(&stuff->type);
swapl(&stuff->longOffset); swapl(&stuff->longOffset);
swapl(&stuff->longLength); swapl(&stuff->longLength);
return ProcRRGetOutputProperty(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -237,7 +237,7 @@ SProcRRCreateMode(ClientPtr client)
swaps(&modeinfo->vTotal); swaps(&modeinfo->vTotal);
swaps(&modeinfo->nameLength); swaps(&modeinfo->nameLength);
swapl(&modeinfo->modeFlags); swapl(&modeinfo->modeFlags);
return ProcRRCreateMode(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -247,7 +247,7 @@ SProcRRDestroyMode(ClientPtr client)
REQUEST_SIZE_MATCH(xRRDestroyModeReq); REQUEST_SIZE_MATCH(xRRDestroyModeReq);
swapl(&stuff->mode); swapl(&stuff->mode);
return ProcRRDestroyMode(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -258,7 +258,7 @@ SProcRRAddOutputMode(ClientPtr client)
REQUEST_SIZE_MATCH(xRRAddOutputModeReq); REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
swapl(&stuff->output); swapl(&stuff->output);
swapl(&stuff->mode); swapl(&stuff->mode);
return ProcRRAddOutputMode(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -269,7 +269,7 @@ SProcRRDeleteOutputMode(ClientPtr client)
REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq); REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
swapl(&stuff->output); swapl(&stuff->output);
swapl(&stuff->mode); swapl(&stuff->mode);
return ProcRRDeleteOutputMode(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -280,7 +280,7 @@ SProcRRGetCrtcInfo(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
swapl(&stuff->crtc); swapl(&stuff->crtc);
swapl(&stuff->configTimestamp); swapl(&stuff->configTimestamp);
return ProcRRGetCrtcInfo(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -297,7 +297,7 @@ SProcRRSetCrtcConfig(ClientPtr client)
swapl(&stuff->mode); swapl(&stuff->mode);
swaps(&stuff->rotation); swaps(&stuff->rotation);
SwapRestL(stuff); SwapRestL(stuff);
return ProcRRSetCrtcConfig(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -307,7 +307,7 @@ SProcRRGetCrtcGammaSize(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq); REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
swapl(&stuff->crtc); swapl(&stuff->crtc);
return ProcRRGetCrtcGammaSize(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -317,7 +317,7 @@ SProcRRGetCrtcGamma(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq); REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
swapl(&stuff->crtc); swapl(&stuff->crtc);
return ProcRRGetCrtcGamma(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -329,7 +329,7 @@ SProcRRSetCrtcGamma(ClientPtr client)
swapl(&stuff->crtc); swapl(&stuff->crtc);
swaps(&stuff->size); swaps(&stuff->size);
SwapRestS(stuff); SwapRestS(stuff);
return ProcRRSetCrtcGamma(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -353,7 +353,7 @@ SProcRRSetCrtcTransform(ClientPtr client)
return BadLength; return BadLength;
SwapLongs(params, nparams); SwapLongs(params, nparams);
return ProcRRSetCrtcTransform(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -363,7 +363,7 @@ SProcRRGetCrtcTransform(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq); REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq);
swapl(&stuff->crtc); swapl(&stuff->crtc);
return ProcRRGetCrtcTransform(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -373,7 +373,7 @@ SProcRRGetPanning(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetPanningReq); REQUEST_SIZE_MATCH(xRRGetPanningReq);
swapl(&stuff->crtc); swapl(&stuff->crtc);
return ProcRRGetPanning(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -396,7 +396,7 @@ SProcRRSetPanning(ClientPtr client)
swaps(&stuff->border_top); swaps(&stuff->border_top);
swaps(&stuff->border_right); swaps(&stuff->border_right);
swaps(&stuff->border_bottom); swaps(&stuff->border_bottom);
return ProcRRSetPanning(client); return (*ProcRandrVector[stuff->randrReqType]) (client);
} }
static int _X_COLD static int _X_COLD
@ -407,7 +407,7 @@ SProcRRSetOutputPrimary(ClientPtr client)
REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq); REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
swapl(&stuff->window); swapl(&stuff->window);
swapl(&stuff->output); swapl(&stuff->output);
return ProcRRSetOutputPrimary(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -417,7 +417,7 @@ SProcRRGetOutputPrimary(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq); REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
swapl(&stuff->window); swapl(&stuff->window);
return ProcRRGetOutputPrimary(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -427,7 +427,7 @@ SProcRRGetProviders(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetProvidersReq); REQUEST_SIZE_MATCH(xRRGetProvidersReq);
swapl(&stuff->window); swapl(&stuff->window);
return ProcRRGetProviders(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -438,7 +438,7 @@ SProcRRGetProviderInfo(ClientPtr client)
REQUEST_SIZE_MATCH(xRRGetProviderInfoReq); REQUEST_SIZE_MATCH(xRRGetProviderInfoReq);
swapl(&stuff->provider); swapl(&stuff->provider);
swapl(&stuff->configTimestamp); swapl(&stuff->configTimestamp);
return ProcRRGetProviderInfo(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -450,7 +450,7 @@ SProcRRSetProviderOffloadSink(ClientPtr client)
swapl(&stuff->provider); swapl(&stuff->provider);
swapl(&stuff->sink_provider); swapl(&stuff->sink_provider);
swapl(&stuff->configTimestamp); swapl(&stuff->configTimestamp);
return ProcRRSetProviderOffloadSink(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -462,7 +462,7 @@ SProcRRSetProviderOutputSource(ClientPtr client)
swapl(&stuff->provider); swapl(&stuff->provider);
swapl(&stuff->source_provider); swapl(&stuff->source_provider);
swapl(&stuff->configTimestamp); swapl(&stuff->configTimestamp);
return ProcRRSetProviderOutputSource(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -472,7 +472,7 @@ SProcRRListProviderProperties(ClientPtr client)
REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq); REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq);
swapl(&stuff->provider); swapl(&stuff->provider);
return ProcRRListProviderProperties(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -483,7 +483,7 @@ SProcRRQueryProviderProperty(ClientPtr client)
REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq); REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq);
swapl(&stuff->provider); swapl(&stuff->provider);
swapl(&stuff->property); swapl(&stuff->property);
return ProcRRQueryProviderProperty(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -496,7 +496,7 @@ SProcRRConfigureProviderProperty(ClientPtr client)
swapl(&stuff->property); swapl(&stuff->property);
/* TODO: no way to specify format? */ /* TODO: no way to specify format? */
SwapRestL(stuff); SwapRestL(stuff);
return ProcRRConfigureProviderProperty(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -519,7 +519,7 @@ SProcRRChangeProviderProperty(ClientPtr client)
SwapRestL(stuff); SwapRestL(stuff);
break; break;
} }
return ProcRRChangeProviderProperty(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -530,7 +530,7 @@ SProcRRDeleteProviderProperty(ClientPtr client)
REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq); REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq);
swapl(&stuff->provider); swapl(&stuff->provider);
swapl(&stuff->property); swapl(&stuff->property);
return ProcRRDeleteProviderProperty(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -544,7 +544,7 @@ SProcRRGetProviderProperty(ClientPtr client)
swapl(&stuff->type); swapl(&stuff->type);
swapl(&stuff->longOffset); swapl(&stuff->longOffset);
swapl(&stuff->longLength); swapl(&stuff->longLength);
return ProcRRGetProviderProperty(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -553,7 +553,7 @@ SProcRRGetMonitors(ClientPtr client) {
REQUEST_SIZE_MATCH(xRRGetMonitorsReq); REQUEST_SIZE_MATCH(xRRGetMonitorsReq);
swapl(&stuff->window); swapl(&stuff->window);
return ProcRRGetMonitors(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -569,7 +569,7 @@ SProcRRSetMonitor(ClientPtr client) {
swaps(&stuff->monitor.width); swaps(&stuff->monitor.width);
swaps(&stuff->monitor.height); swaps(&stuff->monitor.height);
SwapRestL(stuff); SwapRestL(stuff);
return ProcRRSetMonitor(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -579,7 +579,7 @@ SProcRRDeleteMonitor(ClientPtr client) {
REQUEST_SIZE_MATCH(xRRDeleteMonitorReq); REQUEST_SIZE_MATCH(xRRDeleteMonitorReq);
swapl(&stuff->window); swapl(&stuff->window);
swapl(&stuff->name); swapl(&stuff->name);
return ProcRRDeleteMonitor(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -591,7 +591,7 @@ SProcRRCreateLease(ClientPtr client) {
swaps(&stuff->nCrtcs); swaps(&stuff->nCrtcs);
swaps(&stuff->nOutputs); swaps(&stuff->nOutputs);
SwapRestL(stuff); SwapRestL(stuff);
return ProcRRCreateLease(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
static int _X_COLD static int _X_COLD
@ -600,72 +600,63 @@ SProcRRFreeLease(ClientPtr client) {
REQUEST_SIZE_MATCH(xRRFreeLeaseReq); REQUEST_SIZE_MATCH(xRRFreeLeaseReq);
swapl(&stuff->lid); swapl(&stuff->lid);
return ProcRRFreeLease(client); return ProcRandrVector[stuff->randrReqType] (client);
} }
int int (*SProcRandrVector[RRNumberRequests]) (ClientPtr) = {
SProcRRDispatch(ClientPtr client) SProcRRQueryVersion, /* 0 */
{ /* we skip 1 to make old clients fail pretty immediately */
REQUEST(xReq); NULL, /* 1 SProcRandrOldGetScreenInfo */
UpdateCurrentTimeIf(); /* V1.0 apps share the same set screen config request id */
SProcRRSetScreenConfig, /* 2 */
switch (stuff->data) { NULL, /* 3 SProcRandrOldScreenChangeSelectInput */
case X_RRQueryVersion: return SProcRRQueryVersion(client); /* 3 used to be ScreenChangeSelectInput; deprecated */
case X_RRSetScreenConfig: return SProcRRSetScreenConfig(client); SProcRRSelectInput, /* 4 */
case X_RRSelectInput: return SProcRRSelectInput(client); SProcRRGetScreenInfo, /* 5 */
case X_RRGetScreenInfo: return SProcRRGetScreenInfo(client);
/* V1.2 additions */ /* V1.2 additions */
case X_RRGetScreenSizeRange: return SProcRRGetScreenSizeRange(client); SProcRRGetScreenSizeRange, /* 6 */
case X_RRSetScreenSize: return SProcRRSetScreenSize(client); SProcRRSetScreenSize, /* 7 */
case X_RRGetScreenResources: return SProcRRGetScreenResources(client); SProcRRGetScreenResources, /* 8 */
case X_RRGetOutputInfo: return SProcRRGetOutputInfo(client); SProcRRGetOutputInfo, /* 9 */
case X_RRListOutputProperties: return SProcRRListOutputProperties(client); SProcRRListOutputProperties, /* 10 */
case X_RRQueryOutputProperty: return SProcRRQueryOutputProperty(client); SProcRRQueryOutputProperty, /* 11 */
case X_RRConfigureOutputProperty: return SProcRRConfigureOutputProperty(client); SProcRRConfigureOutputProperty, /* 12 */
case X_RRChangeOutputProperty: return SProcRRChangeOutputProperty(client); SProcRRChangeOutputProperty, /* 13 */
case X_RRDeleteOutputProperty: return SProcRRDeleteOutputProperty(client); SProcRRDeleteOutputProperty, /* 14 */
case X_RRGetOutputProperty: return SProcRRGetOutputProperty(client); SProcRRGetOutputProperty, /* 15 */
case X_RRCreateMode: return SProcRRCreateMode(client); SProcRRCreateMode, /* 16 */
case X_RRDestroyMode: return SProcRRDestroyMode(client); SProcRRDestroyMode, /* 17 */
case X_RRAddOutputMode: return SProcRRAddOutputMode(client); SProcRRAddOutputMode, /* 18 */
case X_RRDeleteOutputMode: return SProcRRDeleteOutputMode(client); SProcRRDeleteOutputMode, /* 19 */
case X_RRGetCrtcInfo: return SProcRRGetCrtcInfo(client); SProcRRGetCrtcInfo, /* 20 */
case X_RRSetCrtcConfig: return SProcRRSetCrtcConfig(client); SProcRRSetCrtcConfig, /* 21 */
case X_RRGetCrtcGammaSize: return SProcRRGetCrtcGammaSize(client); SProcRRGetCrtcGammaSize, /* 22 */
case X_RRGetCrtcGamma: return SProcRRGetCrtcGamma(client); SProcRRGetCrtcGamma, /* 23 */
case X_RRSetCrtcGamma: return SProcRRSetCrtcGamma(client); SProcRRSetCrtcGamma, /* 24 */
/* V1.3 additions */ /* V1.3 additions */
case X_RRGetScreenResourcesCurrent: return SProcRRGetScreenResourcesCurrent(client); SProcRRGetScreenResourcesCurrent, /* 25 */
case X_RRSetCrtcTransform: return SProcRRSetCrtcTransform(client); SProcRRSetCrtcTransform, /* 26 */
case X_RRGetCrtcTransform: return SProcRRGetCrtcTransform(client); SProcRRGetCrtcTransform, /* 27 */
case X_RRGetPanning: return SProcRRGetPanning(client); SProcRRGetPanning, /* 28 */
case X_RRSetPanning: return SProcRRSetPanning(client); SProcRRSetPanning, /* 29 */
case X_RRSetOutputPrimary: return SProcRRSetOutputPrimary(client); SProcRRSetOutputPrimary, /* 30 */
case X_RRGetOutputPrimary: return SProcRRGetOutputPrimary(client); SProcRRGetOutputPrimary, /* 31 */
/* V1.4 additions */ /* V1.4 additions */
case X_RRGetProviders: return SProcRRGetProviders(client); SProcRRGetProviders, /* 32 */
case X_RRGetProviderInfo: return SProcRRGetProviderInfo(client); SProcRRGetProviderInfo, /* 33 */
case X_RRSetProviderOffloadSink: return SProcRRSetProviderOffloadSink(client); SProcRRSetProviderOffloadSink, /* 34 */
case X_RRSetProviderOutputSource: return SProcRRSetProviderOutputSource(client); SProcRRSetProviderOutputSource, /* 35 */
case X_RRListProviderProperties: return SProcRRListProviderProperties(client); SProcRRListProviderProperties, /* 36 */
case X_RRQueryProviderProperty: return SProcRRQueryProviderProperty(client); SProcRRQueryProviderProperty, /* 37 */
case X_RRConfigureProviderProperty: return SProcRRConfigureProviderProperty(client); SProcRRConfigureProviderProperty, /* 38 */
case X_RRChangeProviderProperty: return SProcRRChangeProviderProperty(client); SProcRRChangeProviderProperty, /* 39 */
case X_RRDeleteProviderProperty: return SProcRRDeleteProviderProperty(client); SProcRRDeleteProviderProperty, /* 40 */
case X_RRGetProviderProperty: return SProcRRGetProviderProperty(client); SProcRRGetProviderProperty, /* 41 */
/* V1.5 additions */ /* V1.5 additions */
case X_RRGetMonitors: return SProcRRGetMonitors(client); SProcRRGetMonitors, /* 42 */
case X_RRSetMonitor: return SProcRRSetMonitor(client); SProcRRSetMonitor, /* 43 */
case X_RRDeleteMonitor: return SProcRRDeleteMonitor(client); SProcRRDeleteMonitor, /* 44 */
/* V1.6 additions */ /* V1.6 additions */
case X_RRCreateLease: return SProcRRCreateLease(client); SProcRRCreateLease, /* 45 */
case X_RRFreeLease: return SProcRRFreeLease(client); SProcRRFreeLease, /* 46 */
} };
return BadRequest;
}

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),