xpra icon
Bug tracker and wiki

Version 14 (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 window_frame.caption window_frame.frame window_frame.menu-bar window_frame.minimum window_frame.normal window_frame.offset client workarea
100% (Smallest) 96 96 32 23 (8, 8, 31, 8) 20 (140, 39) (8, 8) (8, 31) [(0, 0, 3840, 2120)]
125% 120 120 32 29 (9, 9, 38, 9) 25 (178, 47) (9, 9) (9, 38) [(0, 0, 3840, 2112)]
150% 144 144 48 34 (11, 11, 45, 11) 30 (210, 56) (11, 11) (11, 45) [(0, 0, 3840, 2104)]
200% 192 192 64 45 (13, 13, 58, 13) 39 (274, 71) (13, 13) (13, 58) [(0, 0, 3840, 2088)]
250% 240 240 64 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
100% (Smallest) 96 96 32 23 (8, 8, 31, 8) 20 (140, 39) (8, 8) (8, 31) [(0, 0, 2560, 1400)]
125% 120 120 32 29 (9, 9, 38, 9) 25 (178, 47) (9, 9) (9, 38) [(0, 0, 2560, 1392)]
150% 144 144 48 34 (11, 11, 45, 11) 30 (210, 56) (11, 11) (11, 45) [(0, 0, 2560, 1384)]
200% 192 192 64 45 (13, 13, 58, 13) 39 (274, 71) (13, 13) (13, 58) [(0, 0, 2560, 1368)]


With both a 3820x2160 (Dell P2815Q) & 1280x720 (HP ZR2740x IPS) - (this setup used an HDMI cable for the second display, limiting its resolution)... arranged with the smaller display to the left of the 4K, aligned along top edge.

Text Size Setting client dpi.x client dpi.y client cursor_size window_frame.caption window_frame.frame window_frame.menu-bar window_frame.minimum window_frame.normal window_frame.offset client workarea workareas
100% (Smallest) 96 96 32 23 (8, 8, 31, 8) 20 (140, 39) (8, 8) (8, 31) (0, 0, 5120, 2120) [(0, 0, 3840, 2120), (0, 0, 1280, 680)]
125% 120 120 32 29 (9, 9, 38, 9) 25 (178, 47) (9, 9) (9, 38) (0, 0, 5440, 2112) [(0, 0, 3840, 2112), (0, 0, 1600, 840)]
150% 144 144 48 34 (11, 11, 45, 11) 30 (210, 56) (11, 11) (11, 45) (0, 0, 3840, 2104) [(0, 0, 3840, 2104), (0, 0, 1920, 996)]
200% 192 192 48 45 (13, 13, 58, 13) 39 (274, 71) (13, 13) (13, 58) (0, 0, 6400, 2088) [(0, 0, 3840, 2088), (0, 0, 2560, 1440)]
250% 240 240 64 56 (16, 16, 72, 16) 49 (340, 88) (16, 16) (16, 72) (0, 0, 7040, 2072) [(0, 0, 3840, 2072), (0, 0, 3200, 1800)]

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
100% (Smallest) 100% 96x96 157x160 96 32 (96, 96) 10 (0, 0, 3840, 2120) 98304
100% (Smallest) 125% 76x76 125x128 77 32 (77, 77) 30 (0, 0, 3072, 1696) 78848
100% (Smallest) 150% 64x64 104x107 64 32 (64, 64) 10 (0, 0, 2560, 1413) 65536
100% (Smallest) 200% 48x48 78x80 48 32 (48, 48) 10 (0, 0, 1920, 1060) 49152
100% (Smallest) 300% 32x32 52x53 32 32 (32, 32) 50 (0, 0, 1280, 707) 32768
125% 100% 120x120 157x160 120 32 (120, 120) 10 (0, 0, 3840, 2112) 122880
125% 125% 96x96 125x128 96 32 (96, 96) 30 (0, 0, 3072, 1690) 98304
125% 150% 80x80 104x107 80 32 (80, 80) 10 (0, 0, 2560, 1408) 81920
125% 200% 60x60 78x80 60 32 (60, 60) 10 (0, 0, 1920, 1056) 61440
125% 300% 40x40 52x53 40 32 (40, 40) 50 (0, 0, 1280, 704) 40960
150% 100% 144x144 157x160 144 48 (144, 144) 10 (0, 0, 3840, 2104) 147456
150% 125% 115x115 125x128 115 48 (115, 115) 30 (0, 0, 3072, 1683) 117760
150% 150% 96x96 104x107 96 48 (96, 96) 10 (0, 0, 2560, 1403) 98304
150% 200% 72x72 78x80 72 48 (72, 72) 10 (0, 0, 1920, 1052) 73728
150% 300% 48x48 52x53 48 48 (48, 48) 50 (0, 0, 1280, 701) 49152
200% 100% 192x192 157x160 192 64 (192, 193) 10 (0, 0, 3840, 2088) 196608
200% 125% 153x154 125x128 154 64 (154, 154) 30 (0, 0, 3072, 1670) 157696
200% 150% 128x128 104x107 128 64 (128, 128) 10 (0, 0, 2560, 1392) 131072
200% 200% 96x96 78x80 96 64 (96, 96) 10 (0, 0, 1920, 1044) 98304
200% 300% 64x64 52x53 64 64 (64, 64) 30 (0, 0, 1280, 696) 65536
250% 100% 240x240 157x160 240 64 (240, 241) 10 (0, 0, 3840, 2072) 245760
250% 125% 192x192 125x128 192 64 (192, 192) 30 (0, 0, 3072, 1658) 196608
250% 150% 160x160 104x107 160 64 (160, 160) 10 (0, 0, 2560, 1381) 163840
250% 200% 120x120 78x80 120 64 (120, 120) 10 (0, 0, 1920, 1036) 122880
250% 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 workarea xsettings.Xft/DPI
100% (Smallest) 100% 96x96 108x108 96 32 (96, 96) (0, 0, 2560, 1400) 98304
100% (Smallest) 125% 76x76 87x87 77 32 (77, 77) (0, 0, 2048, 1120) 78848
100% (Smallest) 150% 64x64 72x72 64 32 (64, 64) (0, 0, 1707, 933) 65536
100% (Smallest) 200% 48x48 54x54 48 32 (48, 48) (0, 0, 1280, 700) 49152
100% (Smallest) 300% 32x32 36x36 32 32 (32, 32) (0, 0, 853, 467) 32768
125% 100% 120x120 108x108 120 32 (120, 120) (0, 0, 2560, 1392) 122880
125% 125% 96x96 87x87 96 32 (96, 96) (0, 0, 2048, 1114) 98304
125% 150% 80x80 72x72 80 32 (80, 80) (0, 0, 1707, 928) 81920
125% 200% 60x60 54x54 60 32 (60, 60) (0, 0, 1280, 696) 61440
125% 300% 40x40 36x36 40 32 (40, 40) (0, 0, 1853, 464) 40960
150% 100% 144x144 108x108 144 48 (144, 144) (0, 0, 2560, 1384) 147456
150% 125% 115x115 87x87 115 48 (115, 115) (0, 0, 2048, 1107) 117760
150% 150% 96x96 72x72 96 48 (96, 96) (0, 0, 1707, 923) 98304
150% 200% 72x72 54x54 72 48 (72, 72) (0, 0, 1280, 692) 73728
150% 300% 48x48 36x36 48 48 (48, 48) (0, 0, 853, 461) 49152
200% 100% 192x192 108x108 192 64 (192, 193) (0, 0, 2560, 1368) 196608
200% 125% 153x154 87x87 154 64 (154, 154) (0, 0, 2048, 1094) 157696
200% 150% 128x128 72x72 128 64 (128, 128) (0, 0, 1707, 912) 131072
200% 200% 96x96 54x54 96 64 (96, 96) (0, 0, 1280, 684) 98304
200% 300% 64x64 36x36 64 64 (64, 64) (0, 0, 853, 456) 65536


  • With a 3820x2160 (Dell P2815Q) & 1280x720 (HP ZR2740x IPS) Display (this setup involves an HDMI connection for the second monitor which limits the resolution available), there are again five "Sizes" available.

(Checked, once again, 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 One DPI Display Two DPI Xft.dpi cursor_size dpi.randr workarea xsettings.Xft/DPI
Smallest 100% 96x96 157x160 54x54 96 32 (96, 96) (0, 0, 5120, 2120) 98304
Smallest 125% 76x76 125x128 43x43 77 32 (77, 77) (0, 0, 4096, 1696) 78848
Smallest 150% 64x64 104x107 36x36 64 32 (64, 64) (0, 0, 3413, 1413) 65536
Smallest 200% 48x48 78x80 27x27 48 32 (48, 48) (0, 0, 2560, 1060) 49152
Smallest 300% 32x32 52x53 18x18 32 32 (32, 32) (0, 0, 1707, 707) 32768
Second smallest 100% 120x120 157x160 68x68 120 32 (120, 120) (0, 0, 5440, 2112) 122880
Second smallest 125% 96x96 125x128 54x54 96 32 (96, 96) (0, 0, 4352, 1690) 98304
Second smallest 150% 80x80 104x107 45x45 80 32 (80, 80) (0, 0, 3627, 1408) 81920
Second smallest 200% 60x60 78x80 34x34 60 32 (60, 60) (0, 0, 2720, 1056) 61440
Second smallest 300% 40x40 52x53 22x22 40 32 (40, 40) (0, 0, 1813, 704) 40960
Third smallest 100% 144x144 157x160 81x81 144 48 (144, 144) (0, 0, 5760, 2104) 147456
Third smallest 125% 115x115 125x128 65x65 115 48 (115, 115) (0, 0, 4608, 1683) 117760
Third smallest 150% 96x96 104x107 54x54 96 48 (96, 96) (0, 0, 3840, 1403) 98304
Third smallest 200% 72x72 78x80 40x40 72 48 (72, 72) (0, 0, 2880, 1052) 73728
Third smallest 300% 48x48 52x53 27x27 48 48 (48, 48) (0, 0, 1920, 701) 48152
Fourth smallest 100% 192x192 157x160 108x108 192 64 (192, 193) (0, 0, 6400, 2088) 196608
Fourth smallest 125% 153x154 125x128 87x87 154 64 (154, 154) (0, 0, 5120, 1670) 157696
Fourth smallest 150% 128x128 104x107 72x72 128 64 (128, 128) (0, 0, 4267, 1392) 131072
Fourth smallest 200% 96x96 78x80 54x54 96 64 (96, 96) (0, 0, 3200, 1044) 98304
Fourth smallest 300% 64x64 52x53 36x36 64 64 (64, 64) (0, 0, 2133, 696) 65536
Fifth smallest 100% 240x240 157x160 136x136 240 64 (240, 240) (0, 0, 7040, 2072) 245760
Fifth smallest 125% 192x192 125x128 108x108 192 64 (192, 193) (0, 0, 5632, 1658) 196608
Fifth smallest 150% 160x160 104x107 90x90 160 64 (160, 160) (0, 0, 4693, 1381) 163840
Fifth smallest 200% 120x120 78x80 68x68 120 64 (120, 120) (0, 0, 3520, 1036) 122880
Fifth smallest 300% 80x80 52x53 45x45 80 64 (80, 80) (0, 0, (2347, 691) 81920


  • Testing with XPRA_DPI_AWARENESS = 0, or 1, or 2 shows no effect on any of the above values (as of 0.16.0 r11185 win32 client and 0.16.0 r11185 fedora 21 server). (Though, with XPRA_DPI_AWARENESS=0 the client output will show SetProcessDPIAwareness not set due to environment override message.)
  • Testing with XPRA_DPI_AWARE=1 produces the same values as above as well.
  • Testing with XPRA_DPI_AWARE=0 does have different results however, as indicated below. (Client will also show a SetProcessDPIAware not set due to environment override message.)

Namely - rather than the detected workarea remaining constant, and the DPI scaling (100% to 125%, 150%, etc.); with XPRA_DPI_AWARE=0 the DPI values remain constant (with DPI 96 at 100% dektop-scaling, 76 at 125%, etc.), while the workareas detected are instead scaled (based on values as indicated in the above NativeGUI_info.exe detected & adjusted for tray size) - i.e. the 4K monitor at the "Second smallest" text size (125%), rather than adjusting the DPI from 96 to 120, adjusts the workarea from [(0, 0, 3840, 2112)] to [(0, 0, 3072, 1690)] by dividing the values by the scaling factor of 125%.


With a 3820x2160 Display (Dell P2815Q)


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% 96x96 125x128 96 32 (96, 96) 30 (0, 0, 3072, 1690) 98304
Second Smallest 125% 76x76 100x102 77 32 (77, 77) 50 (0, 0, 2458, 1352) 78848
Second Smallest 150% 64x64 83x85 64 32 (64, 64) 60 (0, 0, 2048, 1127) 65536
Second Smallest 200% 48x48 62x64 48 32 (48, 48) 20 (0, 0, 1536, 845) 49152
Second Smallest 300% 32x32 41x42 32 32 (32, 32) 25 (0, 0, 1024, 563) 32768
Third Smallest 100% 96x96 104x107 96 32 (96, 96) 10 (0, 0, 2560, 1403) 98304
Third Smallest 125% 76x76 83x85 77 32 (77, 77) 60 (0, 0, 2048, 1122) 78848
Third Smallest 150% 64x64 69x71 64 32 (64, 64) 10 (0, 0, 1707, 935) 65536
Third Smallest 200% 48x48 52x53 48 32 (48, 48) 50 (0, 0, 1280, 702) 49152
Third Smallest 300% 32x32 34x35 32 32 (32, 32) 25 (0, 0, 853, 468) 32768
Fourth Smallest 100% 96x96 78x80 96 32 (96, 96) 10 (0, 0, 1920, 1044) 98304
Fourth Smallest 125% 76x77 62x64 77 32 (77, 77) 20 (0, 0, 1536, 835) 78848
Fourth Smallest 150% 64x64 52x53 64 32 (64, 64) 50 (0, 0, 1280, 696) 65536
Fourth Smallest 200% 48x48 39x40 48 32 (48, 48) 25 (0, 0, 960, 522) 49152
Fourth Smallest 300% 32x32 26x26 32 32 (32, 32) 85 (0, 0, 640, 348) 32768
Fifth Smallest 100% 96x96 62x64 96 32 (96, 96) 20 (0, 0, 1536, 829) 98304
Fifth Smallest 125% 76x76 50x51 77 32 (77, 77) 50 (0, 0, 1229, 663) 78848
Fifth Smallest 150% 64x64 41x42 64 32 (64, 64) 25 (0, 0, 1024, 553) 65536
Fifth Smallest 200% 48x48 31x32 48 32 (48, 48) 25 (0, 0, 768, 415) 49152
Fifth Smallest 300% 32x32 20x21 32 32 (32, 32) 87 (0, 0, 512, 212) 32768


With a 2560x1440 Display (HP ZR2740w IPS)


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% 96x96 87x87 96 32 (96, 96) 60 (0, 0, 2048, 1114) 98304
Second Smallest 125% 76x77 69x69 77 32 (77, 77) 10 (0, 0, 1638, 891) 78848
Second Smallest 150% 64x64 58x58 64 32 (64, 64) 60 (0, 0, 1365, 743) 65536
Second Smallest 200% 48x48 43x43 48 32 (48, 48) 25 (0, 0, 1024, 557) 49152
Second Smallest 300% 32x32 29x29 32 32 (32, 32) 85 (0, 0, 683, 371) 32768
Third Smallest 100% 96x96 72x72 96 32 (96, 96) 10 (0, 0, 1707, 923) 98304
Third Smallest 125% 76x76 58x58 77 32 (77, 77) 60 (0, 0, 1366, 738) 78848
Third Smallest 150% 64x64 48x48 64 32 (64, 64) 25 (0, 0, 1138, 615) 65536
Third Smallest 200% 48x48 36x36 48 32 (48, 48) 25 (0, 0, 854, 462) 49152
Third Smallest 300% 32x32 24x24 32 32 (32, 32) 85 (0, 0, 569, 308) 32768
Fourth Smallest 100% 96x96 54x54 96 32 (96, 96) 50 (0, 0, 1280, 684) 98304
Fourth Smallest 125% 76x77 43x43 77 32 (77, 77) 25 (0, 0, 1024, 547) 78848
Fourth Smallest 150% 64x64 36x36 64 32 (64, 64) 25 (0, 0, 853, 456) 65536
Fourth Smallest 200% 48x48 27x27 48 32 (48, 48) 85 (0, 0, 640, 342) 49152
Fourth Smallest 300% 32x32 18x18 32 32 (32, 32) 87 (0, 0, 427, 228) 32768