summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@guitar.keithp.com>2006-12-12 20:16:49 -0800
committerKeith Packard <keithp@guitar.keithp.com>2006-12-12 20:16:49 -0800
commit78689d0d6630afcbcd3ce5394d12c2564a489f45 (patch)
tree4b78d719f04912f5141ab00a050dab09ee56fa6c
parent12c9714ba7dc01bb845b299ec9213e8c2e98e3e6 (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.
-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;
}