diff --git a/src/main.cpp b/src/main.cpp index 349eb675e5..8cf50dc52c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -384,22 +384,27 @@ void Application::setXwaylandScale(qreal scale) Q_ASSERT(scale != 0); if (scale != m_xwaylandScale) { m_xwaylandScale = scale; - KConfig cfg(QStringLiteral("kdeglobals")); - KConfigGroup kscreenGroup = cfg.group("KScreen"); - const bool xwaylandClientsScale = kscreenGroup.readEntry("XwaylandClientsScale", true); - if (xwaylandClientsScale) { - kwinApp()->config()->group("Xwayland").writeEntry("Scale", m_xwaylandScale, KConfig::Notify); - } else { - kwinApp()->config()->group("Xwayland").deleteEntry("Scale", KConfig::Notify); - } - if (x11Connection()) { - // rerun the fonts kcm init that does the appropriate xrdb call with the new settings - QProcess::startDetached("kcminit", {"kcm_fonts", "kcm_style"}); - } + applyXwaylandScale(); Q_EMIT xwaylandScaleChanged(); } } +void Application::applyXwaylandScale() +{ + KConfig cfg(QStringLiteral("kdeglobals")); + KConfigGroup kscreenGroup = cfg.group("KScreen"); + const bool xwaylandClientsScale = kscreenGroup.readEntry("XwaylandClientsScale", true); + if (xwaylandClientsScale) { + kwinApp()->config()->group("Xwayland").writeEntry("Scale", m_xwaylandScale, KConfig::Notify); + } else { + kwinApp()->config()->group("Xwayland").deleteEntry("Scale", KConfig::Notify); + } + if (x11Connection()) { + // rerun the fonts kcm init that does the appropriate xrdb call with the new settings + QProcess::startDetached("kcminit", {"kcm_fonts", "kcm_style"}); + } +} + void Application::unregisterEventFilter(X11EventFilter *filter) { X11EventFilterContainer *container = nullptr; diff --git a/src/main.h b/src/main.h index 19b9998d37..abc211354c 100644 --- a/src/main.h +++ b/src/main.h @@ -360,6 +360,7 @@ protected: void destroyColorManager(); void destroyInputMethod(); void destroyPlatform(); + void applyXwaylandScale(); void setTerminating() { diff --git a/src/main_wayland.cpp b/src/main_wayland.cpp index c844a44c63..500107b802 100644 --- a/src/main_wayland.cpp +++ b/src/main_wayland.cpp @@ -166,6 +166,7 @@ void ApplicationWayland::continueStartupWithScene() m_xwayland->xwaylandLauncher()->setDisplayName(m_xwaylandDisplay); m_xwayland->xwaylandLauncher()->setXauthority(m_xwaylandXauthority); m_xwayland->init(); + connect(m_xwayland.get(), &Xwl::Xwayland::started, this, &ApplicationWayland::applyXwaylandScale); } startSession(); notifyStarted();