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; \
}
static int ProcRRDispatch(ClientPtr pClient);
static int SProcRRDispatch(ClientPtr pClient);
int RREventBase;
int RRErrorBase;
RESTYPE RRClientType, RREventType; /* resource types for event masks */
@ -315,6 +318,7 @@ RRScreenInit(ScreenPtr pScreen)
/*
* Calling function best set these function vectors
*/
pScrPriv->rrGetInfo = 0;
pScrPriv->maxWidth = pScrPriv->minWidth = pScreen->width;
pScrPriv->maxHeight = pScrPriv->minHeight = pScreen->height;
@ -322,11 +326,21 @@ RRScreenInit(ScreenPtr pScreen)
pScrPriv->height = pScreen->height;
pScrPriv->mmWidth = pScreen->mmWidth;
pScrPriv->mmHeight = pScreen->mmHeight;
#if RANDR_12_INTERFACE
pScrPriv->rrScreenSetSize = NULL;
pScrPriv->rrCrtcSet = NULL;
pScrPriv->rrCrtcSetGamma = NULL;
#endif
#if RANDR_10_INTERFACE
pScrPriv->rrSetConfig = 0;
pScrPriv->rotations = RR_Rotate_0;
pScrPriv->reqWidth = pScreen->width;
pScrPriv->reqHeight = pScreen->height;
pScrPriv->nSizes = 0;
pScrPriv->pSizes = NULL;
pScrPriv->rotation = RR_Rotate_0;
pScrPriv->rate = 0;
pScrPriv->size = 0;
#endif
/*
@ -341,6 +355,10 @@ RRScreenInit(ScreenPtr pScreen)
pScreen->ConstrainCursorHarder = RRConstrainCursorHarder;
pScreen->ReplaceScanoutPixmap = RRReplaceScanoutPixmap;
pScrPriv->numOutputs = 0;
pScrPriv->outputs = NULL;
pScrPriv->numCrtcs = 0;
pScrPriv->crtcs = NULL;
xorg_list_init(&pScrPriv->leases);
@ -719,3 +737,23 @@ RRVerticalRefresh(xRRModeInfo * mode)
refresh = 0xffff;
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 (*ProcRandrVector[RRNumberRequests]) (ClientPtr);
extern int (*SProcRandrVector[RRNumberRequests]) (ClientPtr);
extern RESTYPE RRClientType, RREventType; /* resource types for event masks */
extern DevPrivateKeyRec RRClientPrivateKeyRec;
@ -133,12 +136,4 @@ int ProcRRCreateLease(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_ */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -83,7 +83,7 @@ RROutputCreate(ScreenPtr pScreen,
pScrPriv->outputs = outputs;
output = calloc(1, sizeof(RROutputRec) + nameLength + 1);
output = malloc(sizeof(RROutputRec) + nameLength + 1);
if (!output)
return NULL;
output->id = FakeClientID(0);
@ -94,6 +94,22 @@ RROutputCreate(ScreenPtr pScreen,
output->name[nameLength] = '\0';
output->connection = RR_UnknownConnection;
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;
if (!AddResource(output->id, RROutputType, (void *) output))
@ -465,8 +481,15 @@ 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;
@ -635,6 +658,7 @@ ProcRRGetOutputPrimary(ClientPtr client)
REQUEST(xRRGetOutputPrimaryReq);
WindowPtr pWin;
rrScrPrivPtr pScrPriv;
xRRGetOutputPrimaryReply rep;
RROutputPtr primary = NULL;
int rc;
@ -648,7 +672,7 @@ ProcRRGetOutputPrimary(ClientPtr client)
if (pScrPriv)
primary = pScrPriv->primaryOutput;
xRRGetOutputPrimaryReply rep = {
rep = (xRRGetOutputPrimaryReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.output = primary ? primary->id : None

View File

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

View File

@ -56,6 +56,7 @@ int
ProcRRGetProviders (ClientPtr client)
{
REQUEST(xRRGetProvidersReq);
xRRGetProvidersReply rep;
WindowPtr pWin;
ScreenPtr pScreen;
rrScrPrivPtr pScrPriv;
@ -86,25 +87,24 @@ ProcRRGetProviders (ClientPtr client)
if (!pScrPriv)
{
xRRGetProvidersReply rep = {
rep = (xRRGetProvidersReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.timestamp = currentTime.milliseconds,
.nProviders = 0
};
WriteToClient(client, sizeof(rep), &rep);
return Success;
}
extraLen = total_providers * sizeof(CARD32);
xRRGetProvidersReply rep = {
extra = NULL;
extraLen = 0;
} else {
rep = (xRRGetProvidersReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.timestamp = pScrPriv->lastSetTime.milliseconds,
.nProviders = total_providers,
.length = bytes_to_int32(extraLen),
.length = total_providers
};
extraLen = rep.length << 2;
if (extraLen) {
extra = malloc(extraLen);
if (!extra)
@ -117,6 +117,7 @@ ProcRRGetProviders (ClientPtr client)
xorg_list_for_each_entry(iter, &pScreen->secondary_list, secondary_head) {
ADD_PROVIDER(iter);
}
}
if (client->swapped) {
swaps(&rep.sequenceNumber);
@ -137,6 +138,7 @@ int
ProcRRGetProviderInfo (ClientPtr client)
{
REQUEST(xRRGetProviderInfoReq);
xRRGetProviderInfoReply rep;
rrScrPrivPtr pScrPriv, pScrProvPriv;
RRProviderPtr provider;
ScreenPtr pScreen;
@ -156,15 +158,17 @@ ProcRRGetProviderInfo (ClientPtr client)
pScreen = provider->pScreen;
pScrPriv = rrGetScrPriv(pScreen);
xRRGetProviderInfoReply rep = {
rep = (xRRGetProviderInfoReply) {
.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 */

View File

@ -107,10 +107,16 @@ RRCreateProviderProperty(Atom property)
{
RRPropertyPtr prop;
prop = (RRPropertyPtr) calloc(1, sizeof(RRPropertyRec));
prop = (RRPropertyPtr) malloc(sizeof(RRPropertyRec));
if (!prop)
return NULL;
prop->next = NULL;
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->pending);
return prop;
@ -385,6 +391,7 @@ ProcRRListProviderProperties(ClientPtr client)
{
REQUEST(xRRListProviderPropertiesReq);
Atom *pAtoms = NULL, *temppAtoms;
xRRListProviderPropertiesReply rep;
int numProps = 0;
RRProviderPtr provider;
RRPropertyPtr prop;
@ -399,7 +406,7 @@ ProcRRListProviderProperties(ClientPtr client)
if (!(pAtoms = xallocarray(numProps, sizeof(Atom))))
return BadAlloc;
xRRListProviderPropertiesReply rep = {
rep = (xRRListProviderPropertiesReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(numProps * sizeof(Atom)),
@ -427,6 +434,7 @@ int
ProcRRQueryProviderProperty(ClientPtr client)
{
REQUEST(xRRQueryProviderPropertyReq);
xRRQueryProviderPropertyReply rep;
RRProviderPtr provider;
RRPropertyPtr prop;
char *extra = NULL;
@ -444,8 +452,7 @@ ProcRRQueryProviderProperty(ClientPtr client)
if (!extra)
return BadAlloc;
}
xRRQueryProviderPropertyReply rep = {
rep = (xRRQueryProviderPropertyReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = prop->num_valid,
@ -607,8 +614,17 @@ 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;
@ -628,11 +644,15 @@ 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;
@ -664,6 +684,8 @@ 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)) {
@ -685,25 +707,23 @@ ProcRRGetProviderProperty(ClientPtr client)
swapl(&reply.bytesAfter);
swapl(&reply.nItems);
}
WriteToClient(client, sizeof(xGenericReply), &reply);
if (len) {
memcpy(extra, (char *) prop_value->data + ind, len);
switch (reply.format) {
case 32:
if (client->swapped)
SwapLongs((CARD32*) extra, len/sizeof(CARD32));
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
break;
case 16:
if (client->swapped)
SwapShorts((short*) extra, len/sizeof(CARD16));
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
break;
default:
client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
break;
}
}
WriteToClient(client, sizeof(xGenericReply), &reply);
WriteToClient(client, len, extra);
WriteSwappedDataToClient(client, len, extra);
free(extra);
}
if (stuff->delete && (reply.bytesAfter == 0)) { /* delete the Property */
*prev = prop->next;

View File

@ -76,6 +76,8 @@ 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 ? */
@ -190,6 +192,7 @@ int
ProcRRGetScreenSizeRange(ClientPtr client)
{
REQUEST(xRRGetScreenSizeRangeReq);
xRRGetScreenSizeRangeReply rep;
WindowPtr pWin;
ScreenPtr pScreen;
rrScrPrivPtr pScrPriv;
@ -203,9 +206,11 @@ ProcRRGetScreenSizeRange(ClientPtr client)
pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen);
xRRGetScreenSizeRangeReply rep = {
rep = (xRRGetScreenSizeRangeReply) {
.type = X_Reply,
.pad = 0,
.sequenceNumber = client->sequence,
.length = 0
};
if (pScrPriv) {
@ -367,6 +372,7 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen)
rrScrPrivPtr pScrPriv;
int num_modes;
RRModePtr *modes;
xRRGetScreenResourcesReply rep;
unsigned long extraLen;
CARD8 *extra;
RRCrtc *crtcs;
@ -403,10 +409,10 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen)
}
pScrPriv = rrGetScrPriv(pScreen);
xRRGetScreenResourcesReply rep = {
rep = (xRRGetScreenResourcesReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.timestamp = pScrPriv->lastSetTime.milliseconds,
.configTimestamp = pScrPriv->lastConfigTime.milliseconds,
.nCrtcs = total_crtcs,
@ -485,8 +491,8 @@ rrGetScreenResources(ClientPtr client, Bool query)
WindowPtr pWin;
ScreenPtr pScreen;
rrScrPrivPtr pScrPriv;
CARD8 *extra = NULL;
unsigned long extraLen = 0;
CARD8 *extra;
unsigned long extraLen;
int i, rc, has_primary = 0;
RRCrtc *crtcs;
RROutput *outputs;
@ -512,9 +518,16 @@ 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;
@ -527,13 +540,16 @@ 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;
@ -746,8 +762,8 @@ ProcRRGetScreenInfo(ClientPtr client)
int rc;
ScreenPtr pScreen;
rrScrPrivPtr pScrPriv;
CARD8 *extra = NULL;
unsigned long extraLen = 0;
CARD8 *extra;
unsigned long extraLen;
RROutputPtr output;
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
@ -769,11 +785,18 @@ 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;
@ -792,6 +815,7 @@ 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,
@ -881,6 +905,7 @@ int
ProcRRSetScreenConfig(ClientPtr client)
{
REQUEST(xRRSetScreenConfigReq);
xRRSetScreenConfigReply rep;
DrawablePtr pDraw;
int rc;
ScreenPtr pScreen;
@ -1085,10 +1110,12 @@ ProcRRSetScreenConfig(ClientPtr client)
free(pData);
xRRSetScreenConfigReply rep = {
rep = (xRRSetScreenConfigReply) {
.type = X_Reply,
.status = status,
.sequenceNumber = client->sequence,
.length = 0,
.newTimestamp = pScrPriv->lastSetTime.milliseconds,
.newConfigTimestamp = pScrPriv->lastConfigTime.milliseconds,
.root = pDraw->pScreen->root->drawable.id,

View File

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

View File

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