Improve reading the color scheme in Client
Only emit paletteChanged signal and repaint decoration if the palette actually changed. Even more important: check for path.isEmpty() instead of path.isNull(). ::isNull() returns false for "" causing a costly creation for default color scheme. REVIEW: 122083
This commit is contained in:
parent
7dc2baf74d
commit
60ebdbe352
1 changed files with 9 additions and 5 deletions
14
client.cpp
14
client.cpp
|
@ -2294,13 +2294,17 @@ void Client::updateColorScheme()
|
||||||
// TODO: move into KWindowInfo
|
// TODO: move into KWindowInfo
|
||||||
QString path = QString::fromUtf8(Xcb::StringProperty(m_client, atoms->kde_color_sheme));
|
QString path = QString::fromUtf8(Xcb::StringProperty(m_client, atoms->kde_color_sheme));
|
||||||
path = rules()->checkDecoColor(path);
|
path = rules()->checkDecoColor(path);
|
||||||
if (!path.isNull()) {
|
QPalette p = m_palette;
|
||||||
m_palette = KColorScheme::createApplicationPalette(KSharedConfig::openConfig(path));
|
if (!path.isEmpty()) {
|
||||||
|
p = KColorScheme::createApplicationPalette(KSharedConfig::openConfig(path));
|
||||||
} else {
|
} else {
|
||||||
m_palette = QApplication::palette();
|
p = QApplication::palette();
|
||||||
|
}
|
||||||
|
if (p != m_palette) {
|
||||||
|
m_palette = p;
|
||||||
|
emit paletteChanged(m_palette);
|
||||||
|
triggerDecorationRepaint();
|
||||||
}
|
}
|
||||||
emit paletteChanged(m_palette);
|
|
||||||
triggerDecorationRepaint();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Client::isClient() const
|
bool Client::isClient() const
|
||||||
|
|
Loading…
Reference in a new issue