From d742025f435f3eb7458cf8284d59300bc9a850aa Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 12 Dec 2006 20:16:49 -0800 Subject: 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) --- randr/rrmode.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'randr') 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; } -- cgit v1.2.3