Split Client::checkActivities into two parts

REVIEW: 122087
CCBUG: 329979
This commit is contained in:
Martin Gräßlin 2015-01-15 16:31:20 +01:00
parent 5abccbec7d
commit 14659a9907
3 changed files with 25 additions and 3 deletions

View file

@ -2230,11 +2230,20 @@ void Client::debug(QDebug& stream) const
print<QDebug>(stream);
}
void Client::checkActivities()
Xcb::StringProperty Client::fetchActivities() const
{
#ifdef KWIN_BUILD_ACTIVITIES
return Xcb::StringProperty(window(), atoms->activities);
#else
return Xcb::StringProperty();
#endif
}
void Client::readActivities(Xcb::StringProperty &property)
{
#ifdef KWIN_BUILD_ACTIVITIES
QStringList newActivitiesList;
QByteArray prop = Xcb::StringProperty(window(), atoms->activities);
QByteArray prop = property;
activitiesDefined = !prop.isEmpty();
if (QString::fromUtf8(prop) == Activities::nullUuid()) {
//copied from setOnAllActivities to avoid a redundant XChangeProperty.
@ -2272,6 +2281,16 @@ void Client::checkActivities()
}
}
setOnActivities(newActivitiesList);
#else
Q_UNUSED(property)
#endif
}
void Client::checkActivities()
{
#ifdef KWIN_BUILD_ACTIVITIES
Xcb::StringProperty property = fetchActivities();
readActivities(property);
#endif
}

View file

@ -1036,6 +1036,8 @@ private:
friend bool performTransiencyCheck();
Xcb::StringProperty fetchActivities() const;
void readActivities(Xcb::StringProperty &property);
void checkActivities();
bool activitiesDefined; //whether the x property was actually set

View file

@ -104,6 +104,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
auto colorSchemeCookie = fetchColorScheme();
auto firstInTabBoxCookie = fetchFirstInTabBox();
auto transientCookie = fetchTransient();
auto activitiesCookie = fetchActivities();
info = new WinInfo(this, m_client, rootWindow(), properties, properties2);
// If it's already mapped, ignore hint
@ -170,7 +171,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
init_minimize = rules()->checkMinimize(init_minimize, !isMapped);
noborder = rules()->checkNoBorder(noborder, !isMapped);
checkActivities();
readActivities(activitiesCookie);
// Initial desktop placement
if (session) {