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
This commit is contained in:
Vlad Zahorodnii 2024-02-05 12:48:07 +02:00
parent 41aeecbb2a
commit 63c1363ca1

View file

@ -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"});