summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2008-12-08 22:37:17 (GMT)
committerAdam Jackson <ajax@redhat.com>2008-12-16 14:55:17 (GMT)
commitf0234a9eb88ed103bca7db73a833c472ab95b48f (patch)
tree553bc7135882c79925ace1f586e12efb7638d566
parent2ef02833d614c42693e019a444560e84f501b5dc (diff)
randr: Mangle GetScreenResources sort order based on primary output
(cherry picked from commit cdcb516e561e2f65eb2fa523ca001c57674d5caf)
-rw-r--r--randr/rrscreen.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 7a8f2eb..9b1024e 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -324,7 +324,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
rrScrPrivPtr pScrPriv;
CARD8 *extra;
unsigned long extraLen;
- int i, n, rc;
+ int i, n, rc, has_primary;
RRCrtc *crtcs;
RROutput *outputs;
xRRModeInfo *modeinfos;
@@ -401,12 +401,23 @@ rrGetScreenResources(ClientPtr client, Bool query)
outputs = (RROutput *) (crtcs + pScrPriv->numCrtcs);
modeinfos = (xRRModeInfo *) (outputs + pScrPriv->numOutputs);
names = (CARD8 *) (modeinfos + num_modes);
+
+ has_primary = (pScrPriv->primaryOutput != NULL);
+ if (pScrPriv->primaryOutput)
+ {
+ crtcs[0] = pScrPriv->primaryOutput->id;
+ if (client->swapped)
+ swapl (&crtcs[0], n);
+ }
for (i = 0; i < pScrPriv->numCrtcs; i++)
{
- crtcs[i] = pScrPriv->crtcs[i]->id;
+ if (pScrPriv->primaryOutput &&
+ pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i])
+ continue;
+ crtcs[i + has_primary] = pScrPriv->crtcs[i]->id;
if (client->swapped)
- swapl (&crtcs[i], n);
+ swapl (&crtcs[i + has_primary], n);
}
for (i = 0; i < pScrPriv->numOutputs; i++)