xpra icon
Bug tracker and wiki

Version 7 (modified by alas, 5 years ago) (diff)

--

DPI


Introduction

We try to synchronize the DPI from the client to the server, so that applications will render with the correct settings and "look right" on the client. This may affect fonts, window sizes, cursors sizes, etc.

Caveats:

  • support varies greatly depending on the operating system and version, desktop environment, number of monitors attached and their resolution, etc
  • DPI support is much improved in version 0.16
  • with X11, there are far too many places where the DPI can be looked up, many places where it can be overriden
  • for virtualized "hardware DPI" which some applications calculate from the virtual monitor dimensions, you will need a patched wiki/Xdummy driver and wiki/FakeXinerama
  • many applications will not reload the DPI settings, so they must be started after the client connects to get the correct DPI value

Related xpra tickets

  • #697 gtk screen dimension detection is broken with high dpi displays on windows7 and later
  • #163 pass client DPI preference to server (and use sane defaults of 96dpi)
  • #976 client display scaling
  • #919 frame extents synchronization
  • #887 chrome DPI
  • #882 DPI with Ubuntu (not fixable as Ubuntu does not use wiki/Xdummy)

Data

Still under construction...


Windows 8.1


Windows 8.1 has two primary client controls for DPI/resolution.


  • Resolution control is at Control Panel\Appearance and Personalization\Display\Screen Resolution.
  • Text & Item size control is at Control Panel\Appearance and Personalization\Display.


Changing the Resolution of displays has a relatively straight forward effect - changing the workarea of the display, which in turn will be reflected in the settings that Xpra will detect from the client. Changing this value "on the fly" will be detected as expected by any active Xpra sessions, and the DPI will be recalculated accordingly.

For example, for a client with a 4K display with a screen size of 3840x2160, with --desktop-scaling=1, the server will set the DPI at 96x96 for the overall workarea, but will set the display at 157x160 DPI.

Adjusting the display's resolution to 1920x1080, the server will maintain a DPI for the workarea of 96, but will adjust the 1920x1080 display to a DPI of 78x80.

The above values assume the Text & Item sizing is set at the "smallest" of the five available settings for a 4K monitor.


Changing the Text & Item size controls, however, in addition to requiring a user to sign out/in to make the changes take effect, has a number of possible results which can interact in complicated ways when combined with resolution changes or scaling.

Here are considerably more examples.


With a 3820x2160 Display (Dell P2815Q) - client side effects (windows 8.1).

(Checked with NativeGUI_info.exe.)


Text Size Setting client dpi.x client dpi.y client cursor_size vertical-refresh window_frame.caption window_frame.frame window_frame.menu-bar window_frame.minimum window_frame.normal window_frame.offset client workarea
Smallest 96 96 32 29 23 (8, 8, 31, 8) 20 (140, 39) (8, 8) (8, 31) [(0, 0, 3840, 2120)]
Second smallest 120 120 32 29 29 (9, 9, 38, 9) 25 (178, 47) (9, 9) (9, 38) [(0, 0, 3840, 2112)]
Third smallest 144 144 48 29 34 (11, 11, 45, 11) 30 (210, 56) (11, 11) (11, 45) [(0, 0, 3840, 2104)]
Fourth smallest 192 192 64 29 45 (13, 13, 58, 13) 39 (274, 71) (13, 13) (13, 58) [(0, 0, 3840, 2088)]
Fifth smallest 240 240 64 29 56 (16, 16, 72, 16) 49 (340, 88) (16, 16) (16, 72) [(0, 0, 3840, 2072)]


With a 2560x1440 Display (HP ZR2740w IPS), there are only four available Text & Item settings.

Text Size Setting client dpi.x client dpi.y client cursor_size vertical-refresh window_frame.caption window_frame.frame window_frame.menu-bar window_frame.minimum window_frame.normal window_frame.offset client workarea
Smallest 96 96 32 59 23 (8, 8, 31, 8) 20 (140, 39) (8, 8) (8, 31) [(0, 0, 2560, 1400)]
Second smallest 120 120 32 59 29 (9, 9, 38, 9) 25 (178, 47) (9, 9) (9, 38) [(0, 0, 2560, 1392)]
Third smallest 144 144 48 59 34 (11, 11, 45, 11) 30 (210, 56) (11, 11) (11, 45) [(0, 0, 2560, 1384)]
Fourth smallest 192 192 64 59 45 (13, 13, 58, 13) 39 (274, 71) (13, 13) (13, 58) [(0, 0, 2560, 1368)]


Server side, however, when these different Text & Item size ("~DPI") settings are combined with scaling, a chart of values to at least use as a guidelines for expectations is called for.


  • With a 3820x2160 Display (Dell P2815Q)

(Checked with a combination of client side CLI output, xrdb -display :DISPLAY -query | grep dpi, and ./usr/lib64/python2.7/site-packages/xpra/platform gui.py.)

