Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kde-gtk-config5 for openSUSE:Factory 
checked in at 2023-04-05 21:26:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kde-gtk-config5 (Old)
 and      /work/SRC/openSUSE:Factory/.kde-gtk-config5.new.19717 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kde-gtk-config5"

Wed Apr  5 21:26:20 2023 rev:150 rq:1077268 version:5.27.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/kde-gtk-config5/kde-gtk-config5.changes  
2023-03-17 17:01:25.392787855 +0100
+++ 
/work/SRC/openSUSE:Factory/.kde-gtk-config5.new.19717/kde-gtk-config5.changes   
    2023-04-05 21:34:06.126036644 +0200
@@ -1,0 +2,13 @@
+Tue Apr  4 15:05:34 UTC 2023 - Fabian Vogt <[email protected]>
+
+- Update to 5.27.4
+  * New bugfix release
+  * For more details please see:
+  * https://kde.org/announcements/plasma/5/5.27.4
+- Changes since 5.27.3:
+  * kded: provide `org.gtk.Settings` when `GTK_USE_PORTAL` is not set on 
Wayland (kde#421745)
+  * gtkconfig: set `color-scheme` when current color scheme changes
+  * gsettings: check param exists before setting value
+  * Beside monitor scaling factors, a user may specify a preferred text DPI 
size from the system configuration utility (KCM fonts) That setting is stored 
inside the kcmfonts configuration file; one entry is kept for Plasma/X11 
sessions, "forceFontDPI", and another for Plasma/Wayland sessions, 
"forceFontDPIWayland". (kde#466463,kde#461106)
+
+-------------------------------------------------------------------

Old:
----
  kde-gtk-config-5.27.3.tar.xz
  kde-gtk-config-5.27.3.tar.xz.sig

New:
----
  kde-gtk-config-5.27.4.tar.xz
  kde-gtk-config-5.27.4.tar.xz.sig

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ kde-gtk-config5.spec ++++++
--- /var/tmp/diff_new_pack.lTCAeO/_old  2023-04-05 21:34:06.862040845 +0200
+++ /var/tmp/diff_new_pack.lTCAeO/_new  2023-04-05 21:34:06.870040891 +0200
@@ -18,7 +18,7 @@
 
 %bcond_without released
 Name:           kde-gtk-config5
-Version:        5.27.3
+Version:        5.27.4
 Release:        0
 Summary:        Daemon for GTK2 and GTK3 Applications Appearance Under KDE
 License:        GPL-3.0-or-later AND LGPL-3.0-or-later

++++++ kde-gtk-config-5.27.3.tar.xz -> kde-gtk-config-5.27.4.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kde-gtk-config-5.27.3/.reuse/dep5 
new/kde-gtk-config-5.27.4/.reuse/dep5
--- old/kde-gtk-config-5.27.3/.reuse/dep5       1970-01-01 01:00:00.000000000 
+0100
+++ new/kde-gtk-config-5.27.4/.reuse/dep5       2023-04-04 12:36:40.000000000 
+0200
@@ -0,0 +1,9 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: kde-gtk-config
+Upstream-Contact: KDE <[email protected]>
+Source: https://invent.kde.org/plasma/kde-gtk-config/
+
+Files: gsd-xsettings-manager/org.gtk.Settings.xml
+Copyright: 2018 Bastien Nocera <[email protected]>
+License: GPL-2.0-or-later
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kde-gtk-config-5.27.3/CMakeLists.txt 
new/kde-gtk-config-5.27.4/CMakeLists.txt
--- old/kde-gtk-config-5.27.3/CMakeLists.txt    2023-03-14 13:22:31.000000000 
+0100
+++ new/kde-gtk-config-5.27.4/CMakeLists.txt    2023-04-04 12:36:40.000000000 
+0200
@@ -1,5 +1,5 @@
 project(kde-gtk-config)
-set(PROJECT_VERSION "5.27.3")
+set(PROJECT_VERSION "5.27.4")
 cmake_minimum_required(VERSION 3.16)
 
 set(QT_MIN_VERSION "5.15.2")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kde-gtk-config-5.27.3/kded/CMakeLists.txt 
new/kde-gtk-config-5.27.4/kded/CMakeLists.txt
--- old/kde-gtk-config-5.27.3/kded/CMakeLists.txt       2023-03-14 
13:22:31.000000000 +0100
+++ new/kde-gtk-config-5.27.4/kded/CMakeLists.txt       2023-04-04 
12:36:40.000000000 +0200
@@ -3,13 +3,26 @@
 
 add_library(gtkconfig MODULE)
 
-target_sources(gtkconfig 
-  PRIVATE
+set(gtkconfig_SRCS
     gtkconfig.cpp
+    gsd-xsettings-manager/gsd-xsettings-manager.cpp
     configvalueprovider.cpp
     themepreviewer.cpp
 )
 
+qt_add_dbus_adaptor(gtkconfig_SRCS
+    gsd-xsettings-manager/org.gtk.Settings.xml
+    gsd-xsettings-manager/gsd-xsettings-manager.h
+    GSDXSettingsManager
+    gsd_xsettings_manager_adaptor
+    GSDXSettingsManagerAdaptor
+)
+
+target_sources(gtkconfig
+  PRIVATE
+    ${gtkconfig_SRCS}
+)
+
 add_subdirectory(config_editor)
 
 target_compile_definitions(gtkconfig
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kde-gtk-config-5.27.3/kded/config_editor/gsettings.cpp 
new/kde-gtk-config-5.27.4/kded/config_editor/gsettings.cpp
--- old/kde-gtk-config-5.27.3/kded/config_editor/gsettings.cpp  2023-03-14 
13:22:31.000000000 +0100
+++ new/kde-gtk-config-5.27.4/kded/config_editor/gsettings.cpp  2023-04-04 
12:36:40.000000000 +0200
@@ -7,8 +7,21 @@
 
 namespace GSettingsEditor
 {
+bool checkParamExists(const QString &paramName, const QString &category)
+{
+    GSettingsSchemaSource *gSettingsSchemaSource = 
g_settings_schema_source_get_default();
+    g_autoptr(GSettingsSchema) gSettingsSchema = 
g_settings_schema_source_lookup(gSettingsSchemaSource, 
category.toUtf8().constData(), true);
+
+    return gSettingsSchema && g_settings_schema_has_key(gSettingsSchema, 
paramName.toUtf8().constData());
+}
+
 void setValue(const QString &paramName, const QVariant &paramValue, const 
QString &category)
 {
+    if (!checkParamExists(paramName, category)) {
+        Q_ASSERT_X(false, "gsettings", QLatin1String("%1 doesn't exist in 
%2").arg(paramName, category).toLatin1().constData());
+        return;
+    }
+
     g_autoptr(GSettings) gsettings = 
g_settings_new(category.toUtf8().constData());
 
     if (paramValue.type() == QVariant::Type::String) {
@@ -17,6 +30,8 @@
         g_settings_set_int(gsettings, paramName.toUtf8().constData(), 
paramValue.toInt());
     } else if (paramValue.type() == QVariant::Type::Bool) {
         g_settings_set_boolean(gsettings, paramName.toUtf8().constData(), 
paramValue.toBool());
+    } else if (paramValue.type() == QVariant::Type::Double) {
+        g_settings_set_double(gsettings, paramName.toUtf8().constData(), 
paramValue.toDouble());
     }
 
     g_settings_sync();
@@ -24,6 +39,11 @@
 
 void setValueAsEnum(const QString &paramName, int paramValue, const QString 
&category)
 {
+    if (!checkParamExists(paramName, category)) {
+        Q_ASSERT_X(false, "gsettings", QLatin1String("%1 doesn't exist in 
%2").arg(paramName, category).toLatin1().constData());
+        return;
+    }
+
     g_autoptr(GSettings) gsettings = 
g_settings_new(category.toUtf8().constData());
     g_settings_set_enum(gsettings, paramName.toUtf8().constData(), paramValue);
     g_settings_sync();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kde-gtk-config-5.27.3/kded/config_editor/xsettings.cpp 
new/kde-gtk-config-5.27.4/kded/config_editor/xsettings.cpp
--- old/kde-gtk-config-5.27.3/kded/config_editor/xsettings.cpp  2023-03-14 
13:22:31.000000000 +0100
+++ new/kde-gtk-config-5.27.4/kded/config_editor/xsettings.cpp  2023-04-04 
12:36:40.000000000 +0200
@@ -32,7 +32,10 @@
         newConfigString = QStringLiteral("%1 %2\n").arg(paramName, 
paramValue.toString());
     }
 
-    if (xSettingsdContents.contains(regExp)) {
+    if (paramValue.isNull()) {
+        // unset value
+        xSettingsdContents.replace(regExp, QString());
+    } else if (xSettingsdContents.contains(regExp)) {
         xSettingsdContents.replace(regExp, newConfigString);
     } else {
         xSettingsdContents = newConfigString + xSettingsdContents;
@@ -85,4 +88,9 @@
     xSettingsdConfig.write(xSettingsdConfigContents.toUtf8());
     reloadXSettingsd();
 }
+
+void unsetValue(const QString &paramName)
+{
+    setValue(paramName, QVariant());
+}
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kde-gtk-config-5.27.3/kded/config_editor/xsettings.h 
new/kde-gtk-config-5.27.4/kded/config_editor/xsettings.h
--- old/kde-gtk-config-5.27.3/kded/config_editor/xsettings.h    2023-03-14 
13:22:31.000000000 +0100
+++ new/kde-gtk-config-5.27.4/kded/config_editor/xsettings.h    2023-04-04 
12:36:40.000000000 +0200
@@ -9,4 +9,5 @@
 namespace XSettingsEditor
 {
 void setValue(const QString &paramName, const QVariant &paramValue);
+void unsetValue(const QString &paramName);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kde-gtk-config-5.27.3/kded/configvalueprovider.cpp 
new/kde-gtk-config-5.27.4/kded/configvalueprovider.cpp
--- old/kde-gtk-config-5.27.3/kded/configvalueprovider.cpp      2023-03-14 
13:22:31.000000000 +0100
+++ new/kde-gtk-config-5.27.4/kded/configvalueprovider.cpp      2023-04-04 
12:36:40.000000000 +0200
@@ -27,8 +27,13 @@
 
 constexpr int MAX_GDK_SCALE = 5;
 
+constexpr int DEFAULT_DPI = 96;
+constexpr int MIN_FONT_DPI = DEFAULT_DPI / 2;
+constexpr int MAX_FONT_DPI = DEFAULT_DPI * 5;
+
 ConfigValueProvider::ConfigValueProvider()
     : kdeglobalsConfig(KSharedConfig::openConfig())
+    , fontsConfig(KSharedConfig::openConfig(QStringLiteral("kcmfonts")))
     , inputConfig(KSharedConfig::openConfig(QStringLiteral("kcminputrc")))
     , kwinConfig(KSharedConfig::openConfig(QStringLiteral("kwinrc")))
     , generatedCSDTempPath(QDir::tempPath() + 
QStringLiteral("/plasma-csd-generator"))
@@ -476,6 +481,24 @@
     return std::clamp(scaleFactor, 1.0, double(MAX_GDK_SCALE));
 }
 
+int ConfigValueProvider::fontDpi() const
+{
+    KConfigGroup configGroup = fontsConfig->group(QStringLiteral("General"));
+    int fontDpi = 0;
+
+    if (KWindowSystem::isPlatformX11()) {
+        fontDpi = configGroup.readEntry(QStringLiteral("forceFontDPI"), 0);
+    } else {
+        fontDpi = configGroup.readEntry(QStringLiteral("forceFontDPIWayland"), 
0);
+    }
+
+    if (fontDpi <= 0) {
+        return 0;
+    }
+
+    return std::clamp(fontDpi, MIN_FONT_DPI, MAX_FONT_DPI);
+}
+
 QString ConfigValueProvider::windowDecorationButtonsOrderInGtkNotation(const 
QString &kdeConfigValue) const
 {
     QString gtkNotation;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kde-gtk-config-5.27.3/kded/configvalueprovider.h 
new/kde-gtk-config-5.27.4/kded/configvalueprovider.h
--- old/kde-gtk-config-5.27.3/kded/configvalueprovider.h        2023-03-14 
13:22:31.000000000 +0100
+++ new/kde-gtk-config-5.27.4/kded/configvalueprovider.h        2023-04-04 
12:36:40.000000000 +0200
@@ -40,12 +40,17 @@
     // is disabled.
     double x11GlobalScaleFactor() const;
 
+    // The Force Font DPI setting from the fonts kcm. Returns 0
+    // if disabled
+    int fontDpi() const;
+
 private:
     QString fontStyleHelper(const QFont &font) const;
     QString windowDecorationButtonsOrderInGtkNotation(const QString 
&kdeConfigValue) const;
     QString currentWindowDecorationPluginPath() const;
 
     KSharedConfigPtr kdeglobalsConfig;
+    KSharedConfigPtr fontsConfig;
     KSharedConfigPtr inputConfig;
     KSharedConfigPtr kwinConfig;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kde-gtk-config-5.27.3/kded/gsd-xsettings-manager/gsd-xsettings-manager.cpp 
new/kde-gtk-config-5.27.4/kded/gsd-xsettings-manager/gsd-xsettings-manager.cpp
--- 
old/kde-gtk-config-5.27.3/kded/gsd-xsettings-manager/gsd-xsettings-manager.cpp  
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/kde-gtk-config-5.27.4/kded/gsd-xsettings-manager/gsd-xsettings-manager.cpp  
    2023-04-04 12:36:40.000000000 +0200
@@ -0,0 +1,76 @@
+/*
+    SPDX-FileCopyrightText: 2023 Fushan Wen <[email protected]>
+
+    SPDX-License-Identifier: GPL-2.0-or-later
+*/
+
+#include "gsd-xsettings-manager.h"
+
+#include <QDBusConnection>
+#include <QDateTime>
+
+#include "config_editor/settings_ini.h"
+#include "gsd_xsettings_manager_adaptor.h"
+
+namespace
+{
+static constexpr const char *GTK_SETTINGS_DBUS_PATH = "/org/gtk/Settings";
+static constexpr const char *GTK_SETTINGS_DBUS_NAME = "org.gtk.Settings";
+}
+
+GSDXSettingsManager::GSDXSettingsManager(QObject *parent)
+    : QObject(parent)
+{
+    new GSDXSettingsManagerAdaptor(this);
+
+    QDBusConnection dbus = QDBusConnection::sessionBus();
+    dbus.registerObject(QString::fromLatin1(GTK_SETTINGS_DBUS_PATH), this);
+    dbus.registerService(QString::fromLatin1(GTK_SETTINGS_DBUS_NAME));
+}
+
+GSDXSettingsManager::~GSDXSettingsManager()
+{
+}
+
+void GSDXSettingsManager::modulesChanged()
+{
+    QDBusMessage msg = 
QDBusMessage::createSignal(QString::fromLatin1(GTK_SETTINGS_DBUS_PATH),
+                                                  
QStringLiteral("org.freedesktop.DBus.Properties"),
+                                                  
QStringLiteral("PropertiesChanged"));
+    QVariantList args{
+        QString::fromLatin1(GTK_SETTINGS_DBUS_NAME),
+        QVariantMap{{QStringLiteral("Modules"), Modules()}},
+        QStringList(),
+    };
+    msg.setArguments(args);
+    QDBusConnection::sessionBus().send(msg);
+}
+
+void GSDXSettingsManager::enableAnimationsChanged()
+{
+    QDBusMessage msg = 
QDBusMessage::createSignal(QString::fromLatin1(GTK_SETTINGS_DBUS_PATH),
+                                                  
QStringLiteral("org.freedesktop.DBus.Properties"),
+                                                  
QStringLiteral("PropertiesChanged"));
+    QVariantList args{
+        QString::fromLatin1(GTK_SETTINGS_DBUS_NAME),
+        QVariantMap{{QStringLiteral("EnableAnimations"), EnableAnimations()}},
+        QStringList(),
+    };
+    msg.setArguments(args);
+    QDBusConnection::sessionBus().send(msg);
+}
+
+qlonglong GSDXSettingsManager::FontconfigTimestamp() const
+{
+    return QDateTime::currentSecsSinceEpoch();
+}
+
+QString GSDXSettingsManager::Modules() const
+{
+    return SettingsIniEditor::value(QStringLiteral("gtk-modules"), 3);
+}
+
+bool GSDXSettingsManager::EnableAnimations() const
+{
+    return SettingsIniEditor::value(QStringLiteral("gtk-enable-animations"), 
3) == QLatin1String("true");
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kde-gtk-config-5.27.3/kded/gsd-xsettings-manager/gsd-xsettings-manager.h 
new/kde-gtk-config-5.27.4/kded/gsd-xsettings-manager/gsd-xsettings-manager.h
--- 
old/kde-gtk-config-5.27.3/kded/gsd-xsettings-manager/gsd-xsettings-manager.h    
    1970-01-01 01:00:00.000000000 +0100
+++ 
new/kde-gtk-config-5.27.4/kded/gsd-xsettings-manager/gsd-xsettings-manager.h    
    2023-04-04 12:36:40.000000000 +0200
@@ -0,0 +1,32 @@
+/*
+    SPDX-FileCopyrightText: 2023 Fushan Wen <[email protected]>
+
+    SPDX-License-Identifier: GPL-2.0-or-later
+*/
+
+#pragma once
+
+#include <QObject>
+
+class GSDXSettingsManager : public QObject
+{
+    Q_OBJECT
+    Q_CLASSINFO("D-Bus Interface", "org.gtk.Settings")
+
+    Q_PROPERTY(qlonglong FontconfigTimestamp READ FontconfigTimestamp)
+    Q_PROPERTY(QString Modules READ Modules)
+    Q_PROPERTY(bool EnableAnimations READ EnableAnimations)
+
+public:
+    explicit GSDXSettingsManager(QObject *parent);
+    ~GSDXSettingsManager() override;
+
+public:
+    void modulesChanged();
+    void enableAnimationsChanged();
+
+private:
+    qlonglong FontconfigTimestamp() const;
+    QString Modules() const;
+    bool EnableAnimations() const;
+};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/kde-gtk-config-5.27.3/kded/gsd-xsettings-manager/org.gtk.Settings.xml 
new/kde-gtk-config-5.27.4/kded/gsd-xsettings-manager/org.gtk.Settings.xml
--- old/kde-gtk-config-5.27.3/kded/gsd-xsettings-manager/org.gtk.Settings.xml   
1970-01-01 01:00:00.000000000 +0100
+++ new/kde-gtk-config-5.27.4/kded/gsd-xsettings-manager/org.gtk.Settings.xml   
2023-04-04 12:36:40.000000000 +0200
@@ -0,0 +1,7 @@
+<node name='/org/gtk/Settings'>
+    <interface name='org.gtk.Settings'>
+        <property name='FontconfigTimestamp' type='x' access='read'/>
+        <property name='Modules' type='s' access='read'/>
+        <property name='EnableAnimations' type='b' access='read'/>
+    </interface>
+</node>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kde-gtk-config-5.27.3/kded/gtkconfig.cpp 
new/kde-gtk-config-5.27.4/kded/gtkconfig.cpp
--- old/kde-gtk-config-5.27.3/kded/gtkconfig.cpp        2023-03-14 
13:22:31.000000000 +0100
+++ new/kde-gtk-config-5.27.4/kded/gtkconfig.cpp        2023-04-04 
12:36:40.000000000 +0200
@@ -9,6 +9,7 @@
 
 #include <KColorScheme>
 #include <KPluginFactory>
+#include <KWindowSystem>
 
 #include <QDBusConnection>
 #include <QDBusMessage>
@@ -23,6 +24,7 @@
 #include "config_editor/gtk2.h"
 #include "config_editor/settings_ini.h"
 #include "config_editor/xsettings.h"
+#include "gsd-xsettings-manager/gsd-xsettings-manager.h"
 
 K_PLUGIN_CLASS_WITH_JSON(GtkConfig, "gtkconfig.json")
 
@@ -32,6 +34,7 @@
     , themePreviewer(new ThemePreviewer(this))
     , 
kdeglobalsConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig()))
     , 
kwinConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("kwinrc"))))
+    , 
kcmfontsConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("kcmfonts"))))
     , 
kcminputConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("kcminputrc"))))
     , 
breezeConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("breezerc"))))
 {
@@ -39,8 +42,13 @@
     dbus.registerService(QStringLiteral("org.kde.GtkConfig"));
     dbus.registerObject(QStringLiteral("/GtkConfig"), this, 
QDBusConnection::ExportScriptableSlots);
 
+    if (qgetenv("GTK_USE_PORTAL") != "1" && 
KWindowSystem::isPlatformWayland()) {
+        m_gsdXsettingsManager = new GSDXSettingsManager(this);
+    }
+
     connect(kdeglobalsConfigWatcher.data(), &KConfigWatcher::configChanged, 
this, &GtkConfig::onKdeglobalsSettingsChange);
     connect(kwinConfigWatcher.data(), &KConfigWatcher::configChanged, this, 
&GtkConfig::onKWinSettingsChange);
+    connect(kcmfontsConfigWatcher.data(), &KConfigWatcher::configChanged, 
this, &GtkConfig::onKCMFontsSettingsChange);
     connect(kcminputConfigWatcher.data(), &KConfigWatcher::configChanged, 
this, &GtkConfig::onKCMInputSettingsChange);
     connect(breezeConfigWatcher.data(), &KConfigWatcher::configChanged, this, 
&GtkConfig::onBreezeSettingsChange);
 
@@ -152,6 +160,10 @@
 {
     const bool preferDarkTheme = configValueProvider->preferDarkTheme();
     
SettingsIniEditor::setValue(QStringLiteral("gtk-application-prefer-dark-theme"),
 preferDarkTheme);
+    // 
https://gitlab.gnome.org/GNOME/gsettings-desktop-schemas/-/blob/master/headers/gdesktop-enums.h
+    GSettingsEditor::setValueAsEnum(QStringLiteral("color-scheme"),
+                                    preferDarkTheme ? 1 
/*G_DESKTOP_COLOR_SCHEME_PREFER_DARK*/ : 0 /*G_DESKTOP_COLOR_SCHEME_DEFAULT*/,
+                                    
QStringLiteral("org.gnome.desktop.interface"));
 }
 
 void GtkConfig::setWindowDecorationsAppearance() const
@@ -179,6 +191,9 @@
     GSettingsEditor::setValue(QStringLiteral("enable-animations"), 
enableAnimations);
     SettingsIniEditor::setValue(QStringLiteral("gtk-enable-animations"), 
enableAnimations);
     XSettingsEditor::setValue(QStringLiteral("Gtk/EnableAnimations"), 
enableAnimations);
+    if (m_gsdXsettingsManager) {
+        m_gsdXsettingsManager->enableAnimationsChanged();
+    }
 }
 
 void GtkConfig::setGlobalScale() const
