Warning, file /plasma/plasma-workspace/kcms/fonts/fontinit.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     This file is part of the KDE project.
0003 
0004     SPDX-FileCopyrightText: 2021 David Edmundson <davidedmundson@kde.org>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #include "krdb.h"
0010 #include <KConfig>
0011 #include <KConfigGroup>
0012 #include <KWindowSystem>
0013 #include <QProcess>
0014 
0015 extern "C" {
0016 Q_DECL_EXPORT void kcminit()
0017 {
0018     KConfig cfg(QStringLiteral("kcmfonts"));
0019     KConfigGroup fontsCfg(&cfg, "General");
0020 
0021     const int dpi = xftDpi();
0022     if (dpi <= 0) {
0023         return;
0024     }
0025 
0026     const QByteArray input = "Xft.dpi: " + QByteArray::number(dpi);
0027     QProcess p;
0028     p.start(QStringLiteral("xrdb"), {QStringLiteral("-quiet"), QStringLiteral("-merge"), QStringLiteral("-nocpp")});
0029     p.setProcessChannelMode(QProcess::ForwardedChannels);
0030     p.write(input);
0031     p.closeWriteChannel();
0032     p.waitForFinished(-1);
0033 }
0034 }