diff --git a/src/plugin-qt/xsettings/impl/xsettingsmanager.cpp b/src/plugin-qt/xsettings/impl/xsettingsmanager.cpp index 86349e10..65f61b79 100644 --- a/src/plugin-qt/xsettings/impl/xsettingsmanager.cpp +++ b/src/plugin-qt/xsettings/impl/xsettingsmanager.cpp @@ -206,13 +206,18 @@ void XSettingsManager::setString(const QString &prop, const QString &v) void XSettingsManager::handleDConfigChangedCb(const QString &key) { - static const QStringList excludedkeys = { "xft-dpi", "scale-factor", "gtk-cursor-theme-size", "window-scale" }; + static const QStringList excludedkeys = { "xft-dpi", "scale-factor", "window-scale" }; if (excludedkeys.contains(key)) { return; } - if (key == "gtk-cursor-theme-name") { + if (key == "gtk-cursor-theme-name" || key == "gtk-cursor-theme-size") { updateXResources(); + } else if (key == "gtk-cursor-theme-size-base") { + int cursorSizeBase = m_settingDconfig->value(key).toInt(); + m_settingDconfig->setValue("gtk-cursor-theme-size", cursorSizeBase); + return; } + QSharedPointer dconfInfo = m_dconfInfos.getByDconfKey(key); if (dconfInfo.isNull()) { return; @@ -510,7 +515,6 @@ void XSettingsManager::setGSettingsByXProp(const QString &prop, XsValue value) void XSettingsManager::setSingleScaleFactor(double scale, bool emitSignal) { - int cursorSize = static_cast(BASE_CURSORSIZE * scale); int windowScale = qFloor((scale + 0.3) * 10) / 10; if (windowScale < 1) { windowScale = 1; @@ -523,7 +527,12 @@ void XSettingsManager::setSingleScaleFactor(double scale, bool emitSignal) if (windowScale != oldWindowScale) { m_settingDconfig->setValue(dcKeyWindowScale, windowScale); } - + bool ok = false; + int baseCursorSizeInt = m_settingDconfig->value("gtk-cursor-theme-size-base").toInt(&ok); + if (!ok || baseCursorSizeInt <= 0) { + baseCursorSizeInt = BASE_CURSORSIZE; + } + int cursorSize = static_cast(baseCursorSizeInt * scale); m_settingDconfig->setValue(dcKeyGtkCursorThemeSize, cursorSize); } diff --git a/src/plugin-qt/xsettings/misc/org.deepin.XSettings.json b/src/plugin-qt/xsettings/misc/org.deepin.XSettings.json index 46f8569a..6dde7df2 100644 --- a/src/plugin-qt/xsettings/misc/org.deepin.XSettings.json +++ b/src/plugin-qt/xsettings/misc/org.deepin.XSettings.json @@ -150,8 +150,17 @@ "value": 24, "serial": 0, "flags": [], - "name": "Timeout before click repeat", - "description": "Timeout in milliseconds before a click starts repeating (onspinner buttons for example).", + "name": "Cursor theme size", + "description": "Cursor theme size", + "permissions": "readwrite", + "visibility": "private" + }, + "gtk-cursor-theme-size-base": { + "value": 24, + "serial": 0, + "flags": [], + "name": "Base Cursor Size", + "description": "Base size for cursor scaling", "permissions": "readwrite", "visibility": "private" }, @@ -349,4 +358,4 @@ "visibility": "private" } } -} \ No newline at end of file +}