From 63c1363ca1a9077a804975ab3670c68aa233e0b6 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 5 Feb 2024 12:48:07 +0200 Subject: [PATCH] Fix syncing Xwayland::Scale config option The new scale value is written but it's not flushed to the disk so when kcm_fonts_init and kcm_style_init run, they use the old scale value. CCBUG: 480792 --- src/main.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 23609a0f8b..e4eda7a4fa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -391,14 +391,18 @@ void Application::setXwaylandScale(qreal scale) void Application::applyXwaylandScale() { - KConfig cfg(QStringLiteral("kdeglobals")); - KConfigGroup kscreenGroup = cfg.group(QStringLiteral("KScreen")); - const bool xwaylandClientsScale = kscreenGroup.readEntry("XwaylandClientsScale", true); + const bool xwaylandClientsScale = KConfig(QStringLiteral("kdeglobals")) + .group(QStringLiteral("KScreen")) + .readEntry("XwaylandClientsScale", true); + + KConfigGroup xwaylandGroup = kwinApp()->config()->group(QStringLiteral("Xwayland")); if (xwaylandClientsScale) { - kwinApp()->config()->group(QStringLiteral("Xwayland")).writeEntry("Scale", m_xwaylandScale, KConfig::Notify); + xwaylandGroup.writeEntry("Scale", m_xwaylandScale, KConfig::Notify); } else { - kwinApp()->config()->group(QStringLiteral("Xwayland")).deleteEntry("Scale", KConfig::Notify); + xwaylandGroup.deleteEntry("Scale", KConfig::Notify); } + xwaylandGroup.sync(); + if (x11Connection()) { // rerun the fonts kcm init that does the appropriate xrdb call with the new settings QProcess::startDetached("kcminit", {"kcm_fonts_init", "kcm_style_init"});