On Tue, Jun 02, 2009 at 11:07:33AM +0200, Pierre Ossman wrote: > DPI is still a complete mess in X, and I don't see any point in trying > to create a proper value as we don't have any knowledge of the physical > screen in VNC. Instead we should try to retain the initial DPI at all > times as that makes things behave fairly consistent. > > This should be in 1.0. > > Index: xserver/hw/vnc/xvnc.cc > =================================================================== > --- xserver/hw/vnc/xvnc.cc (revision 3829) > +++ xserver/hw/vnc/xvnc.cc (working copy) > @@ -991,6 +991,7 @@ > void *pbits; > Bool ret; > int oldwidth, oldheight, oldmmWidth, oldmmHeight; > + int dpix, dpiy; > > /* Prevent updates while we fiddle */ > xf86SetRootClip(pScreen, FALSE); > @@ -1001,12 +1002,18 @@ > oldmmWidth = pScreen->mmWidth; > oldmmHeight = pScreen->mmHeight; > > + /* Compute the current DPI (for use later) */ > + dpix = (pScreen->width * 254 + pScreen->mmWidth * 5) / (pScreen->mmWidth > * 10); > + dpiy = (pScreen->height * 254 + pScreen->mmHeight * 5) / > (pScreen->mmHeight * 10); > + > /* Then set the new dimensions */ > pScreen->width = pSize->width; > pScreen->height = pSize->height; > - pScreen->mmWidth = pSize->mmWidth; > - pScreen->mmHeight = pSize->mmHeight; > > + /* Try to keep the same DPI as we do not have a physical screen */ > + pScreen->mmWidth = (pScreen->width * 254 + dpix * 5) / (dpix * 10); > + pScreen->mmHeight = (pScreen->height * 254 + dpiy * 5) / (dpiy * 10); > + > /* Allocate a new framebuffer */ > memset(&fb, 0, sizeof(vfbFramebufferInfo));
Hm, patch doesn't look fine for me. First, we should use same DPI in vfbScreenInit and vncRandRSetConfig functions. Also I don't understand your magical constants - 254 should be 25.4, shouldn't it? I think we should try to be consistent with the bare Xorg. Otherwise libvnc.so module could have problems. I suggest this approach: /* Defined in hw/xfree86/common/xf86Priv.h */ #ifndef DEFAULT_DPI #define DEFAULT_DPI 96 #endif if (monitorResolution != 0) { mmWidth = width * 25.4 / monitorResolution; mmHeight = height * 25.4 / monitorResolution; } else { mmWidth = width * 25.4 / DEFAULT_DPI; mmHeight = height * 25.4 / DEFAULT_DPI; } What is your opinion? Regards, Adam -- Adam Tkac, Red Hat, Inc. ------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get _______________________________________________ Tigervnc-devel mailing list Tigervnc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tigervnc-devel