randr: Mangle compat Xinerama reply based on primary output

This commit is contained in:
Adam Jackson 2008-12-08 17:28:55 -05:00
parent 9d58d2a319
commit d7b316e82b

View File

@ -260,6 +260,30 @@ ProcRRXineramaIsActive(ClientPtr client)
return client->noClientException; return client->noClientException;
} }
static void
RRXineramaWriteCrtc(ClientPtr client, RRCrtcPtr crtc)
{
xXineramaScreenInfo scratch;
if (RRXineramaCrtcActive (crtc))
{
int width, height;
RRCrtcGetScanoutSize (crtc, &width, &height);
scratch.x_org = crtc->x;
scratch.y_org = crtc->y;
scratch.width = width;
scratch.height = height;
if(client->swapped) {
register int n;
swaps(&scratch.x_org, n);
swaps(&scratch.y_org, n);
swaps(&scratch.width, n);
swaps(&scratch.height, n);
}
WriteToClient(client, sz_XineramaScreenInfo, &scratch);
}
}
int int
ProcRRXineramaQueryScreens(ClientPtr client) ProcRRXineramaQueryScreens(ClientPtr client)
{ {
@ -291,26 +315,16 @@ ProcRRXineramaQueryScreens(ClientPtr client)
rrScrPriv(pScreen); rrScrPriv(pScreen);
xXineramaScreenInfo scratch; xXineramaScreenInfo scratch;
int i; int i;
int has_primary = (pScrPriv->primaryOutput != NULL);
if (has_primary) {
RRXineramaWriteCrtc(client, pScrPriv->primaryOutput->crtc);
}
for(i = 0; i < pScrPriv->numCrtcs; i++) { for(i = 0; i < pScrPriv->numCrtcs; i++) {
RRCrtcPtr crtc = pScrPriv->crtcs[i]; RRCrtcPtr crtc = pScrPriv->crtcs[i];
if (RRXineramaCrtcActive (crtc)) if (!has_primary || (crtc != pScrPriv->primaryOutput->crtc))
{ RRXineramaWriteCrtc(client, crtc);
int width, height;
RRCrtcGetScanoutSize (crtc, &width, &height);
scratch.x_org = crtc->x;
scratch.y_org = crtc->y;
scratch.width = width;
scratch.height = height;
if(client->swapped) {
register int n;
swaps(&scratch.x_org, n);
swaps(&scratch.y_org, n);
swaps(&scratch.width, n);
swaps(&scratch.height, n);
}
WriteToClient(client, sz_XineramaScreenInfo, (char *)&scratch);
}
} }
} }