Changeset View
Changeset View
Standalone View
Standalone View
kcms/krdb/krdb.cpp
Show All 38 Lines | |||||
39 | #include <klauncher_iface.h> | 39 | #include <klauncher_iface.h> | ||
40 | 40 | | |||
41 | #include <kcolorscheme.h> | 41 | #include <kcolorscheme.h> | ||
42 | #include <kconfig.h> | 42 | #include <kconfig.h> | ||
43 | #include <kconfiggroup.h> | 43 | #include <kconfiggroup.h> | ||
44 | #include <kprocess.h> | 44 | #include <kprocess.h> | ||
45 | #include <KLocalizedString> | 45 | #include <KLocalizedString> | ||
46 | #include <kdelibs4migration.h> | 46 | #include <kdelibs4migration.h> | ||
47 | #include <KWindowSystem> | ||||
47 | 48 | | |||
48 | #include "krdb.h" | 49 | #include "krdb.h" | ||
49 | #if HAVE_X11 | 50 | #if HAVE_X11 | ||
50 | #include <X11/Xlib.h> | 51 | #include <X11/Xlib.h> | ||
51 | #include <QX11Info> | 52 | #include <QX11Info> | ||
52 | #endif | 53 | #endif | ||
53 | inline const char * gtkEnvVar(int version) | 54 | inline const char * gtkEnvVar(int version) | ||
54 | { | 55 | { | ||
▲ Show 20 Lines • Show All 474 Lines • ▼ Show 20 Line(s) | 529 | { | |||
529 | QString subPixel = generalCfgGroup.readEntry("XftSubPixel"); | 530 | QString subPixel = generalCfgGroup.readEntry("XftSubPixel"); | ||
530 | if(!subPixel.isEmpty()) | 531 | if(!subPixel.isEmpty()) | ||
531 | contents += "Xft.rgba: " + subPixel + '\n'; | 532 | contents += "Xft.rgba: " + subPixel + '\n'; | ||
532 | } | 533 | } | ||
533 | 534 | | |||
534 | KConfig _cfgfonts( QStringLiteral("kcmfonts") ); | 535 | KConfig _cfgfonts( QStringLiteral("kcmfonts") ); | ||
535 | KConfigGroup cfgfonts(&_cfgfonts, "General"); | 536 | KConfigGroup cfgfonts(&_cfgfonts, "General"); | ||
536 | 537 | | |||
537 | if( cfgfonts.readEntry( "forceFontDPI", 0 ) != 0 ) | 538 | int dpi; | ||
538 | contents += "Xft.dpi: " + cfgfonts.readEntry( "forceFontDPI" ) + '\n'; | 539 | | ||
540 | //even though this sets up the X rdb, we want to use the value the | ||||
541 | //user has set to use when under wayland - as X apps will be scaled by the compositor | ||||
542 | if (KWindowSystem::isPlatformWayland()) { | ||||
543 | dpi = cfgfonts.readEntry( "forceFontDPIWayland", 0); | ||||
544 | } else { | ||||
545 | dpi = cfgfonts.readEntry( "forceFontDPI", 0); | ||||
546 | } | ||||
547 | if( dpi != 0 ) | ||||
548 | contents += "Xft.dpi: " + QString::number(dpi) + '\n'; | ||||
539 | else | 549 | else | ||
540 | { | 550 | { | ||
541 | KProcess proc; | 551 | KProcess proc; | ||
542 | proc << QStringLiteral("xrdb") << QStringLiteral("-quiet") << QStringLiteral("-remove") << QStringLiteral("-nocpp"); | 552 | proc << QStringLiteral("xrdb") << QStringLiteral("-quiet") << QStringLiteral("-remove") << QStringLiteral("-nocpp"); | ||
543 | proc.start(); | 553 | proc.start(); | ||
544 | if (proc.waitForStarted()) | 554 | if (proc.waitForStarted()) | ||
545 | { | 555 | { | ||
546 | proc.write( QByteArray( "Xft.dpi\n" ) ); | 556 | proc.write( QByteArray( "Xft.dpi\n" ) ); | ||
▲ Show 20 Lines • Show All 167 Lines • Show Last 20 Lines |