mate-desktop / mate-settings-daemon

MATE settings daemon
https://mate-desktop.org
GNU General Public License v2.0
43 stars 47 forks source link

Issues with QT scaling when using lower-than-native resolution in HiDPI display #241

Open DavideRossi opened 5 years ago

DavideRossi commented 5 years ago

I have a native 3200 by 1800 display that I use at 1600 by 900 (since HiDPI is getting better but still not all applications are usable). I'm having issues with QT applications because QT_SCALE_FACTOR is set to 2 by scale_change_workarounds in plugins/xsettings/msd-xsettings-manager.c even if the effective resolution is not "HiDPI" (I have to force org.mate.desktop.interface.window-scaling-factor to 1 but that breaks HiDPI support if I ever revert to native resolution). I see something has been changed between 1.20.1 and 1.21.0 so this may have been fixed already...

Expected behaviour

QT_SCALE_FACTOR be set to 1

Actual behaviour

QT_SCALE_FACTOR is set to 2

Steps to reproduce the behaviour

Set a HiDPI display to a low-dpi resolution

MATE general version

1.20.1

Package version

1.20.1.2ubuntu1

Linux Distribution

Mint

Link to downstream report of your Distribution

vkareh commented 5 years ago

@DavideRossi - there were some changes regarding the QT_SCALE_FACTOR env variable. These changes, however, only made it in after 1.20.1 was cut. The changes would allow you to control the QT variables separate from your GDK settings, so it should fix your issue.

for reference: https://github.com/mate-desktop/mate-settings-daemon/commit/0034a564167dff8d5e487c9a3842a07cef4c9ede

DavideRossi commented 5 years ago

To my understanding this does not really fix the problem: it would keep QT_SCALE_FACTOR to whatever I set it to but the point is that I'd like to have it set to 1 when I use the 1600 by 900 resolution and to 2 when I use the 3200 x 1800 resolution.

vkareh commented 5 years ago

Ah, I think I understand what you're saying. Since the QT var is an environment variable, you cannot change its value once the session is fully bootstrapped. So if, during the init phase (when the settings-daemon is starting) it sets the QT flags to 2, they'll stay that way even if you change the GTK+ flags to 1. This is a limitation of how env vars work in general, and the fact that we don't load any qt libraries, of course...

Since we are actively using GTK libs, we can change internal settings live, but not so with QT (unless we load the QT libraries or something, I guess)

ilya-fedin commented 3 years ago

Why Xft.dpi reported over Xrm has other value than Xft/DPI reported over XSETTINGS? Qt reads the first, so if they would be synchronized like in other gtk DEs, then Qt will be able to scale without QT_SCALE_FACTOR. https://github.com/mate-desktop/mate-settings-daemon/blob/202a970676f410e375422a2597558cbb3fb0e2b3/plugins/xsettings/msd-xsettings-manager.c#L663-L664 https://github.com/mate-desktop/mate-settings-daemon/blob/202a970676f410e375422a2597558cbb3fb0e2b3/plugins/xsettings/msd-xsettings-manager.c#L604 https://github.com/qt/qtbase/blob/ffa0ecdc5d507754ddd962e2edbc859c198b2700/src/plugins/platforms/xcb/qxcbscreen.cpp#L409-L411