summaryrefslogtreecommitdiff
path: root/randr/rrscreen.c
diff options
context:
space:
mode:
Diffstat (limited to 'randr/rrscreen.c')
-rw-r--r--randr/rrscreen.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 3456c72a4..590a388d9 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, has_primary;
+ int i, n, rc, has_primary = 0;
RRCrtc *crtcs;
RROutput *outputs;
xRRModeInfo *modeinfos;
@@ -402,19 +402,22 @@ rrGetScreenResources(ClientPtr client, Bool query)
modeinfos = (xRRModeInfo *) (outputs + pScrPriv->numOutputs);
names = (CARD8 *) (modeinfos + num_modes);
- has_primary = (pScrPriv->primaryOutput != NULL);
- if (pScrPriv->primaryOutput)
+ if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc)
{
- crtcs[0] = pScrPriv->primaryOutput->id;
+ has_primary = 1;
+ crtcs[0] = pScrPriv->primaryOutput->crtc->id;
if (client->swapped)
swapl (&crtcs[0], n);
}
for (i = 0; i < pScrPriv->numCrtcs; i++)
{
- if (pScrPriv->primaryOutput &&
+ if (has_primary &&
pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i])
+ {
+ has_primary = 0;
continue;
+ }
crtcs[i + has_primary] = pScrPriv->crtcs[i]->id;
if (client->swapped)
swapl (&crtcs[i + has_primary], n);