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));
 


-- 
Pierre Ossman            OpenSource-based Thin Client Technology
System Developer         Telephone: +46-13-21 46 00
Cendio AB                Web: http://www.cendio.com

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
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

Reply via email to