hw/xwin: Always keep RANDR fake mode information up to date

The rrGetInfo hook is not called for all RANDR requests (e.g.
RRGetOutputInfo), so we must always keep the fake mode information up to
date, rather than doing it lazily in the rrGetInfo hook)

Because we are so bad, most GTK+3 versions treat the output name 'default'
specially, and don't try to use RANDR with it.  But versions 3.21.6 to
3.22.24, don't do this, and get badly confused by a CRTC with size 0x0.

See:
https://bugzilla.gnome.org/show_bug.cgi?id=771033
https://bugzilla.gnome.org/show_bug.cgi?id=780101

Future work: Rather than reporting a single fake CRTC with a mode matching
the entire virtual display, the fake CRTCs we report should match our
'pseudo-xinerama' monitors
This commit is contained in:
Jon Turney 2018-03-09 14:16:01 +00:00
parent b078e03410
commit 2549ab2065

View File

@ -42,17 +42,17 @@
static Bool static Bool
winRandRGetInfo(ScreenPtr pScreen, Rotation * pRotations) winRandRGetInfo(ScreenPtr pScreen, Rotation * pRotations)
{ {
rrScrPrivPtr pRRScrPriv;
RROutputPtr output;
pRRScrPriv = rrGetScrPriv(pScreen);
output = pRRScrPriv->outputs[0];
winDebug("winRandRGetInfo ()\n"); winDebug("winRandRGetInfo ()\n");
/* Don't support rotations */ /* Don't support rotations */
*pRotations = RR_Rotate_0; *pRotations = RR_Rotate_0;
return TRUE;
}
static void
winRandRUpdateMode(ScreenPtr pScreen, RROutputPtr output)
{
/* Delete previous mode */ /* Delete previous mode */
if (output->modes[0]) if (output->modes[0])
{ {
@ -83,8 +83,6 @@ winRandRGetInfo(ScreenPtr pScreen, Rotation * pRotations)
mode = RRModeGet(&modeInfo, name); mode = RRModeGet(&modeInfo, name);
output->crtc->mode = mode; output->crtc->mode = mode;
} }
return TRUE;
} }
/* /*
@ -95,6 +93,7 @@ winDoRandRScreenSetSize(ScreenPtr pScreen,
CARD16 width, CARD16 width,
CARD16 height, CARD32 mmWidth, CARD32 mmHeight) CARD16 height, CARD32 mmWidth, CARD32 mmHeight)
{ {
rrScrPrivPtr pRRScrPriv;
winScreenPriv(pScreen); winScreenPriv(pScreen);
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
WindowPtr pRoot = pScreen->root; WindowPtr pRoot = pScreen->root;
@ -136,6 +135,10 @@ winDoRandRScreenSetSize(ScreenPtr pScreen,
// and arrange for it to be repainted // and arrange for it to be repainted
pScreen->PaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND); pScreen->PaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
// Set mode to current display size
pRRScrPriv = rrGetScrPriv(pScreen);
winRandRUpdateMode(pScreen, pRRScrPriv->primaryOutput);
/* Indicate that a screen size change took place */ /* Indicate that a screen size change took place */
RRScreenSizeNotify(pScreen); RRScreenSizeNotify(pScreen);
} }
@ -270,6 +273,9 @@ winRandRInit(ScreenPtr pScreen)
/* Ensure we have space for exactly one mode */ /* Ensure we have space for exactly one mode */
output->modes = malloc(sizeof(RRModePtr)); output->modes = malloc(sizeof(RRModePtr));
output->modes[0] = NULL; output->modes[0] = NULL;
/* Set mode to current display size */
winRandRUpdateMode(pScreen, output);
} }
/* /*