Commit 122be66e authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

Set up session for proper Xwayland clients scaling

If KWin Wayland is set up to let Xwayland clients to scale themselves,
set the configuration values we need for them to do so properly.
To do so, we extend the fonts kcminit module to provide a meaningful
default DPI to scale to and we set some environment variables for
applications to scale as expected. These are the ones we already were
using to properly scale in X11 sessions.
parent 6ba01a55
Pipeline #191062 passed with stage
in 8 minutes and 19 seconds
......@@ -17,9 +17,18 @@ Q_DECL_EXPORT void kcminit()
KConfig cfg(QStringLiteral("kcmfonts"));
KConfigGroup fontsCfg(&cfg, "General");
QString fontDpiKey = KWindowSystem::isPlatformWayland() ? QStringLiteral("forceFontDPIWayland") : QStringLiteral("forceFontDPI");
int defaultDpi = 0;
const bool isWayland = KWindowSystem::isPlatformWayland();
const int dpi = fontsCfg.readEntry(fontDpiKey, 0);
if (isWayland) {
KConfig cfg(QStringLiteral("kwinrc"));
KConfigGroup xwaylandGroup ="Xwayland");
qreal scale = xwaylandGroup.readEntry("Scale", 1.0);
defaultDpi = scale * 96;
QString fontDpiKey = isWayland ? QStringLiteral("forceFontDPIWayland") : QStringLiteral("forceFontDPI");
const int dpi = fontsCfg.readEntry(fontDpiKey, defaultDpi);
if (dpi <= 0) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment