summaryrefslogtreecommitdiffstats
path: root/kcontrol/krdb
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2021-10-04 17:04:23 +0900
committerMichele Calgaro <[email protected]>2021-10-07 10:37:30 +0900
commita1a836e148f3d58ce1e330b3d2b2dca5b151d44a (patch)
treec310123319a89ad3bba425811e722001318943b0 /kcontrol/krdb
parent619ac6d9ff32c28c1e67662ed31767cfd8d99399 (diff)
downloadtdebase-a1a836e148f3d58ce1e330b3d2b2dca5b151d44a.tar.gz
tdebase-a1a836e148f3d58ce1e330b3d2b2dca5b151d44a.zip
Added support for variable font DPI (range 64-512) in user session.
Signed-off-by: Michele Calgaro <[email protected]> (cherry picked from commit e8d86645043847265b61825c9a1f20a6b93cc924)
Diffstat (limited to 'kcontrol/krdb')
-rw-r--r--kcontrol/krdb/krdb.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/kcontrol/krdb/krdb.cpp b/kcontrol/krdb/krdb.cpp
index d01bd998e..0943a6ccc 100644
--- a/kcontrol/krdb/krdb.cpp
+++ b/kcontrol/krdb/krdb.cpp
@@ -547,8 +547,21 @@ void runRdb( uint flags )
TDEConfig cfgfonts("kcmfonts", true);
cfgfonts.setGroup("General");
- if( cfgfonts.readNumEntry( "forceFontDPI", 0 ) != 0 )
- contents += "Xft.dpi: " + cfgfonts.readEntry( "forceFontDPI" ) + '\n';
+ int dpicfg = cfgfonts.readNumEntry("forceFontDPI", 0);
+ // "forceFontDPIEnable" must be read after "forceFontDPI" to make sure it is
+ // correctly initialized on the first run when upgrading to the new format,
+ // without the user even noticying it. The first time "forceFontDPIEnable"
+ // will not exist and its correct value will be deduced by the existing value
+ // of "forceFontDPI", which contains the value prior to the update.
+ bool dpiEnable = cfgfonts.readBoolEntry("forceFontDPIEnable", dpicfg > 0);
+ if (dpicfg < 64 || dpicfg > 512)
+ {
+ dpicfg = 96;
+ }
+ if (dpiEnable)
+ {
+ contents += "Xft.dpi: " + TQString::number(dpicfg) + '\n';
+ }
}
if (contents.length() > 0)