diff options
author | Pierre Ossman <ossman@cendio.se> | 2009-06-02 13:42:55 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2009-06-02 13:42:55 +0000 |
commit | 4dce5a209455aa084b9c47d08acd13123b48fd92 (patch) | |
tree | bf9ee3c63233bb27ed93ecb0d18df8049808a5fb /unix/xserver | |
parent | 1747751e9a084e1772317e06b3cab41a30d9e68e (diff) | |
download | tigervnc-4dce5a209455aa084b9c47d08acd13123b48fd92.tar.gz tigervnc-4dce5a209455aa084b9c47d08acd13123b48fd92.zip |
Try to keep DPI when we change resolution as we have no idea what the
dimensions of the client's screen is anyway.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3831 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'unix/xserver')
-rw-r--r-- | unix/xserver/hw/vnc/xvnc.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/unix/xserver/hw/vnc/xvnc.cc b/unix/xserver/hw/vnc/xvnc.cc index 5231b156..a73588f4 100644 --- a/unix/xserver/hw/vnc/xvnc.cc +++ b/unix/xserver/hw/vnc/xvnc.cc @@ -991,6 +991,7 @@ static Bool vncRandRSetConfig (ScreenPtr pScreen, Rotation rotation, void *pbits; Bool ret; int oldwidth, oldheight, oldmmWidth, oldmmHeight; + int dpix, dpiy; /* Prevent updates while we fiddle */ xf86SetRootClip(pScreen, FALSE); @@ -1001,11 +1002,17 @@ static Bool vncRandRSetConfig (ScreenPtr pScreen, Rotation rotation, 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)); |