@@ -189,24 +204,40 @@
 
 void GtkConfig::setTextScale() const
 {
-    constexpr int baseTextDpi = 96 * 1024;
-    const double scaleFactor = configValueProvider->x11GlobalScaleFactor();
-    const double fractionalPart = std::fmod(scaleFactor, 1.0);
-    const double integerPart = std::max(scaleFactor - fractionalPart, 1.0);
-    const int textScaleAbsolute = baseTextDpi * scaleFactor;
-    const int textScaleRelative = baseTextDpi * (1.0 + fractionalPart / 
integerPart);
-
-    SettingsIniEditor::setValue(QStringLiteral("gtk-xft-dpi"), 
textScaleAbsolute);
-    // GTK2
-    XSettingsEditor::setValue(QStringLiteral("Xft/DPI"), textScaleAbsolute);
-    // GTK3 and newer
-    XSettingsEditor::setValue(QStringLiteral("Gdk/UnscaledDPI"), 
textScaleRelative);
+    const double x11Scale = configValueProvider->x11GlobalScaleFactor();
+    const int x11ScaleIntegerPart = int(x11Scale);
+
+    const int forceFontDpi = configValueProvider->fontDpi();
+
+    int x11TextDpiAbsolute = 96 * 1024;
+    double waylandTextScaleFactor = 1.0;
+
+    if (forceFontDpi == 0) {
+        x11TextDpiAbsolute = (96 * 1024) * x11Scale;
+    } else {
+        x11TextDpiAbsolute = (forceFontDpi * 1024);
+
+        if (!KWindowSystem::isPlatformX11()) {
+            x11TextDpiAbsolute *= x11Scale;
+        }
+
+        waylandTextScaleFactor = double(forceFontDpi) / 96.0;
+        waylandTextScaleFactor = std::clamp(waylandTextScaleFactor, 0.5, 3.0);
+    }
+
+    XSettingsEditor::unsetValue(QStringLiteral("Xft/DPI"));
+    SettingsIniEditor::setValue(QStringLiteral("gtk-xft-dpi"), 
x11TextDpiAbsolute);
+    XSettingsEditor::setValue(QStringLiteral("Gdk/UnscaledDPI"), 
x11TextDpiAbsolute / x11ScaleIntegerPart);
+    GSettingsEditor::setValue(QStringLiteral("text-scaling-factor"), 
waylandTextScaleFactor);
 }
 
 void GtkConfig::setColors() const
 {
     const QMap<QString, QColor> colors = configValueProvider->colors();
     CustomCssEditor::setColors(colors);
+    if (m_gsdXsettingsManager) {
+        m_gsdXsettingsManager->modulesChanged();
+    }
 }
 
 void GtkConfig::applyAllSettings() const
