summaryrefslogtreecommitdiff
path: root/randr
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2008-12-08 17:37:17 -0500
committerAdam Jackson <ajax@redhat.com>2008-12-10 11:31:28 -0500
commitcdcb516e561e2f65eb2fa523ca001c57674d5caf (patch)
tree22c5936d4c1ca9c51a1b064feb11e4a4ccc0ecdb /randr
parentd7b316e82bc7051f8829b4f4a640f50ae91c2db9 (diff)
randr: Mangle GetScreenResources sort order based on primary output
Diffstat (limited to 'randr')
-rw-r--r--randr/rrscreen.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index c8fea996c..85a30a4f5 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++)