Split Client::updateColorScheme into two parts

This commit is contained in:
Martin Gräßlin 2015-01-15 16:09:05 +01:00
parent a55c7ba0d5
commit 327dd406e6
3 changed files with 17 additions and 4 deletions

View file

@ -2299,10 +2299,14 @@ void Client::updateFirstInTabBox()
setFirstInTabBox(property.toBool(32, atoms->kde_first_in_window_list)); setFirstInTabBox(property.toBool(32, atoms->kde_first_in_window_list));
} }
void Client::updateColorScheme() Xcb::StringProperty Client::fetchColorScheme() const
{ {
// TODO: move into KWindowInfo return Xcb::StringProperty(m_client, atoms->kde_color_sheme);
QString path = QString::fromUtf8(Xcb::StringProperty(m_client, atoms->kde_color_sheme)); }
void Client::readColorScheme(Xcb::StringProperty &property)
{
QString path = QString::fromUtf8(property);
path = rules()->checkDecoColor(path); path = rules()->checkDecoColor(path);
QPalette p = m_palette; QPalette p = m_palette;
if (!path.isEmpty()) { if (!path.isEmpty()) {
@ -2317,6 +2321,12 @@ void Client::updateColorScheme()
} }
} }
void Client::updateColorScheme()
{
Xcb::StringProperty property = fetchColorScheme();
readColorScheme(property);
}
bool Client::isClient() const bool Client::isClient() const
{ {
return true; return true;

View file

@ -655,6 +655,8 @@ public:
m_firstInTabBox = enable; m_firstInTabBox = enable;
} }
void updateFirstInTabBox(); void updateFirstInTabBox();
Xcb::StringProperty fetchColorScheme() const;
void readColorScheme(Xcb::StringProperty &property);
void updateColorScheme(); void updateColorScheme();
//sets whether the client should be treated as a SessionInteract window //sets whether the client should be treated as a SessionInteract window

View file

@ -101,6 +101,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
auto skipCloseAnimationCookie = fetchSkipCloseAnimation(); auto skipCloseAnimationCookie = fetchSkipCloseAnimation();
auto gtkFrameExtentsCookie = fetchGtkFrameExtents(); auto gtkFrameExtentsCookie = fetchGtkFrameExtents();
auto showOnScreenEdgeCookie = fetchShowOnScreenEdge(); auto showOnScreenEdgeCookie = fetchShowOnScreenEdge();
auto colorSchemeCookie = fetchColorScheme();
info = new WinInfo(this, m_client, rootWindow(), properties, properties2); info = new WinInfo(this, m_client, rootWindow(), properties, properties2);
// If it's already mapped, ignore hint // If it's already mapped, ignore hint
@ -635,7 +636,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
updateWindowRules(Rules::All); // Was blocked while !isManaged() updateWindowRules(Rules::All); // Was blocked while !isManaged()
setBlockingCompositing(info->isBlockingCompositing()); setBlockingCompositing(info->isBlockingCompositing());
updateColorScheme(); readColorScheme(colorSchemeCookie);
readShowOnScreenEdge(showOnScreenEdgeCookie); readShowOnScreenEdge(showOnScreenEdgeCookie);
// TODO: there's a small problem here - isManaged() depends on the mapping state, // TODO: there's a small problem here - isManaged() depends on the mapping state,