Re-initialize physical screen size only if -dpi was passed.

Physical screen size from the config file or DDC will already
be set correctly in the screen structure, unless it was computed from the
virtual size using the -dpi command line option. Recompute physical size as
we reset the screen size if the -dpi option was used.
This commit is contained in:
Keith Packard 2006-12-19 16:45:39 -08:00
parent b00951a5c8
commit 2ef4c5e8f6
1 changed files with 15 additions and 9 deletions

View File

@ -835,9 +835,10 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
int c;
int width, height;
int mmWidth, mmHeight;
/*
* Compute width of screen
* Compute size of screen
*/
width = 0; height = 0;
for (c = 0; c < config->num_crtc; c++)
@ -854,14 +855,19 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
if (width && height)
{
int mmWidth, mmHeight;
mmWidth = pScreen->mmWidth;
mmHeight = pScreen->mmHeight;
if (width != pScreen->width)
mmWidth = mmWidth * width / pScreen->width;
if (height != pScreen->height)
mmHeight = mmHeight * height / pScreen->height;
/*
* Compute physical size of screen
*/
if (monitorResolution)
{
mmWidth = width * 25.4 / monitorResolution;
mmHeight = height * 25.4 / monitorResolution;
}
else
{
mmWidth = pScreen->mmWidth;
mmHeight = pScreen->mmHeight;
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Setting screen physical size to %d x %d\n",
mmWidth, mmHeight);