First try getting cursor theme from environment variable
If XCURSOR_THEME and XCURSOR_SIZE are set they are preferred over reading the values from kcminputrc. REVIEW: 121923 BUG: 334954 FIXED-IN: 5.2.0
This commit is contained in:
parent
d173ff7412
commit
ab4b1ba25a
2 changed files with 24 additions and 6 deletions
29
cursor.cpp
29
cursor.cpp
|
@ -76,14 +76,31 @@ Cursor::~Cursor()
|
|||
|
||||
void Cursor::loadThemeSettings()
|
||||
{
|
||||
KConfigGroup mousecfg(KSharedConfig::openConfig("kcminputrc", KConfig::NoGlobals), "Mouse");
|
||||
m_themeName = mousecfg.readEntry("cursorTheme", "default");
|
||||
QString themeName = QString::fromUtf8(qgetenv("XCURSOR_THEME"));
|
||||
bool ok = false;
|
||||
m_themeSize = mousecfg.readEntry("cursorSize", QString("24")).toUInt(&ok);
|
||||
if (!ok) {
|
||||
m_themeSize = 24;
|
||||
uint themeSize = qgetenv("XCURSOR_SIZE").toUInt(&ok);
|
||||
if (!themeName.isEmpty() && ok) {
|
||||
updateTheme(themeName, themeSize);
|
||||
return;
|
||||
}
|
||||
// didn't get from environment variables, read from config file
|
||||
KConfigGroup mousecfg(KSharedConfig::openConfig("kcminputrc", KConfig::NoGlobals), "Mouse");
|
||||
themeName = mousecfg.readEntry("cursorTheme", "default");
|
||||
ok = false;
|
||||
themeSize = mousecfg.readEntry("cursorSize", QString("24")).toUInt(&ok);
|
||||
if (!ok) {
|
||||
themeSize = 24;
|
||||
}
|
||||
updateTheme(themeName, themeSize);
|
||||
}
|
||||
|
||||
void Cursor::updateTheme(const QString &name, int size)
|
||||
{
|
||||
if (m_themeName != name || m_themeSize != size) {
|
||||
m_themeName = name;
|
||||
m_themeSize = size;
|
||||
emit themeChanged();
|
||||
}
|
||||
emit themeChanged();
|
||||
}
|
||||
|
||||
QPoint Cursor::pos()
|
||||
|
|
1
cursor.h
1
cursor.h
|
@ -192,6 +192,7 @@ private Q_SLOTS:
|
|||
void loadThemeSettings();
|
||||
|
||||
private:
|
||||
void updateTheme(const QString &name, int size);
|
||||
QPoint m_pos;
|
||||
int m_mousePollingCounter;
|
||||
int m_cursorTrackingCounter;
|
||||
|
|
Loading…
Reference in a new issue