From 1337ae5e0dbb6705d0198c6f04b0a616385f68af Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Wed, 3 Jul 2019 16:57:24 +0200 Subject: [PATCH] [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 --- startkde/startplasma-x11.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/startkde/startplasma-x11.cpp b/startkde/startplasma-x11.cpp index 44c0cfcac..3314b6283 100644 --- a/startkde/startplasma-x11.cpp +++ b/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)); } } }