Size setting scaling server workarea DPI Display DPI Xft.dpi cursor_size dpi.randr vertical-refresh workarea xsettings.Xft/DPI
Smallest 100% 96x96 157x160 96 32 (96, 96) 10 (0, 0, 3840, 2120) 98304
Smallest 125% 76x76 125x128 77 32 (77, 77) 30 (0, 0, 3072, 1696) 78848
Smallest 150% 64x64 104x107 64 32 (64, 64) 10 (0, 0, 2560, 1413) 65536
Smallest 200% 48x48 78x80 48 32 (48, 48) 10 (0, 0, 1920, 1060) 49152
Smallest 300% 32x32 52x53 32 32 (32, 32) 50 (0, 0, 1280, 707) 32768
Second Smallest 100% 120x120 157x160 120 32 (120, 120) 10 (0, 0, 3840, 2112) 122880
Second Smallest 125% 96x96 125x128 96 32 (96, 96) 30 (0, 0, 3072, 1690) 98304
Second Smallest 150% 80x80 104x107 80 32 (80, 80) 10 (0, 0, 2560, 1408) 81920
Second Smallest 200% 60x60 78x80 60 32 (60, 60) 10 (0, 0, 1920, 1056) 61440
Second Smallest 300% 40x40 52x53 40 32 (40, 40) 50 (0, 0, 1280, 704) 40960
Third Smallest 100% 144x144 157x160 144 48 (144, 144) 10 (0, 0, 3840, 2104) 147456
Third Smallest 125% 115x115 125x128 115 48 (115, 115) 30 (0, 0, 3072, 1683) 117760
Third Smallest 150% 96x96 104x107 96 48 (96, 96) 10 (0, 0, 2560, 1403) 98304
Third Smallest 200% 72x72 78x80 72 48 (72, 72) 10 (0, 0, 1920, 1052) 73728
Third Smallest 300% 48x48 52x53 48 48 (48, 48) 50 (0, 0, 1280, 701) 49152
Fourth Smallest 100% 192x192 157x160 192 64 (192, 193) 10 (0, 0, 3840, 2088) 196608
Fourth Smallest 125% 153x154 125x128 154 64 (154, 154) 30 (0, 0, 3072, 1670) 157696
Fourth Smallest 150% 128x128 104x107 128 64 (128, 128) 10 (0, 0, 2560, 1392) 131072
Fourth Smallest 200% 96x96 78x80 96 64 (96, 96) 10 (0, 0, 1920, 1044) 98304
Fourth Smallest 300% 64x64 52x53 64 64 (64, 64) 30 (0, 0, 1280, 696) 65536
Fifth Smallest 100% 240x240 157x160 240 64 (240, 241) 10 (0, 0, 3840, 2072) 245760
Fifth Smallest 125% 192x192 125x128 192 64 (192, 192) 30 (0, 0, 3072, 1658) 196608
Fifth Smallest 150% 160x160 104x107 160 64 (160, 160) 10 (0, 0, 2560, 1381) 163840
Fifth Smallest 200% 120x120 78x80 120 64 (120, 120) 10 (0, 0, 1920, 1036) 122880
Fifth Smallest 300% 80x80 52x53 80 64 (80, 80) 50 (0, 0, 1280, 691) 81920


  • With a 2560x1440 Display (HP ZR2740w IPS), there are only four "Size" settings available:

(Checked, likewise, with a combination of client side CLI output, xrdb -display :DISPLAY -query | grep dpi, and ./usr/lib64/python2.7/site-packages/xpra/platform gui.py.)


Size setting scaling server workarea DPI Display DPI Xft.dpi cursor_size dpi.randr vertical-refresh workarea xsettings.Xft/DPI
Smallest 100% 96x96 108x108 96 32 (96, 96) 10 (0, 0, 2560, 1400) 98304
Smallest 125% 76x76 87x87 77 32 (77, 77) 60 (0, 0, 2048, 1120) 78848
Smallest 150% 64x64 72x72 64 32 (64, 64) 10 (0, 0, 1707, 933) 65536
Smallest 200% 48x48 54x54 48 32 (48, 48) 50 (0, 0, 1280, 700) 49152
Smallest 300% 32x32 36x36 32 32 (32, 32) 25 (0, 0, 853, 467) 32768
Second Smallest 100% 120x120 108x108 120 32 (120, 120) 10 (0, 0, 2560, 1392) 122880
Second Smallest 125% 96x96 87x87 96 32 (96, 96) 60 (0, 0, 2048, 1114) 98304
Second Smallest 150% 80x80 72x72 80 32 (80, 80) 10 (0, 0, 1707, 928) 81920
Second Smallest 200% 60x60 54x54 60 32 (60, 60) 50 (0, 0, 1280, 696) 61440
Second Smallest 300% 40x40 36x36 40 32 (40, 40) 25 (0, 0, 1853, 464) 40960
Third Smallest 100% 144x144 108x108 144 48 (144, 144) 10 (0, 0, 2560, 1384) 147456
Third Smallest 125% 115x115 87x87 115 48 (115, 115) 60 (0, 0, 2048, 1107) 117760
Third Smallest 150% 96x96 72x72 96 48 (96, 96) 10 (0, 0, 1707, 923) 98304
Third Smallest 200% 72x72 54x54 72 48 (72, 72) 50 (0, 0, 1280, 692) 73728
Third Smallest 300% 48x48 36x36 48 48 (48, 48) 25 (0, 0, 853, 461) 49152
Fourth Smallest 100% 192x192 108x108 192 64 (192, 193) 10 (0, 0, 2560, 1368) 196608
Fourth Smallest 125% 153x154 87x87 154 64 (154, 154) 60 (0, 0, 2048, 1094) 157696
Fourth Smallest 150% 128x128 72x72 128 64 (128, 128) 10 (0, 0, 1707, 912) 131072
Fourth Smallest 200% 96x96 54x54 96 64 (96, 96) 50 (0, 0, 1280, 684) 98304
Fourth Smallest 300% 64x64 36x36 64 64 (64, 64) 25 (0, 0, 853, 456) 65536