[startplamsa-x11] Fix GTK scaling

ScreenScaleFactors is a list of scales per output. We want to read the ScaleFactor number for GTK instead.
Also, floor the number so that when you use e.g. 2.5x scaling you still get some scaling out of GTK apps still.

Differential Revision: https://phabricator.kde.org/D22236
wilder-5.17
Kai Uwe Broulik 7 years ago
parent cd3e9a291a
commit 1337ae5e0d
  1. 10
      startkde/startplasma-x11.cpp

@ -70,12 +70,14 @@ int main(int /*argc*/, char** /*argv*/)
{
KConfig cfg(QStringLiteral("kdeglobals"));
const auto screenScaleFactors = cfg.group("KScreen").readEntry("ScreenScaleFactors", QByteArray());
KConfigGroup kscreenGroup = cfg.group("KScreen");
const auto screenScaleFactors = kscreenGroup.readEntry("ScreenScaleFactors", QByteArray());
if (!screenScaleFactors.isEmpty()) {
qputenv("QT_SCREEN_SCALE_FACTORS", screenScaleFactors);
if (screenScaleFactors == "2" || screenScaleFactors == "3") {
qputenv("GDK_SCALE", screenScaleFactors);
qputenv("GDK_DPI_SCALE", QByteArray::number(1./screenScaleFactors.toDouble(), 'g', 3));
qreal scaleFactor = qFloor(kscreenGroup.readEntry("ScaleFactor", 1.0));
if (scaleFactor > 1) {
qputenv("GDK_SCALE", QByteArray::number(scaleFactor, 'g', 0));
qputenv("GDK_DPI_SCALE", QByteArray::number(1.0/scaleFactor, 'g', 3));
}
}
}

Loading…
Cancel
Save