@@ -284,6 +315,15 @@
             setTextScale();
         }
     }
+}
+
+void GtkConfig::onKCMFontsSettingsChange(const KConfigGroup &group, const 
QByteArrayList &names) const
+{
+    if (group.name() == QStringLiteral("General")) {
+        if (names.contains("forceFontDPI") || 
names.contains("forceFontDPIWayland")) {
+            setTextScale();
+        }
+    }
 }
 
 void GtkConfig::onKCMInputSettingsChange(const KConfigGroup &group, const 
QByteArrayList &names) const
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kde-gtk-config-5.27.3/kded/gtkconfig.h 
new/kde-gtk-config-5.27.4/kded/gtkconfig.h
--- old/kde-gtk-config-5.27.3/kded/gtkconfig.h  2023-03-14 13:22:31.000000000 
+0100
+++ new/kde-gtk-config-5.27.4/kded/gtkconfig.h  2023-04-04 12:36:40.000000000 
+0200
@@ -13,6 +13,8 @@
 #include "configvalueprovider.h"
 #include "themepreviewer.h"
 
+class GSDXSettingsManager;
+
 class Q_DECL_EXPORT GtkConfig : public KDEDModule
 {
     Q_OBJECT
@@ -47,6 +49,7 @@
 
     void onKdeglobalsSettingsChange(const KConfigGroup &group, const 
QByteArrayList &names) const;
     void onKWinSettingsChange(const KConfigGroup &group, const QByteArrayList 
&names) const;
+    void onKCMFontsSettingsChange(const KConfigGroup &group, const 
QByteArrayList &names) const;
     void onKCMInputSettingsChange(const KConfigGroup &group, const 
QByteArrayList &names) const;
     void onBreezeSettingsChange(const KConfigGroup &group, const 
QByteArrayList &names) const;
 
@@ -55,6 +58,9 @@
     QScopedPointer<ThemePreviewer> themePreviewer;
     KConfigWatcher::Ptr kdeglobalsConfigWatcher;
     KConfigWatcher::Ptr kwinConfigWatcher;
+    KConfigWatcher::Ptr kcmfontsConfigWatcher;
     KConfigWatcher::Ptr kcminputConfigWatcher;
     KConfigWatcher::Ptr breezeConfigWatcher;
+
+    GSDXSettingsManager *m_gsdXsettingsManager = nullptr;
 };

Reply via email to