From 5b37ae3b28a3c816910eca2bd40f9681cbac0635 Mon Sep 17 00:00:00 2001 From: Reion Wong Date: Wed, 2 Sep 2026 08:55:11 -0400 Subject: [PATCH] refactor(settings-daemon): remove global device pixel ratio setting --- settings-daemon/theme/com.cutefish.Theme.xml | 4 -- settings-daemon/theme/thememanager.cpp | 45 +------------------- settings-daemon/theme/thememanager.h | 4 -- 3 files changed, 2 insertions(+), 51 deletions(-) diff --git a/settings-daemon/theme/com.cutefish.Theme.xml b/settings-daemon/theme/com.cutefish.Theme.xml index 770044e..a1b440b 100644 --- a/settings-daemon/theme/com.cutefish.Theme.xml +++ b/settings-daemon/theme/com.cutefish.Theme.xml @@ -22,9 +22,6 @@ - - - @@ -57,7 +54,6 @@ - diff --git a/settings-daemon/theme/thememanager.cpp b/settings-daemon/theme/thememanager.cpp index f123509..bcda670 100644 --- a/settings-daemon/theme/thememanager.cpp +++ b/settings-daemon/theme/thememanager.cpp @@ -30,7 +30,6 @@ static const QByteArray s_systemFontName = QByteArrayLiteral("Font"); static const QByteArray s_systemFixedFontName = QByteArrayLiteral("FixedFont"); static const QByteArray s_systemPointFontSize = QByteArrayLiteral("FontSize"); -static const QByteArray s_devicePixelRatio = QByteArrayLiteral("PixelRatio"); static QString gtkRc2Path() { @@ -266,45 +265,6 @@ void ThemeManager::setSystemFontPointSize(qreal fontSize) emit systemFontPointSizeChanged(); } -qreal ThemeManager::devicePixelRatio() -{ - return m_settings->value(s_devicePixelRatio, 1.0).toReal(); -} - -void ThemeManager::setDevicePixelRatio(qreal ratio) -{ - ratio = qBound(1.0, ratio, 4.0); - m_settings->setValue(s_devicePixelRatio, ratio); - m_settings->sync(); - - updateGtk3Config(); - applyCursorSettings(); - - QProcess p; - p.setProgram("pkexec"); - p.setArguments(QStringList() << "cutefish-sddm-helper" - << "--scale" << QString::number(ratio)); - p.start(); - p.waitForFinished(-1); - - QDBusInterface iface("org.freedesktop.Notifications", - "/org/freedesktop/Notifications", - "org.freedesktop.Notifications", - QDBusConnection::sessionBus()); - if (iface.isValid()) { - QList args; - args << "cutefish-settings"; - args << ((unsigned int) 0); - args << "preferences-system"; - args << ""; - args << tr("Screen scaling needs to be re-login to take effect"); - args << QStringList(); - args << QVariantMap(); - args << (int) 10; - iface.asyncCallWithArgumentList("Notify", args); - } -} - QString ThemeManager::wallpaper() { return m_wallpaperPath; @@ -360,7 +320,7 @@ void ThemeManager::updateGtk3Config() // icon theme settings.setValue("gtk-icon-theme-name", m_iconTheme); settings.setValue("gtk-cursor-theme-name", m_cursorTheme); - settings.setValue("gtk-cursor-theme-size", qRound(m_cursorSize * devicePixelRatio())); + settings.setValue("gtk-cursor-theme-size", m_cursorSize); // other settings.setValue("gtk-enable-animations", true); // theme @@ -384,8 +344,7 @@ void ThemeManager::applyCursorSettings() QSettings::IniFormat); inputSettings.beginGroup(QStringLiteral("Mouse")); inputSettings.setValue(QStringLiteral("cursorTheme"), cursorTheme()); - inputSettings.setValue(QStringLiteral("cursorSize"), - qRound(cursorSize() * devicePixelRatio())); + inputSettings.setValue(QStringLiteral("cursorSize"), cursorSize()); inputSettings.endGroup(); inputSettings.sync(); diff --git a/settings-daemon/theme/thememanager.h b/settings-daemon/theme/thememanager.h index f1d1478..5f0a352 100644 --- a/settings-daemon/theme/thememanager.h +++ b/settings-daemon/theme/thememanager.h @@ -33,7 +33,6 @@ class ThemeManager : public QObject Q_PROPERTY(QString systemFont READ systemFont WRITE setSystemFont NOTIFY systemFontChanged) Q_PROPERTY(QString systemFixedFont READ systemFixedFont WRITE setSystemFixedFont) Q_PROPERTY(qreal systemFontPointSize READ systemFontPointSize WRITE setSystemFontPointSize NOTIFY systemFontPointSizeChanged) - Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio) Q_PROPERTY(QString wallpaper READ wallpaper WRITE setWallpaper NOTIFY wallpaperChanged) Q_PROPERTY(int accentColor READ accentColor WRITE setAccentColor NOTIFY accentColorChanged) Q_PROPERTY(int backgroundType READ backgroundType WRITE setBackgroundType NOTIFY backgroundTypeChanged) @@ -67,9 +66,6 @@ public: qreal systemFontPointSize(); void setSystemFontPointSize(qreal fontSize); - qreal devicePixelRatio(); - void setDevicePixelRatio(qreal ratio); - QString wallpaper(); void setWallpaper(const QString &path);