High-DPI Ubuntu screens not detected
Original Reporter info from Mantis: crlab @neurolabusc1
-
Reporter name: Chris Rorden
Original Reporter info from Mantis: crlab @neurolabusc1
- Reporter name: Chris Rorden
Description:
It appears that with Ubuntu the scaling of text is not controlled by the DPI setting. For example, on my laptop Lazarus always reports the DPI as 96, regardless of the values set in the "Displays" control panel. This panel has a slider called "Scale for menu and title bars", which on my computer can be set from x0.5..x3.38. You can work out the intended scaling by reading
gsettings get org.gnome.desktop.interface scaling-factor
gsettings get org.gnome.desktop.interface text-scaling-factor
The scaling factor is an integer: e.g. 1, 2, 3 ...
The text-scaling-factor is a float in the range 1..1.99999
The desired scaling is the product of these values, so if the user sets the slider to "1.5" the scaling is "1" the text scaling is "1.5", while if the user selects "2.5" they are "2" and "1.25" respectively.
I am including a hack that reads this virtualDPI and scales the Lazarus program using the call
Self.AutoAdjustLayout(lapDefault, 96, virtualDPI, Self.Width,round(Self.Width * virtualDPI/96), False );
I think it would be ideal if this feature could be included into Lazarus to allow automatic Form Scaling on Ubuntu.
Steps to reproduce:
With Ubuntu, adjust "Scale for Menu and title bars" slider. Launch Lazarus application and note they always report a fixed screen DPI, while other Ubuntu Apps change their scaling.
Mantis conversion info:
- Mantis ID: 31199
- OS: Ubuntu
- OS Build: 16.10
- Build: 53894
- Platform: Lenovo Yoga 2 Pro
- Version: 1.7 (SVN)
- Fixed in revision: 55635 (#6de4e6be)
- Monitored by: » lifepower (lifepower), » @onpok (Ondrej Pokorny), » @mvancanneyt (Michael Van Canneyt)