Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions src/plugin-qt/xsettings/impl/xsettingsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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> dconfInfo = m_dconfInfos.getByDconfKey(key);
if (dconfInfo.isNull()) {
return;
Expand Down Expand Up @@ -510,7 +515,6 @@ void XSettingsManager::setGSettingsByXProp(const QString &prop, XsValue value)

void XSettingsManager::setSingleScaleFactor(double scale, bool emitSignal)
{
int cursorSize = static_cast<int>(BASE_CURSORSIZE * scale);
int windowScale = qFloor((scale + 0.3) * 10) / 10;
if (windowScale < 1) {
windowScale = 1;
Expand All @@ -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<int>(baseCursorSizeInt * scale);
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
m_settingDconfig->setValue(dcKeyGtkCursorThemeSize, cursorSize);
}

Expand Down
15 changes: 12 additions & 3 deletions src/plugin-qt/xsettings/misc/org.deepin.XSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -349,4 +358,4 @@
"visibility": "private"
}
}
}
}