summaryrefslogtreecommitdiff
path: root/randr/rrmode.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@guitar.keithp.com>2006-12-12 20:16:49 -0800
committerDave Airlie <airlied@linux.ie>2006-12-15 18:32:10 +1100
commitd742025f435f3eb7458cf8284d59300bc9a850aa (patch)
tree1cbd81980ebf89e8b89fc5a9defbf031d5eddae5 /randr/rrmode.c
parent9e32bf98bc9ab17a137664d01f59a8f426f7ff3b (diff)
RandR mode list needs both output and crtc modes.
When an output no longer reports the current mode, it must still be included in the list advertised by the X server. Walk the crtcs to ensure it is included. (cherry picked from 78689d0d6630afcbcd3ce5394d12c2564a489f45 commit)
Diffstat (limited to 'randr/rrmode.c')
-rw-r--r--randr/rrmode.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/randr/rrmode.c b/randr/rrmode.c
index a0696e170..261e1b75f 100644
--- a/randr/rrmode.c
+++ b/randr/rrmode.c
@@ -108,12 +108,15 @@ RRModePtr *
RRModesForScreen (ScreenPtr pScreen, int *num_ret)
{
rrScrPriv(pScreen);
- int o;
+ int o, c;
RRModePtr *screen_modes;
int num_screen_modes = 0;
screen_modes = xalloc ((num_modes ? num_modes : 1) * sizeof (RRModePtr));
+ /*
+ * Add modes from all outputs
+ */
for (o = 0; o < pScrPriv->numOutputs; o++)
{
RROutputPtr output = pScrPriv->outputs[o];
@@ -129,6 +132,24 @@ RRModesForScreen (ScreenPtr pScreen, int *num_ret)
screen_modes[num_screen_modes++] = mode;
}
}
+ /*
+ * Add modes from all crtcs. The goal is to
+ * make sure all available and active modes
+ * are visible to the client
+ */
+ for (c = 0; c < pScrPriv->numCrtcs; c++)
+ {
+ RRCrtcPtr crtc = pScrPriv->crtcs[c];
+ RRModePtr mode = crtc->mode;
+ int n;
+
+ if (!mode) continue;
+ for (n = 0; n < num_screen_modes; n++)
+ if (screen_modes[n] == mode)
+ break;
+ if (n == num_screen_modes)
+ screen_modes[num_screen_modes++] = mode;
+ }
*num_ret = num_screen_modes;
return screen_modes;
}