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); 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 #ifdef KWIN_BUILD_ACTIVITIES
QStringList newActivitiesList; QStringList newActivitiesList;
QByteArray prop = Xcb::StringProperty(window(), atoms->activities); QByteArray prop = property;
activitiesDefined = !prop.isEmpty(); activitiesDefined = !prop.isEmpty();
if (QString::fromUtf8(prop) == Activities::nullUuid()) { if (QString::fromUtf8(prop) == Activities::nullUuid()) {
//copied from setOnAllActivities to avoid a redundant XChangeProperty. //copied from setOnAllActivities to avoid a redundant XChangeProperty.
@ -2272,6 +2281,16 @@ void Client::checkActivities()
} }
} }
setOnActivities(newActivitiesList); setOnActivities(newActivitiesList);
#else
Q_UNUSED(property)
#endif
}
void Client::checkActivities()
{
#ifdef KWIN_BUILD_ACTIVITIES
Xcb::StringProperty property = fetchActivities();
readActivities(property);
#endif #endif
} }

View file

@ -1036,6 +1036,8 @@ private:
friend bool performTransiencyCheck(); friend bool performTransiencyCheck();
Xcb::StringProperty fetchActivities() const;
void readActivities(Xcb::StringProperty &property);
void checkActivities(); void checkActivities();
bool activitiesDefined; //whether the x property was actually set 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 colorSchemeCookie = fetchColorScheme();
auto firstInTabBoxCookie = fetchFirstInTabBox(); auto firstInTabBoxCookie = fetchFirstInTabBox();
auto transientCookie = fetchTransient(); auto transientCookie = fetchTransient();
auto activitiesCookie = fetchActivities();
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
@ -170,7 +171,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
init_minimize = rules()->checkMinimize(init_minimize, !isMapped); init_minimize = rules()->checkMinimize(init_minimize, !isMapped);
noborder = rules()->checkNoBorder(noborder, !isMapped); noborder = rules()->checkNoBorder(noborder, !isMapped);
checkActivities(); readActivities(activitiesCookie);
// Initial desktop placement // Initial desktop placement
if (session) { if (session) {